Mercurial > emacs
annotate src/w32fns.c @ 45084:7cc9fc5941fa
*** empty log message ***
author | Colin Walters <walters@gnu.org> |
---|---|
date | Fri, 03 May 2002 19:26:43 +0000 |
parents | 7a00556be3ce |
children | 4413ac739ab9 |
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 |
43398 | 273 Lisp_Object Qfullscreen; |
274 Lisp_Object Qfullwidth; | |
275 Lisp_Object Qfullheight; | |
276 Lisp_Object Qfullboth; | |
277 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
278 extern Lisp_Object Qtop; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
279 extern Lisp_Object Qdisplay; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
280 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
281 /* 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
|
282 #define LMOUSE 1 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
283 #define MMOUSE 2 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
284 #define RMOUSE 4 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
285 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
286 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
|
287 static W32Msg saved_mouse_button_msg; |
43472
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
288 static unsigned mouse_button_timer = 0; /* 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
|
289 static W32Msg saved_mouse_move_msg; |
43472
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
290 static unsigned mouse_move_timer = 0; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
291 |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
292 /* Window that is tracking the mouse. */ |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
293 static HWND track_mouse_window; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
294 FARPROC track_mouse_event_fn; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
295 |
21874
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
296 /* W95 mousewheel handler */ |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
297 unsigned int msh_mousewheel = 0; |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
298 |
43472
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
299 /* Timers */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
300 #define MOUSE_BUTTON_ID 1 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
301 #define MOUSE_MOVE_ID 2 |
43472
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
302 #define MENU_FREE_ID 3 |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
303 /* The delay (milliseconds) before a menu is freed after WM_EXITMENULOOP |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
304 is received. */ |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
305 #define MENU_FREE_DELAY 1000 |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
306 static unsigned menu_free_timer = 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
307 |
13434 | 308 /* 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
|
309 |
13434 | 310 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
|
311 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
|
312 extern Lisp_Object Qtool_bar_lines; |
13434 | 313 |
314 extern Lisp_Object Vwindow_system_version; | |
315 | |
22625
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
316 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
|
317 |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
318 #ifdef GLYPH_DEBUG |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
319 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
|
320 #endif |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
321 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
322 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
323 /* From w32term.c. */ |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
324 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
|
325 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
|
326 |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
327 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
|
328 |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
329 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
|
330 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
|
331 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
|
332 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
|
333 |
42918
9b06036a8c5e
(syms_of_w32fns): Initialize w32_visible_system_caret_hwnd.
Jason Rumney <jasonr@gnu.org>
parents:
42865
diff
changeset
|
334 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
|
335 |
13434 | 336 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
337 /* 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
|
338 void |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
339 check_w32 () |
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 if (! w32_in_use) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
342 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
|
343 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
344 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
345 /* Nonzero if we can use mouse menus. |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
346 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
|
347 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
348 int |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
349 have_menus_p () |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
350 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
351 return w32_in_use; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
352 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
353 |
13434 | 354 /* 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
|
355 and checking validity for W32. */ |
13434 | 356 |
357 FRAME_PTR | |
358 check_x_frame (frame) | |
359 Lisp_Object frame; | |
360 { | |
361 FRAME_PTR f; | |
362 | |
363 if (NILP (frame)) | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
364 frame = selected_frame; |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
365 CHECK_LIVE_FRAME (frame); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
366 f = XFRAME (frame); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
367 if (! FRAME_W32_P (f)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
368 error ("non-w32 frame used"); |
13434 | 369 return f; |
370 } | |
371 | |
372 /* 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
|
373 nil stands for the selected frame--or, if that is not a w32 frame, |
13434 | 374 the first display on the list. */ |
375 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
376 static struct w32_display_info * |
13434 | 377 check_x_display_info (frame) |
378 Lisp_Object frame; | |
379 { | |
380 if (NILP (frame)) | |
381 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
382 struct frame *sf = XFRAME (selected_frame); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
383 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
384 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
|
385 return FRAME_W32_DISPLAY_INFO (sf); |
13434 | 386 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
387 return &one_w32_display_info; |
13434 | 388 } |
389 else if (STRINGP (frame)) | |
390 return x_display_info_for_name (frame); | |
391 else | |
392 { | |
393 FRAME_PTR f; | |
394 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
395 CHECK_LIVE_FRAME (frame); |
13434 | 396 f = XFRAME (frame); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
397 if (! FRAME_W32_P (f)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
398 error ("non-w32 frame used"); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
399 return FRAME_W32_DISPLAY_INFO (f); |
13434 | 400 } |
401 } | |
402 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
403 /* Return the Emacs frame-object corresponding to an w32 window. |
13434 | 404 It could be the frame's main window or an icon window. */ |
405 | |
406 /* This function can be called during GC, so use GC_xxx type test macros. */ | |
407 | |
408 struct frame * | |
409 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
|
410 struct w32_display_info *dpyinfo; |
13434 | 411 HWND wdesc; |
412 { | |
413 Lisp_Object tail, frame; | |
414 struct frame *f; | |
415 | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
416 for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail)) |
13434 | 417 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
418 frame = XCAR (tail); |
13434 | 419 if (!GC_FRAMEP (frame)) |
420 continue; | |
421 f = XFRAME (frame); | |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
25646
diff
changeset
|
422 if (!FRAME_W32_P (f) || FRAME_W32_DISPLAY_INFO (f) != dpyinfo) |
13434 | 423 continue; |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
424 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
|
425 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
|
426 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
427 if (FRAME_W32_WINDOW (f) == wdesc) |
13434 | 428 return f; |
429 } | |
430 return 0; | |
431 } | |
432 | |
433 | |
434 | |
435 /* Code to deal with bitmaps. Bitmaps are referenced by their bitmap | |
436 id, which is just an int that this section returns. Bitmaps are | |
437 reference counted so they can be shared among frames. | |
438 | |
439 Bitmap indices are guaranteed to be > 0, so a negative number can | |
440 be used to indicate no bitmap. | |
441 | |
442 If you use x_create_bitmap_from_data, then you must keep track of | |
443 the bitmaps yourself. That is, creating a bitmap from the same | |
444 data more than once will not be caught. */ | |
445 | |
446 | |
447 /* Functions to access the contents of a bitmap, given an id. */ | |
448 | |
449 int | |
450 x_bitmap_height (f, id) | |
451 FRAME_PTR f; | |
452 int id; | |
453 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
454 return FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].height; |
13434 | 455 } |
456 | |
457 int | |
458 x_bitmap_width (f, id) | |
459 FRAME_PTR f; | |
460 int id; | |
461 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
462 return FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].width; |
13434 | 463 } |
464 | |
465 int | |
466 x_bitmap_pixmap (f, id) | |
467 FRAME_PTR f; | |
468 int id; | |
469 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
470 return (int) FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap; |
13434 | 471 } |
472 | |
473 | |
474 /* Allocate a new bitmap record. Returns index of new record. */ | |
475 | |
476 static int | |
477 x_allocate_bitmap_record (f) | |
478 FRAME_PTR f; | |
479 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
480 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 481 int i; |
482 | |
483 if (dpyinfo->bitmaps == NULL) | |
484 { | |
485 dpyinfo->bitmaps_size = 10; | |
486 dpyinfo->bitmaps | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
487 = (struct w32_bitmap_record *) xmalloc (dpyinfo->bitmaps_size * sizeof (struct w32_bitmap_record)); |
13434 | 488 dpyinfo->bitmaps_last = 1; |
489 return 1; | |
490 } | |
491 | |
492 if (dpyinfo->bitmaps_last < dpyinfo->bitmaps_size) | |
493 return ++dpyinfo->bitmaps_last; | |
494 | |
495 for (i = 0; i < dpyinfo->bitmaps_size; ++i) | |
496 if (dpyinfo->bitmaps[i].refcount == 0) | |
497 return i + 1; | |
498 | |
499 dpyinfo->bitmaps_size *= 2; | |
500 dpyinfo->bitmaps | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
501 = (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
|
502 dpyinfo->bitmaps_size * sizeof (struct w32_bitmap_record)); |
13434 | 503 return ++dpyinfo->bitmaps_last; |
504 } | |
505 | |
506 /* Add one reference to the reference count of the bitmap with id ID. */ | |
507 | |
508 void | |
509 x_reference_bitmap (f, id) | |
510 FRAME_PTR f; | |
511 int id; | |
512 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
513 ++FRAME_W32_DISPLAY_INFO (f)->bitmaps[id - 1].refcount; |
13434 | 514 } |
515 | |
516 /* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS. */ | |
517 | |
518 int | |
519 x_create_bitmap_from_data (f, bits, width, height) | |
520 struct frame *f; | |
521 char *bits; | |
522 unsigned int width, height; | |
523 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
524 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 525 Pixmap bitmap; |
526 int id; | |
527 | |
528 bitmap = CreateBitmap (width, height, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
529 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
|
530 FRAME_W32_DISPLAY_INFO (XFRAME (frame))->n_cbits, |
13434 | 531 bits); |
532 | |
533 if (! bitmap) | |
534 return -1; | |
535 | |
536 id = x_allocate_bitmap_record (f); | |
537 dpyinfo->bitmaps[id - 1].pixmap = bitmap; | |
538 dpyinfo->bitmaps[id - 1].file = NULL; | |
539 dpyinfo->bitmaps[id - 1].hinst = NULL; | |
540 dpyinfo->bitmaps[id - 1].refcount = 1; | |
541 dpyinfo->bitmaps[id - 1].depth = 1; | |
542 dpyinfo->bitmaps[id - 1].height = height; | |
543 dpyinfo->bitmaps[id - 1].width = width; | |
544 | |
545 return id; | |
546 } | |
547 | |
548 /* Create bitmap from file FILE for frame F. */ | |
549 | |
550 int | |
551 x_create_bitmap_from_file (f, file) | |
552 struct frame *f; | |
553 Lisp_Object file; | |
554 { | |
555 return -1; | |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
556 #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
|
557 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 558 unsigned int width, height; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
559 HBITMAP bitmap; |
13434 | 560 int xhot, yhot, result, id; |
561 Lisp_Object found; | |
562 int fd; | |
563 char *filename; | |
564 HINSTANCE hinst; | |
565 | |
566 /* Look for an existing bitmap with the same name. */ | |
567 for (id = 0; id < dpyinfo->bitmaps_last; ++id) | |
568 { | |
569 if (dpyinfo->bitmaps[id].refcount | |
570 && dpyinfo->bitmaps[id].file | |
571 && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data)) | |
572 { | |
573 ++dpyinfo->bitmaps[id].refcount; | |
574 return id + 1; | |
575 } | |
576 } | |
577 | |
578 /* Search bitmap-file-path for the file, if appropriate. */ | |
45009
7a00556be3ce
(x_create_bitmap_from_file, x_find_image_file): Update call to openp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44642
diff
changeset
|
579 fd = openp (Vx_bitmap_file_path, file, Qnil, &found, Qnil); |
13434 | 580 if (fd < 0) |
581 return -1; | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
582 emacs_close (fd); |
13434 | 583 |
584 filename = (char *) XSTRING (found)->data; | |
585 | |
586 hinst = LoadLibraryEx (filename, NULL, LOAD_LIBRARY_AS_DATAFILE); | |
587 | |
588 if (hinst == NULL) | |
589 return -1; | |
590 | |
591 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
592 result = XReadBitmapFile (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), |
13434 | 593 filename, &width, &height, &bitmap, &xhot, &yhot); |
594 if (result != BitmapSuccess) | |
595 return -1; | |
596 | |
597 id = x_allocate_bitmap_record (f); | |
598 dpyinfo->bitmaps[id - 1].pixmap = bitmap; | |
599 dpyinfo->bitmaps[id - 1].refcount = 1; | |
600 dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (XSTRING (file)->size + 1); | |
601 dpyinfo->bitmaps[id - 1].depth = 1; | |
602 dpyinfo->bitmaps[id - 1].height = height; | |
603 dpyinfo->bitmaps[id - 1].width = width; | |
604 strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data); | |
605 | |
606 return id; | |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
607 #endif /* TODO */ |
13434 | 608 } |
609 | |
610 /* Remove reference to bitmap with id number ID. */ | |
611 | |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
612 void |
13434 | 613 x_destroy_bitmap (f, id) |
614 FRAME_PTR f; | |
615 int id; | |
616 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
617 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 618 |
619 if (id > 0) | |
620 { | |
621 --dpyinfo->bitmaps[id - 1].refcount; | |
622 if (dpyinfo->bitmaps[id - 1].refcount == 0) | |
623 { | |
624 BLOCK_INPUT; | |
625 DeleteObject (dpyinfo->bitmaps[id - 1].pixmap); | |
626 if (dpyinfo->bitmaps[id - 1].file) | |
627 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
628 xfree (dpyinfo->bitmaps[id - 1].file); |
13434 | 629 dpyinfo->bitmaps[id - 1].file = NULL; |
630 } | |
631 UNBLOCK_INPUT; | |
632 } | |
633 } | |
634 } | |
635 | |
636 /* Free all the bitmaps for the display specified by DPYINFO. */ | |
637 | |
638 static void | |
639 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
|
640 struct w32_display_info *dpyinfo; |
13434 | 641 { |
642 int i; | |
643 for (i = 0; i < dpyinfo->bitmaps_last; i++) | |
644 if (dpyinfo->bitmaps[i].refcount > 0) | |
645 { | |
646 DeleteObject (dpyinfo->bitmaps[i].pixmap); | |
647 if (dpyinfo->bitmaps[i].file) | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
648 xfree (dpyinfo->bitmaps[i].file); |
13434 | 649 } |
650 dpyinfo->bitmaps_last = 0; | |
651 } | |
652 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
653 /* Connect the frame-parameter names for W32 frames |
13434 | 654 to the ways of passing the parameter values to the window system. |
655 | |
656 The name of a parameter, as a Lisp symbol, | |
657 has an `x-frame-parameter' property which is an integer in Lisp | |
658 but can be interpreted as an `enum x_frame_parm' in C. */ | |
659 | |
660 enum x_frame_parm | |
661 { | |
662 X_PARM_FOREGROUND_COLOR, | |
663 X_PARM_BACKGROUND_COLOR, | |
664 X_PARM_MOUSE_COLOR, | |
665 X_PARM_CURSOR_COLOR, | |
666 X_PARM_BORDER_COLOR, | |
667 X_PARM_ICON_TYPE, | |
668 X_PARM_FONT, | |
669 X_PARM_BORDER_WIDTH, | |
670 X_PARM_INTERNAL_BORDER_WIDTH, | |
671 X_PARM_NAME, | |
672 X_PARM_AUTORAISE, | |
673 X_PARM_AUTOLOWER, | |
674 X_PARM_VERT_SCROLL_BAR, | |
675 X_PARM_VISIBILITY, | |
676 X_PARM_MENU_BAR_LINES | |
677 }; | |
678 | |
679 | |
680 struct x_frame_parm_table | |
681 { | |
682 char *name; | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
683 void (*setter) P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
13434 | 684 }; |
685 | |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
686 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
|
687 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
|
688 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
|
689 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
|
690 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
|
691 /* 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
|
692 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
|
693 static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
43398 | 694 static void x_set_fullscreen 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
|
695 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
|
696 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
|
697 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
|
698 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
|
699 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
|
700 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
|
701 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
|
702 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
|
703 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
|
704 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
|
705 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
|
706 Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
707 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
|
708 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
|
709 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
|
710 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
|
711 Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
712 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
|
713 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
|
714 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
|
715 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
|
716 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
|
717 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
|
718 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
|
719 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
|
720 Lisp_Object)); |
13434 | 721 |
722 static struct x_frame_parm_table x_frame_parms[] = | |
723 { | |
42537
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
724 {"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
|
725 {"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
|
726 {"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
|
727 {"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
|
728 {"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
|
729 {"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
|
730 {"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
|
731 {"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
|
732 {"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
|
733 {"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
|
734 {"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
|
735 {"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
|
736 {"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
|
737 {"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
|
738 {"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
|
739 {"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
|
740 {"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
|
741 {"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
|
742 {"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
|
743 {"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
|
744 {"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
|
745 {"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
|
746 {"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
|
747 {"left-fringe", x_set_fringe_width}, |
43398 | 748 {"right-fringe", x_set_fringe_width}, |
749 {"fullscreen", x_set_fullscreen}, | |
13434 | 750 }; |
751 | |
752 /* 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
|
753 the Lisp symbol names of parameters relevant to W32. */ |
13434 | 754 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
755 void |
13434 | 756 init_x_parm_symbols () |
757 { | |
758 int i; | |
759 | |
760 for (i = 0; i < sizeof (x_frame_parms) / sizeof (x_frame_parms[0]); i++) | |
761 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter, | |
762 make_number (i)); | |
763 } | |
764 | |
43398 | 765 /* Really try to move where we want to be in case of fullscreen. Some WMs |
766 moves the window where we tell them. Some (mwm, twm) moves the outer | |
767 window manager window there instead. | |
768 Try to compensate for those WM here. */ | |
769 static void | |
770 x_fullscreen_move (f, new_top, new_left) | |
771 struct frame *f; | |
772 int new_top; | |
773 int new_left; | |
774 { | |
775 if (new_top != f->output_data.w32->top_pos | |
776 || new_left != f->output_data.w32->left_pos) | |
777 { | |
778 int move_x = new_left; | |
779 int move_y = new_top; | |
780 | |
781 f->output_data.w32->want_fullscreen |= FULLSCREEN_MOVE_WAIT; | |
782 x_set_offset (f, move_x, move_y, 1); | |
783 } | |
784 } | |
785 | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
786 /* Change the parameters of frame F as specified by ALIST. |
13434 | 787 If a parameter is not specially recognized, do nothing; |
788 otherwise call the `x_set_...' function for that parameter. */ | |
789 | |
790 void | |
791 x_set_frame_parameters (f, alist) | |
792 FRAME_PTR f; | |
793 Lisp_Object alist; | |
794 { | |
795 Lisp_Object tail; | |
796 | |
797 /* If both of these parameters are present, it's more efficient to | |
798 set them both at once. So we wait until we've looked at the | |
799 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
|
800 int width, height; |
13434 | 801 |
802 /* Same here. */ | |
803 Lisp_Object left, top; | |
804 | |
805 /* Same with these. */ | |
806 Lisp_Object icon_left, icon_top; | |
807 | |
808 /* Record in these vectors all the parms specified. */ | |
809 Lisp_Object *parms; | |
810 Lisp_Object *values; | |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
811 int i, p; |
13434 | 812 int left_no_change = 0, top_no_change = 0; |
813 int icon_left_no_change = 0, icon_top_no_change = 0; | |
43398 | 814 int fullscreen_is_being_set = 0; |
13434 | 815 |
24211
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
816 struct gcpro gcpro1, gcpro2; |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
817 |
13434 | 818 i = 0; |
819 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) | |
820 i++; | |
821 | |
822 parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object)); | |
823 values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object)); | |
824 | |
825 /* Extract parm names and values into those vectors. */ | |
826 | |
827 i = 0; | |
828 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) | |
829 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
830 Lisp_Object elt; |
13434 | 831 |
832 elt = Fcar (tail); | |
833 parms[i] = Fcar (elt); | |
834 values[i] = Fcdr (elt); | |
835 i++; | |
836 } | |
24211
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
837 /* 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
|
838 alist = tail = Qnil; |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
839 |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
840 GCPRO2 (*parms, *values); |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
841 gcpro1.nvars = i; |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
842 gcpro2.nvars = i; |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
843 |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
844 /* 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
|
845 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
|
846 top = left = Qunbound; |
13434 | 847 icon_left = icon_top = Qunbound; |
848 | |
16106
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
849 /* 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
|
850 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
|
851 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
|
852 else |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
853 width = FRAME_WIDTH (f); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
854 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
855 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
|
856 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
|
857 else |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
858 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
|
859 |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
860 /* 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
|
861 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
|
862 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
|
863 /* 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
|
864 for (p = 0; p < i; p++) |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
865 { |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
866 Lisp_Object prop, val; |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
867 |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
868 prop = parms[p]; |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
869 val = values[p]; |
41726
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
870 if (EQ (prop, Qforeground_color) |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
871 || EQ (prop, Qbackground_color) |
43398 | 872 || EQ (prop, Qfont) |
873 || EQ (prop, Qfullscreen)) | |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
874 { |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
875 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
|
876 |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
877 old_value = get_frame_param (f, prop); |
43398 | 878 fullscreen_is_being_set |= EQ (prop, Qfullscreen); |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
879 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
880 if (NILP (Fequal (val, old_value))) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
881 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
882 store_frame_param (f, prop, val); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
883 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
884 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
|
885 if (NATNUMP (param_index) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
886 && (XFASTINT (param_index) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
887 < 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
|
888 (*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
|
889 } |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
890 } |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
891 } |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
892 |
13434 | 893 /* Now process them in reverse of specified order. */ |
894 for (i--; i >= 0; i--) | |
895 { | |
896 Lisp_Object prop, val; | |
897 | |
898 prop = parms[i]; | |
899 val = values[i]; | |
900 | |
16106
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
901 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
|
902 width = XFASTINT (val); |
fdd1b2ade15d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16089
diff
changeset
|
903 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
|
904 height = XFASTINT (val); |
13434 | 905 else if (EQ (prop, Qtop)) |
906 top = val; | |
907 else if (EQ (prop, Qleft)) | |
908 left = val; | |
909 else if (EQ (prop, Qicon_top)) | |
910 icon_top = val; | |
911 else if (EQ (prop, Qicon_left)) | |
912 icon_left = val; | |
41726
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
913 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
|
914 || EQ (prop, Qbackground_color) |
43398 | 915 || EQ (prop, Qfont) |
916 || EQ (prop, Qfullscreen)) | |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
917 /* Processed above. */ |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25235
diff
changeset
|
918 continue; |
13434 | 919 else |
920 { | |
921 register Lisp_Object param_index, old_value; | |
922 | |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
923 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
|
924 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
925 store_frame_param (f, prop, val); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
926 |
13434 | 927 param_index = Fget (prop, Qx_frame_parameter); |
928 if (NATNUMP (param_index) | |
929 && (XFASTINT (param_index) | |
930 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]))) | |
14353 | 931 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value); |
13434 | 932 } |
933 } | |
934 | |
935 /* Don't die if just one of these was set. */ | |
936 if (EQ (left, Qunbound)) | |
937 { | |
938 left_no_change = 1; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
939 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
|
940 left = Fcons (Qplus, Fcons (make_number (f->output_data.w32->left_pos), Qnil)); |
13434 | 941 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
942 XSETINT (left, f->output_data.w32->left_pos); |
13434 | 943 } |
944 if (EQ (top, Qunbound)) | |
945 { | |
946 top_no_change = 1; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
947 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
|
948 top = Fcons (Qplus, Fcons (make_number (f->output_data.w32->top_pos), Qnil)); |
13434 | 949 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
950 XSETINT (top, f->output_data.w32->top_pos); |
13434 | 951 } |
952 | |
953 /* If one of the icon positions was not set, preserve or default it. */ | |
954 if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left)) | |
955 { | |
956 icon_left_no_change = 1; | |
957 icon_left = Fcdr (Fassq (Qicon_left, f->param_alist)); | |
958 if (NILP (icon_left)) | |
959 XSETINT (icon_left, 0); | |
960 } | |
961 if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top)) | |
962 { | |
963 icon_top_no_change = 1; | |
964 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist)); | |
965 if (NILP (icon_top)) | |
966 XSETINT (icon_top, 0); | |
967 } | |
968 | |
43398 | 969 if (FRAME_VISIBLE_P (f) && fullscreen_is_being_set) |
970 { | |
971 /* If the frame is visible already and the fullscreen parameter is | |
972 being set, it is too late to set WM manager hints to specify | |
973 size and position. | |
974 Here we first get the width, height and position that applies to | |
975 fullscreen. We then move the frame to the appropriate | |
976 position. Resize of the frame is taken care of in the code after | |
977 this if-statement. */ | |
978 int new_left, new_top; | |
979 | |
980 x_fullscreen_adjust (f, &width, &height, &new_top, &new_left); | |
981 x_fullscreen_move (f, new_top, new_left); | |
982 } | |
983 | |
13434 | 984 /* Don't set these parameters unless they've been explicitly |
985 specified. The window might be mapped or resized while we're in | |
986 this function, and we don't want to override that unless the lisp | |
987 code has asked for it. | |
988 | |
989 Don't set these parameters unless they actually differ from the | |
990 window's current parameters; the window may not actually exist | |
991 yet. */ | |
992 { | |
993 Lisp_Object frame; | |
994 | |
995 check_frame_size (f, &height, &width); | |
996 | |
997 XSETFRAME (frame, f); | |
998 | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
999 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
|
1000 || height != FRAME_HEIGHT (f) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1001 || 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
|
1002 Fset_frame_size (frame, make_number (width), make_number (height)); |
13434 | 1003 |
1004 if ((!NILP (left) || !NILP (top)) | |
1005 && ! (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
|
1006 && ! (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
|
1007 && NUMBERP (top) && XINT (top) == f->output_data.w32->top_pos)) |
13434 | 1008 { |
1009 int leftpos = 0; | |
1010 int toppos = 0; | |
1011 | |
1012 /* Record the signs. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1013 f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative); |
13434 | 1014 if (EQ (left, Qminus)) |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1015 f->output_data.w32->size_hint_flags |= XNegative; |
13434 | 1016 else if (INTEGERP (left)) |
1017 { | |
1018 leftpos = XINT (left); | |
1019 if (leftpos < 0) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1020 f->output_data.w32->size_hint_flags |= XNegative; |
13434 | 1021 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
1022 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
|
1023 && CONSP (XCDR (left)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
1024 && INTEGERP (XCAR (XCDR (left)))) |
13434 | 1025 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
1026 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
|
1027 f->output_data.w32->size_hint_flags |= XNegative; |
13434 | 1028 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
1029 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
|
1030 && CONSP (XCDR (left)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
1031 && INTEGERP (XCAR (XCDR (left)))) |
13434 | 1032 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
1033 leftpos = XINT (XCAR (XCDR (left))); |
13434 | 1034 } |
1035 | |
1036 if (EQ (top, Qminus)) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1037 f->output_data.w32->size_hint_flags |= YNegative; |
13434 | 1038 else if (INTEGERP (top)) |
1039 { | |
1040 toppos = XINT (top); | |
1041 if (toppos < 0) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1042 f->output_data.w32->size_hint_flags |= YNegative; |
13434 | 1043 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
1044 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
|
1045 && CONSP (XCDR (top)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
1046 && INTEGERP (XCAR (XCDR (top)))) |
13434 | 1047 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
1048 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
|
1049 f->output_data.w32->size_hint_flags |= YNegative; |
13434 | 1050 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
1051 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
|
1052 && CONSP (XCDR (top)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
1053 && INTEGERP (XCAR (XCDR (top)))) |
13434 | 1054 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
1055 toppos = XINT (XCAR (XCDR (top))); |
13434 | 1056 } |
1057 | |
1058 | |
1059 /* 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
|
1060 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
|
1061 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
|
1062 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1063 f->output_data.w32->win_gravity = NorthWestGravity; |
13434 | 1064 |
1065 /* Actually set that position, and convert to absolute. */ | |
1066 x_set_offset (f, leftpos, toppos, -1); | |
1067 } | |
1068 | |
1069 if ((!NILP (icon_left) || !NILP (icon_top)) | |
1070 && ! (icon_left_no_change && icon_top_no_change)) | |
1071 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top)); | |
1072 } | |
24211
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
1073 |
9ecc7b851682
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
24206
diff
changeset
|
1074 UNGCPRO; |
13434 | 1075 } |
1076 | |
1077 /* Store the screen positions of frame F into XPTR and YPTR. | |
1078 These are the positions of the containing window manager window, | |
1079 not Emacs's own window. */ | |
1080 | |
1081 void | |
1082 x_real_positions (f, xptr, yptr) | |
1083 FRAME_PTR f; | |
1084 int *xptr, *yptr; | |
1085 { | |
1086 POINT pt; | |
43398 | 1087 RECT rect; |
1088 | |
1089 GetClientRect(FRAME_W32_WINDOW(f), &rect); | |
1090 AdjustWindowRect(&rect, f->output_data.w32->dwStyle, FRAME_EXTERNAL_MENU_BAR(f)); | |
1091 | |
1092 pt.x = rect.left; | |
1093 pt.y = rect.top; | |
14353 | 1094 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1095 ClientToScreen (FRAME_W32_WINDOW(f), &pt); |
13434 | 1096 |
43398 | 1097 /* Remember x_pixels_diff and y_pixels_diff. */ |
1098 f->output_data.w32->x_pixels_diff = pt.x - rect.left; | |
1099 f->output_data.w32->y_pixels_diff = pt.y - rect.top; | |
1100 | |
13434 | 1101 *xptr = pt.x; |
1102 *yptr = pt.y; | |
1103 } | |
1104 | |
1105 /* Insert a description of internally-recorded parameters of frame X | |
1106 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
|
1107 Only parameters that are specific to W32 |
13434 | 1108 and whose values are not correctly recorded in the frame's |
1109 param_alist need to be considered here. */ | |
1110 | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
1111 void |
13434 | 1112 x_report_frame_params (f, alistptr) |
1113 struct frame *f; | |
1114 Lisp_Object *alistptr; | |
1115 { | |
1116 char buf[16]; | |
1117 Lisp_Object tem; | |
1118 | |
1119 /* Represent negative positions (off the top or left screen edge) | |
1120 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
|
1121 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
|
1122 if (f->output_data.w32->left_pos >= 0) |
13434 | 1123 store_in_alist (alistptr, Qleft, tem); |
1124 else | |
1125 store_in_alist (alistptr, Qleft, Fcons (Qplus, Fcons (tem, Qnil))); | |
1126 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1127 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
|
1128 if (f->output_data.w32->top_pos >= 0) |
13434 | 1129 store_in_alist (alistptr, Qtop, tem); |
1130 else | |
1131 store_in_alist (alistptr, Qtop, Fcons (Qplus, Fcons (tem, Qnil))); | |
1132 | |
1133 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
|
1134 make_number (f->output_data.w32->border_width)); |
13434 | 1135 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
|
1136 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
|
1137 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
|
1138 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
|
1139 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
|
1140 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
|
1141 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
|
1142 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
|
1143 ? 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
|
1144 : 0)); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1145 sprintf (buf, "%ld", (long) FRAME_W32_WINDOW (f)); |
13434 | 1146 store_in_alist (alistptr, Qwindow_id, |
1147 build_string (buf)); | |
1148 store_in_alist (alistptr, Qicon_name, f->icon_name); | |
1149 FRAME_SAMPLE_VISIBILITY (f); | |
1150 store_in_alist (alistptr, Qvisibility, | |
1151 (FRAME_VISIBLE_P (f) ? Qt | |
1152 : FRAME_ICONIFIED_P (f) ? Qicon : Qnil)); | |
1153 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
|
1154 XCAR (FRAME_W32_DISPLAY_INFO (f)->name_list_element)); |
13434 | 1155 } |
1156 | |
1157 | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1158 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
|
1159 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
|
1160 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
|
1161 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
|
1162 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
|
1163 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
|
1164 (red, green, blue, name) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1165 Lisp_Object red, green, blue, name; |
13434 | 1166 { |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1167 Lisp_Object rgb; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1168 Lisp_Object oldrgb = Qnil; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1169 Lisp_Object entry; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1170 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
1171 CHECK_NUMBER (red); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
1172 CHECK_NUMBER (green); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
1173 CHECK_NUMBER (blue); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
1174 CHECK_STRING (name); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1175 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1176 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
|
1177 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1178 BLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1179 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1180 /* 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
|
1181 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
|
1182 if (NILP (entry)) |
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 entry = Fcons (name, rgb); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1185 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
|
1186 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1187 else |
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 oldrgb = Fcdr (entry); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1190 Fsetcdr (entry, rgb); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1191 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1192 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1193 UNBLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1194 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1195 return (oldrgb); |
13434 | 1196 } |
1197 | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1198 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
|
1199 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
|
1200 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
|
1201 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
|
1202 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
1203 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
|
1204 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
|
1205 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
|
1206 (filename) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1207 Lisp_Object filename; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1208 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1209 FILE *fp; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1210 Lisp_Object cmap = Qnil; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1211 Lisp_Object abspath; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1212 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
1213 CHECK_STRING (filename); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1214 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
|
1215 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1216 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
|
1217 if (fp) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1218 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1219 char buf[512]; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1220 int red, green, blue; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1221 int num; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1222 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1223 BLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1224 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1225 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
|
1226 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
|
1227 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1228 char *name = buf + num; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1229 num = strlen (name) - 1; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1230 if (name[num] == '\n') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1231 name[num] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1232 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
|
1233 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
|
1234 cmap); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1235 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1236 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1237 fclose (fp); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1238 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1239 UNBLOCK_INPUT; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1240 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1241 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1242 return cmap; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1243 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1244 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1245 /* The default colors for the w32 color map */ |
13434 | 1246 typedef struct colormap_t |
1247 { | |
1248 char *name; | |
1249 COLORREF colorref; | |
1250 } colormap_t; | |
1251 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1252 colormap_t w32_color_map[] = |
13434 | 1253 { |
14983
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1254 {"snow" , PALETTERGB (255,250,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1255 {"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
|
1256 {"GhostWhite" , PALETTERGB (248,248,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1257 {"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
|
1258 {"WhiteSmoke" , PALETTERGB (245,245,245)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1259 {"gainsboro" , PALETTERGB (220,220,220)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1260 {"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
|
1261 {"FloralWhite" , PALETTERGB (255,250,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1262 {"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
|
1263 {"OldLace" , PALETTERGB (253,245,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1264 {"linen" , PALETTERGB (250,240,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1265 {"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
|
1266 {"AntiqueWhite" , PALETTERGB (250,235,215)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1267 {"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
|
1268 {"PapayaWhip" , PALETTERGB (255,239,213)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1269 {"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
|
1270 {"BlanchedAlmond" , PALETTERGB (255,235,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1271 {"bisque" , PALETTERGB (255,228,196)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1272 {"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
|
1273 {"PeachPuff" , PALETTERGB (255,218,185)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1274 {"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
|
1275 {"NavajoWhite" , PALETTERGB (255,222,173)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1276 {"moccasin" , PALETTERGB (255,228,181)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1277 {"cornsilk" , PALETTERGB (255,248,220)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1278 {"ivory" , PALETTERGB (255,255,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1279 {"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
|
1280 {"LemonChiffon" , PALETTERGB (255,250,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1281 {"seashell" , PALETTERGB (255,245,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1282 {"honeydew" , PALETTERGB (240,255,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1283 {"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
|
1284 {"MintCream" , PALETTERGB (245,255,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1285 {"azure" , PALETTERGB (240,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1286 {"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
|
1287 {"AliceBlue" , PALETTERGB (240,248,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1288 {"lavender" , PALETTERGB (230,230,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1289 {"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
|
1290 {"LavenderBlush" , PALETTERGB (255,240,245)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1291 {"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
|
1292 {"MistyRose" , PALETTERGB (255,228,225)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1293 {"white" , PALETTERGB (255,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1294 {"black" , PALETTERGB ( 0, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1295 {"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
|
1296 {"DarkSlateGray" , PALETTERGB ( 47, 79, 79)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1297 {"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
|
1298 {"DarkSlateGrey" , PALETTERGB ( 47, 79, 79)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1299 {"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
|
1300 {"DimGray" , PALETTERGB (105,105,105)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1301 {"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
|
1302 {"DimGrey" , PALETTERGB (105,105,105)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1303 {"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
|
1304 {"SlateGray" , PALETTERGB (112,128,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1305 {"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
|
1306 {"SlateGrey" , PALETTERGB (112,128,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1307 {"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
|
1308 {"LightSlateGray" , PALETTERGB (119,136,153)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1309 {"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
|
1310 {"LightSlateGrey" , PALETTERGB (119,136,153)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1311 {"gray" , PALETTERGB (190,190,190)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1312 {"grey" , PALETTERGB (190,190,190)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1313 {"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
|
1314 {"LightGrey" , PALETTERGB (211,211,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1315 {"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
|
1316 {"LightGray" , PALETTERGB (211,211,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1317 {"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
|
1318 {"MidnightBlue" , PALETTERGB ( 25, 25,112)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1319 {"navy" , PALETTERGB ( 0, 0,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1320 {"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
|
1321 {"NavyBlue" , PALETTERGB ( 0, 0,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1322 {"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
|
1323 {"CornflowerBlue" , PALETTERGB (100,149,237)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1324 {"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
|
1325 {"DarkSlateBlue" , PALETTERGB ( 72, 61,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1326 {"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
|
1327 {"SlateBlue" , PALETTERGB (106, 90,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1328 {"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
|
1329 {"MediumSlateBlue" , PALETTERGB (123,104,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1330 {"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
|
1331 {"LightSlateBlue" , PALETTERGB (132,112,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1332 {"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
|
1333 {"MediumBlue" , PALETTERGB ( 0, 0,205)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1334 {"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
|
1335 {"RoyalBlue" , PALETTERGB ( 65,105,225)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1336 {"blue" , PALETTERGB ( 0, 0,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1337 {"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
|
1338 {"DodgerBlue" , PALETTERGB ( 30,144,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1339 {"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
|
1340 {"DeepSkyBlue" , PALETTERGB ( 0,191,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1341 {"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
|
1342 {"SkyBlue" , PALETTERGB (135,206,235)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1343 {"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
|
1344 {"LightSkyBlue" , PALETTERGB (135,206,250)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1345 {"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
|
1346 {"SteelBlue" , PALETTERGB ( 70,130,180)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1347 {"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
|
1348 {"LightSteelBlue" , PALETTERGB (176,196,222)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1349 {"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
|
1350 {"LightBlue" , PALETTERGB (173,216,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1351 {"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
|
1352 {"PowderBlue" , PALETTERGB (176,224,230)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1353 {"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
|
1354 {"PaleTurquoise" , PALETTERGB (175,238,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1355 {"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
|
1356 {"DarkTurquoise" , PALETTERGB ( 0,206,209)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1357 {"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
|
1358 {"MediumTurquoise" , PALETTERGB ( 72,209,204)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1359 {"turquoise" , PALETTERGB ( 64,224,208)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1360 {"cyan" , PALETTERGB ( 0,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1361 {"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
|
1362 {"LightCyan" , PALETTERGB (224,255,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1363 {"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
|
1364 {"CadetBlue" , PALETTERGB ( 95,158,160)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1365 {"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
|
1366 {"MediumAquamarine" , PALETTERGB (102,205,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1367 {"aquamarine" , PALETTERGB (127,255,212)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1368 {"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
|
1369 {"DarkGreen" , PALETTERGB ( 0,100, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1370 {"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
|
1371 {"DarkOliveGreen" , PALETTERGB ( 85,107, 47)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1372 {"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
|
1373 {"DarkSeaGreen" , PALETTERGB (143,188,143)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1374 {"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
|
1375 {"SeaGreen" , PALETTERGB ( 46,139, 87)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1376 {"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
|
1377 {"MediumSeaGreen" , PALETTERGB ( 60,179,113)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1378 {"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
|
1379 {"LightSeaGreen" , PALETTERGB ( 32,178,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1380 {"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
|
1381 {"PaleGreen" , PALETTERGB (152,251,152)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1382 {"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
|
1383 {"SpringGreen" , PALETTERGB ( 0,255,127)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1384 {"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
|
1385 {"LawnGreen" , PALETTERGB (124,252, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1386 {"green" , PALETTERGB ( 0,255, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1387 {"chartreuse" , PALETTERGB (127,255, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1388 {"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
|
1389 {"MediumSpringGreen" , PALETTERGB ( 0,250,154)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1390 {"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
|
1391 {"GreenYellow" , PALETTERGB (173,255, 47)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1392 {"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
|
1393 {"LimeGreen" , PALETTERGB ( 50,205, 50)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1394 {"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
|
1395 {"YellowGreen" , PALETTERGB (154,205, 50)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1396 {"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
|
1397 {"ForestGreen" , PALETTERGB ( 34,139, 34)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1398 {"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
|
1399 {"OliveDrab" , PALETTERGB (107,142, 35)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1400 {"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
|
1401 {"DarkKhaki" , PALETTERGB (189,183,107)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1402 {"khaki" , PALETTERGB (240,230,140)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1403 {"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
|
1404 {"PaleGoldenrod" , PALETTERGB (238,232,170)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1405 {"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
|
1406 {"LightGoldenrodYellow" , PALETTERGB (250,250,210)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1407 {"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
|
1408 {"LightYellow" , PALETTERGB (255,255,224)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1409 {"yellow" , PALETTERGB (255,255, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1410 {"gold" , PALETTERGB (255,215, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1411 {"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
|
1412 {"LightGoldenrod" , PALETTERGB (238,221,130)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1413 {"goldenrod" , PALETTERGB (218,165, 32)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1414 {"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
|
1415 {"DarkGoldenrod" , PALETTERGB (184,134, 11)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1416 {"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
|
1417 {"RosyBrown" , PALETTERGB (188,143,143)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1418 {"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
|
1419 {"IndianRed" , PALETTERGB (205, 92, 92)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1420 {"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
|
1421 {"SaddleBrown" , PALETTERGB (139, 69, 19)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1422 {"sienna" , PALETTERGB (160, 82, 45)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1423 {"peru" , PALETTERGB (205,133, 63)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1424 {"burlywood" , PALETTERGB (222,184,135)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1425 {"beige" , PALETTERGB (245,245,220)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1426 {"wheat" , PALETTERGB (245,222,179)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1427 {"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
|
1428 {"SandyBrown" , PALETTERGB (244,164, 96)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1429 {"tan" , PALETTERGB (210,180,140)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1430 {"chocolate" , PALETTERGB (210,105, 30)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1431 {"firebrick" , PALETTERGB (178,34, 34)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1432 {"brown" , PALETTERGB (165,42, 42)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1433 {"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
|
1434 {"DarkSalmon" , PALETTERGB (233,150,122)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1435 {"salmon" , PALETTERGB (250,128,114)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1436 {"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
|
1437 {"LightSalmon" , PALETTERGB (255,160,122)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1438 {"orange" , PALETTERGB (255,165, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1439 {"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
|
1440 {"DarkOrange" , PALETTERGB (255,140, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1441 {"coral" , PALETTERGB (255,127, 80)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1442 {"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
|
1443 {"LightCoral" , PALETTERGB (240,128,128)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1444 {"tomato" , PALETTERGB (255, 99, 71)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1445 {"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
|
1446 {"OrangeRed" , PALETTERGB (255, 69, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1447 {"red" , PALETTERGB (255, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1448 {"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
|
1449 {"HotPink" , PALETTERGB (255,105,180)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1450 {"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
|
1451 {"DeepPink" , PALETTERGB (255, 20,147)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1452 {"pink" , PALETTERGB (255,192,203)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1453 {"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
|
1454 {"LightPink" , PALETTERGB (255,182,193)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1455 {"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
|
1456 {"PaleVioletRed" , PALETTERGB (219,112,147)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1457 {"maroon" , PALETTERGB (176, 48, 96)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1458 {"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
|
1459 {"MediumVioletRed" , PALETTERGB (199, 21,133)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1460 {"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
|
1461 {"VioletRed" , PALETTERGB (208, 32,144)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1462 {"magenta" , PALETTERGB (255, 0,255)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1463 {"violet" , PALETTERGB (238,130,238)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1464 {"plum" , PALETTERGB (221,160,221)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1465 {"orchid" , PALETTERGB (218,112,214)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1466 {"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
|
1467 {"MediumOrchid" , PALETTERGB (186, 85,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1468 {"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
|
1469 {"DarkOrchid" , PALETTERGB (153, 50,204)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1470 {"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
|
1471 {"DarkViolet" , PALETTERGB (148, 0,211)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1472 {"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
|
1473 {"BlueViolet" , PALETTERGB (138, 43,226)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1474 {"purple" , PALETTERGB (160, 32,240)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1475 {"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
|
1476 {"MediumPurple" , PALETTERGB (147,112,219)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1477 {"thistle" , PALETTERGB (216,191,216)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1478 {"gray0" , PALETTERGB ( 0, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1479 {"grey0" , PALETTERGB ( 0, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1480 {"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
|
1481 {"DarkGrey" , PALETTERGB (169,169,169)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1482 {"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
|
1483 {"DarkGray" , PALETTERGB (169,169,169)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1484 {"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
|
1485 {"DarkBlue" , PALETTERGB ( 0, 0,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1486 {"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
|
1487 {"DarkCyan" , PALETTERGB ( 0,139,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1488 {"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
|
1489 {"DarkMagenta" , PALETTERGB (139, 0,139)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1490 {"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
|
1491 {"DarkRed" , PALETTERGB (139, 0, 0)}, |
88b23d545848
(win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14810
diff
changeset
|
1492 {"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
|
1493 {"LightGreen" , PALETTERGB (144,238,144)}, |
13434 | 1494 }; |
1495 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1496 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
|
1497 0, 0, 0, doc: /* Return the default color map. */) |
13434 | 1498 () |
1499 { | |
1500 int i; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1501 colormap_t *pc = w32_color_map; |
13434 | 1502 Lisp_Object cmap; |
1503 | |
1504 BLOCK_INPUT; | |
1505 | |
1506 cmap = Qnil; | |
1507 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1508 for (i = 0; i < sizeof (w32_color_map) / sizeof (w32_color_map[0]); |
13434 | 1509 pc++, i++) |
1510 cmap = Fcons (Fcons (build_string (pc->name), | |
1511 make_number (pc->colorref)), | |
1512 cmap); | |
1513 | |
1514 UNBLOCK_INPUT; | |
1515 | |
1516 return (cmap); | |
1517 } | |
1518 | |
1519 Lisp_Object | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1520 w32_to_x_color (rgb) |
13434 | 1521 Lisp_Object rgb; |
1522 { | |
1523 Lisp_Object color; | |
1524 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
1525 CHECK_NUMBER (rgb); |
13434 | 1526 |
1527 BLOCK_INPUT; | |
1528 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1529 color = Frassq (rgb, Vw32_color_map); |
13434 | 1530 |
1531 UNBLOCK_INPUT; | |
1532 | |
1533 if (!NILP (color)) | |
1534 return (Fcar (color)); | |
1535 else | |
1536 return Qnil; | |
1537 } | |
1538 | |
23314
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1539 COLORREF |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1540 w32_color_map_lookup (colorname) |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1541 char *colorname; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1542 { |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1543 Lisp_Object tail, ret = Qnil; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1544 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1545 BLOCK_INPUT; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1546 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1547 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
|
1548 { |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1549 register Lisp_Object elt, tem; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1550 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1551 elt = Fcar (tail); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1552 if (!CONSP (elt)) continue; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1553 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1554 tem = Fcar (elt); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1555 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1556 if (lstrcmpi (XSTRING (tem)->data, colorname) == 0) |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1557 { |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1558 ret = XUINT (Fcdr (elt)); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1559 break; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1560 } |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1561 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1562 QUIT; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1563 } |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1564 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1565 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1566 UNBLOCK_INPUT; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1567 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1568 return ret; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1569 } |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1570 |
13434 | 1571 COLORREF |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1572 x_to_w32_color (colorname) |
13434 | 1573 char * colorname; |
1574 { | |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
1575 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
|
1576 |
13434 | 1577 BLOCK_INPUT; |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1578 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1579 if (colorname[0] == '#') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1580 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1581 /* 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
|
1582 char *color; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1583 int size; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1584 color = colorname + 1; |
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 size = strlen(color); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1587 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
|
1588 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1589 UINT colorval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1590 int i, pos; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1591 pos = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1592 size /= 3; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1593 colorval = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1594 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1595 for (i = 0; i < 3; i++) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1596 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1597 char *end; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1598 char t; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1599 unsigned long value; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1600 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1601 /* 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
|
1602 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
|
1603 our numbers, and we don't. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1604 if (!isxdigit(color[0]) || color[1] == 'x') |
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 t = color[size]; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1607 color[size] = '\0'; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1608 value = strtoul(color, &end, 16); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1609 color[size] = t; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1610 if (errno == ERANGE || end - color != size) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1611 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1612 switch (size) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1613 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1614 case 1: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1615 value = value * 0x10; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1616 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1617 case 2: |
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 case 3: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1620 value /= 0x10; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1621 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1622 case 4: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1623 value /= 0x100; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1624 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1625 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1626 colorval |= (value << pos); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1627 pos += 0x8; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1628 if (i == 2) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1629 { |
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 color = end; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1634 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1635 } |
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 else if (strnicmp(colorname, "rgb:", 4) == 0) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1638 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1639 char *color; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1640 UINT colorval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1641 int i, pos; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1642 pos = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1643 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1644 colorval = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1645 color = colorname + 4; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1646 for (i = 0; i < 3; i++) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1647 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1648 char *end; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1649 unsigned long value; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1650 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1651 /* 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
|
1652 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
|
1653 our numbers, and we don't. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1654 if (!isxdigit(color[0]) || color[1] == 'x') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1655 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1656 value = strtoul(color, &end, 16); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1657 if (errno == ERANGE) |
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 switch (end - color) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1660 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1661 case 1: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1662 value = value * 0x10 + value; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1663 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1664 case 2: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1665 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1666 case 3: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1667 value /= 0x10; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1668 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1669 case 4: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1670 value /= 0x100; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1671 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1672 default: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1673 value = ULONG_MAX; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1674 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1675 if (value == ULONG_MAX) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1676 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1677 colorval |= (value << pos); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1678 pos += 0x8; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1679 if (i == 2) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1680 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1681 if (*end != '\0') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1682 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1683 UNBLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1684 return (colorval); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1685 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1686 if (*end != '/') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1687 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1688 color = end + 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1689 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1690 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1691 else if (strnicmp(colorname, "rgbi:", 5) == 0) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1692 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1693 /* This is an RGB Intensity specification. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1694 char *color; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1695 UINT colorval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1696 int i, pos; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1697 pos = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1698 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1699 colorval = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1700 color = colorname + 5; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1701 for (i = 0; i < 3; i++) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1702 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1703 char *end; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1704 double value; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1705 UINT val; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1706 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1707 value = strtod(color, &end); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1708 if (errno == ERANGE) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1709 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1710 if (value < 0.0 || value > 1.0) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1711 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1712 val = (UINT)(0x100 * value); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1713 /* 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
|
1714 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
|
1715 fixes the 1.0 case. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1716 if (val == 0x100) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1717 val = 0xFF; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1718 colorval |= (val << pos); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1719 pos += 0x8; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1720 if (i == 2) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1721 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1722 if (*end != '\0') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1723 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1724 UNBLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1725 return (colorval); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1726 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1727 if (*end != '/') |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1728 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1729 color = end + 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1730 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1731 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
1732 /* 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
|
1733 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
|
1734 RGB. */ |
23314
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1735 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1736 /* 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
|
1737 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
|
1738 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
|
1739 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
|
1740 ret = w32_color_map_lookup (colorname); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1741 if (NILP (ret)) |
13434 | 1742 { |
23314
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1743 int len = strlen (colorname); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1744 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1745 if (isdigit (colorname[len - 1])) |
13434 | 1746 { |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
1747 char *ptr, *approx = alloca (len + 1); |
23314
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1748 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1749 strcpy (approx, colorname); |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1750 ptr = &approx[len - 1]; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1751 while (ptr > approx && isdigit (*ptr)) |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1752 *ptr-- = '\0'; |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1753 |
87acd2b6ce97
(w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23160
diff
changeset
|
1754 ret = w32_color_map_lookup (approx); |
13434 | 1755 } |
1756 } | |
1757 | |
1758 UNBLOCK_INPUT; | |
1759 return ret; | |
1760 } | |
1761 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1762 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1763 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1764 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
|
1765 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1766 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
|
1767 LOGPALETTE * log_palette; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1768 HPALETTE new_palette; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1769 int i; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1770 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1771 /* 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
|
1772 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
|
1773 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1774 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1775 log_palette = (LOGPALETTE *) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1776 alloca (sizeof (LOGPALETTE) + |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1777 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
|
1778 log_palette->palVersion = 0x300; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1779 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
|
1780 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1781 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
|
1782 for (i = 0; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1783 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
|
1784 i++, list = list->next) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1785 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
|
1786 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1787 new_palette = CreatePalette (log_palette); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1788 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1789 enter_crit (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1790 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1791 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
|
1792 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
|
1793 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
|
1794 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1795 /* 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
|
1796 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
|
1797 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1798 leave_crit (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1799 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1800 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1801 #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
|
1802 #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
|
1803 do \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1804 { \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1805 pe.peRed = GetRValue (color); \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1806 pe.peGreen = GetGValue (color); \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1807 pe.peBlue = GetBValue (color); \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1808 pe.peFlags = 0; \ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1809 } while (0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1810 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1811 #if 0 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1812 /* 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
|
1813 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1814 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
|
1815 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1816 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
|
1817 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1818 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
|
1819 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1820 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1821 /* 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
|
1822 while (list) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1823 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1824 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
|
1825 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1826 ++list->refcount; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1827 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1828 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1829 list = list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1830 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1831 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1832 /* 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
|
1833 list = (struct w32_palette_entry *) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1834 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
|
1835 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
|
1836 list->refcount = 1; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1837 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
|
1838 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
|
1839 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
|
1840 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1841 /* 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
|
1842 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
|
1843 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1844 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1845 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1846 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
|
1847 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1848 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
|
1849 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
|
1850 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1851 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
|
1852 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1853 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1854 /* 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
|
1855 while (list) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1856 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1857 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
|
1858 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1859 if (--list->refcount == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1860 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1861 *prev = list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1862 xfree (list); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1863 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
|
1864 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1865 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1866 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1867 return; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1868 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1869 prev = &list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1870 list = list->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1871 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1872 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1873 /* 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
|
1874 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
|
1875 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1876 #endif |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1877 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1878 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1879 /* Gamma-correct COLOR on frame F. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1880 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1881 void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1882 gamma_correct (f, color) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1883 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1884 COLORREF *color; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1885 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1886 if (f->gamma) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1887 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1888 *color = PALETTERGB ( |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1889 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
|
1890 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
|
1891 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
|
1892 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1893 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1894 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1895 |
13434 | 1896 /* Decide if color named COLOR is valid for the display associated with |
1897 the selected frame; if so, return the rgb values in COLOR_DEF. | |
1898 If ALLOC is nonzero, allocate a new colormap cell. */ | |
1899 | |
1900 int | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1901 w32_defined_color (f, color, color_def, alloc) |
13434 | 1902 FRAME_PTR f; |
1903 char *color; | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1904 XColor *color_def; |
13434 | 1905 int alloc; |
1906 { | |
1907 register Lisp_Object tem; | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1908 COLORREF w32_color_ref; |
14353 | 1909 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1910 tem = x_to_w32_color (color); |
14353 | 1911 |
13434 | 1912 if (!NILP (tem)) |
1913 { | |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1914 if (f) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1915 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1916 /* Apply gamma correction. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1917 w32_color_ref = XUINT (tem); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1918 gamma_correct (f, &w32_color_ref); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1919 XSETINT (tem, w32_color_ref); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1920 } |
27407
7df920562cbe
(w32_defined_color): Apply gamma correction before trying to map to
Jason Rumney <jasonr@gnu.org>
parents:
27397
diff
changeset
|
1921 |
7df920562cbe
(w32_defined_color): Apply gamma correction before trying to map to
Jason Rumney <jasonr@gnu.org>
parents:
27397
diff
changeset
|
1922 /* 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
|
1923 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
|
1924 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1925 struct w32_palette_entry * entry = |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1926 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
|
1927 struct w32_palette_entry ** prev = |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1928 &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
|
1929 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1930 /* 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
|
1931 while (entry) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1932 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1933 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
|
1934 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1935 prev = &entry->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1936 entry = entry->next; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1937 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1938 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1939 if (entry == NULL && alloc) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1940 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1941 /* 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
|
1942 entry = (struct w32_palette_entry *) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1943 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
|
1944 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
|
1945 entry->next = NULL; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1946 *prev = entry; |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
1947 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
|
1948 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1949 /* 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
|
1950 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
|
1951 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1952 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1953 /* 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
|
1954 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
|
1955 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
|
1956 w32_color_ref = XUINT (tem) | 0x2000000; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1957 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1958 color_def->pixel = w32_color_ref; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1959 color_def->red = GetRValue (w32_color_ref); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1960 color_def->green = GetGValue (w32_color_ref); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1961 color_def->blue = GetBValue (w32_color_ref); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1962 |
13434 | 1963 return 1; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
1964 } |
13434 | 1965 else |
14353 | 1966 { |
1967 return 0; | |
1968 } | |
13434 | 1969 } |
1970 | |
1971 /* Given a string ARG naming a color, compute a pixel value from it | |
1972 suitable for screen F. | |
1973 If F is not a color screen, return DEF (default) regardless of what | |
1974 ARG says. */ | |
1975 | |
1976 int | |
1977 x_decode_color (f, arg, def) | |
1978 FRAME_PTR f; | |
1979 Lisp_Object arg; | |
1980 int def; | |
1981 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1982 XColor cdef; |
13434 | 1983 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
1984 CHECK_STRING (arg); |
13434 | 1985 |
1986 if (strcmp (XSTRING (arg)->data, "black") == 0) | |
1987 return BLACK_PIX_DEFAULT (f); | |
1988 else if (strcmp (XSTRING (arg)->data, "white") == 0) | |
1989 return WHITE_PIX_DEFAULT (f); | |
1990 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
1991 if ((FRAME_W32_DISPLAY_INFO (f)->n_planes * FRAME_W32_DISPLAY_INFO (f)->n_cbits) == 1) |
13434 | 1992 return def; |
1993 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1994 /* w32_defined_color is responsible for coping with failures |
13434 | 1995 by looking for a near-miss. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
1996 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
|
1997 return cdef.pixel; |
13434 | 1998 |
1999 /* defined_color failed; return an ultimate default. */ | |
2000 return def; | |
2001 } | |
2002 | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2003 /* 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
|
2004 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
|
2005 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2006 static void |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2007 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
|
2008 struct frame *f; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2009 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
|
2010 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2011 if (NILP (new_value)) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2012 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
|
2013 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
|
2014 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
|
2015 else |
30601
7c995a54a0e8
Replace `illegal' with `invalid'.
Gerd Moellmann <gerd@gnu.org>
parents:
30239
diff
changeset
|
2016 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
|
2017 Fcons (new_value, Qnil))); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2018 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
|
2019 redraw_frame (f); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2020 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2021 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2022 |
43398 | 2023 /* Change the `fullscreen' frame parameter of frame F. OLD_VALUE is |
2024 the previous value of that parameter, NEW_VALUE is the new value. */ | |
2025 | |
2026 static void | |
2027 x_set_fullscreen (f, new_value, old_value) | |
2028 struct frame *f; | |
2029 Lisp_Object new_value, old_value; | |
2030 { | |
2031 if (NILP (new_value)) | |
2032 f->output_data.w32->want_fullscreen = FULLSCREEN_NONE; | |
2033 else if (EQ (new_value, Qfullboth)) | |
2034 f->output_data.w32->want_fullscreen = FULLSCREEN_BOTH; | |
2035 else if (EQ (new_value, Qfullwidth)) | |
2036 f->output_data.w32->want_fullscreen = FULLSCREEN_WIDTH; | |
2037 else if (EQ (new_value, Qfullheight)) | |
2038 f->output_data.w32->want_fullscreen = FULLSCREEN_HEIGHT; | |
2039 } | |
2040 | |
2041 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2042 /* 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
|
2043 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
|
2044 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2045 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2046 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
|
2047 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2048 Lisp_Object new_value, old_value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2049 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2050 if (NILP (new_value)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2051 f->gamma = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2052 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
|
2053 /* 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
|
2054 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
|
2055 else |
30601
7c995a54a0e8
Replace `illegal' with `invalid'.
Gerd Moellmann <gerd@gnu.org>
parents:
30239
diff
changeset
|
2056 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
|
2057 Fcons (new_value, Qnil))); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2058 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2059 clear_face_cache (0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2060 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2061 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2062 |
13434 | 2063 /* Functions called only from `x_set_frame_param' |
2064 to set individual parameters. | |
2065 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2066 If FRAME_W32_WINDOW (f) is 0, |
13434 | 2067 the frame is being created and its window does not exist yet. |
2068 In that case, just record the parameter's new value | |
2069 in the standard place; do not attempt to change the window. */ | |
2070 | |
2071 void | |
2072 x_set_foreground_color (f, arg, oldval) | |
2073 struct frame *f; | |
2074 Lisp_Object arg, oldval; | |
2075 { | |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2076 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
|
2077 PIX_TYPE fg, old_fg; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2078 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2079 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
|
2080 old_fg = FRAME_FOREGROUND_PIXEL (f); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2081 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
|
2082 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2083 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 2084 { |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2085 if (x->cursor_pixel == old_fg) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2086 x->cursor_pixel = fg; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2087 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2088 update_face_from_frame_parameter (f, Qforeground_color, arg); |
13434 | 2089 if (FRAME_VISIBLE_P (f)) |
2090 redraw_frame (f); | |
2091 } | |
2092 } | |
2093 | |
2094 void | |
2095 x_set_background_color (f, arg, oldval) | |
2096 struct frame *f; | |
2097 Lisp_Object arg, oldval; | |
2098 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2099 FRAME_BACKGROUND_PIXEL (f) |
13434 | 2100 = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); |
2101 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2102 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 2103 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2104 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
|
2105 FRAME_BACKGROUND_PIXEL (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2106 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2107 update_face_from_frame_parameter (f, Qbackground_color, arg); |
13434 | 2108 |
2109 if (FRAME_VISIBLE_P (f)) | |
2110 redraw_frame (f); | |
2111 } | |
2112 } | |
2113 | |
2114 void | |
2115 x_set_mouse_color (f, arg, oldval) | |
2116 struct frame *f; | |
2117 Lisp_Object arg, oldval; | |
2118 { | |
2119 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
|
2120 int count; |
13434 | 2121 int mask_color; |
2122 | |
2123 if (!EQ (Qnil, arg)) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2124 f->output_data.w32->mouse_pixel |
13434 | 2125 = 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
|
2126 mask_color = FRAME_BACKGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2127 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2128 /* 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
|
2129 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
|
2130 && mask_color == FRAME_BACKGROUND_PIXEL (f)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2131 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
|
2132 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
2133 #if 0 /* TODO : cursor changes */ |
13434 | 2134 BLOCK_INPUT; |
2135 | |
2136 /* 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
|
2137 count = x_catch_errors (FRAME_W32_DISPLAY (f)); |
13434 | 2138 |
2139 if (!EQ (Qnil, Vx_pointer_shape)) | |
2140 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2141 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
|
2142 cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XINT (Vx_pointer_shape)); |
13434 | 2143 } |
2144 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2145 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
|
2146 x_check_errors (FRAME_W32_DISPLAY (f), "bad text pointer cursor: %s"); |
13434 | 2147 |
2148 if (!EQ (Qnil, Vx_nontext_pointer_shape)) | |
2149 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2150 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
|
2151 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), |
13434 | 2152 XINT (Vx_nontext_pointer_shape)); |
2153 } | |
2154 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2155 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
|
2156 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s"); |
13434 | 2157 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2158 if (!EQ (Qnil, Vx_hourglass_pointer_shape)) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2159 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2160 CHECK_NUMBER (Vx_hourglass_pointer_shape); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2161 hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2162 XINT (Vx_hourglass_pointer_shape)); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2163 } |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2164 else |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2165 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
|
2166 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
|
2167 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2168 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s"); |
13434 | 2169 if (!EQ (Qnil, Vx_mode_pointer_shape)) |
2170 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2171 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
|
2172 mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), |
13434 | 2173 XINT (Vx_mode_pointer_shape)); |
2174 } | |
2175 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2176 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
|
2177 x_check_errors (FRAME_W32_DISPLAY (f), "bad modeline pointer cursor: %s"); |
13434 | 2178 |
2179 if (!EQ (Qnil, Vx_sensitive_text_pointer_shape)) | |
2180 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2181 CHECK_NUMBER (Vx_sensitive_text_pointer_shape); |
13434 | 2182 cross_cursor |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2183 = XCreateFontCursor (FRAME_W32_DISPLAY (f), |
13434 | 2184 XINT (Vx_sensitive_text_pointer_shape)); |
2185 } | |
2186 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2187 cross_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_crosshair); |
13434 | 2188 |
34133
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
2189 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
|
2190 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2191 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
|
2192 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
|
2193 = 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
|
2194 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
|
2195 } |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
2196 else |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
2197 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
|
2198 = 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
|
2199 |
13434 | 2200 /* 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
|
2201 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
|
2202 x_uncatch_errors (FRAME_W32_DISPLAY (f), count); |
13434 | 2203 |
2204 { | |
2205 XColor fore_color, back_color; | |
2206 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2207 fore_color.pixel = f->output_data.w32->mouse_pixel; |
13434 | 2208 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
|
2209 XQueryColor (FRAME_W32_DISPLAY (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2210 DefaultColormap (FRAME_W32_DISPLAY (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2211 DefaultScreen (FRAME_W32_DISPLAY (f))), |
13434 | 2212 &fore_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2213 XQueryColor (FRAME_W32_DISPLAY (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2214 DefaultColormap (FRAME_W32_DISPLAY (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2215 DefaultScreen (FRAME_W32_DISPLAY (f))), |
13434 | 2216 &back_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2217 XRecolorCursor (FRAME_W32_DISPLAY (f), cursor, |
13434 | 2218 &fore_color, &back_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2219 XRecolorCursor (FRAME_W32_DISPLAY (f), nontext_cursor, |
13434 | 2220 &fore_color, &back_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2221 XRecolorCursor (FRAME_W32_DISPLAY (f), mode_cursor, |
13434 | 2222 &fore_color, &back_color); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2223 XRecolorCursor (FRAME_W32_DISPLAY (f), cross_cursor, |
13434 | 2224 &fore_color, &back_color); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2225 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
|
2226 &fore_color, &back_color); |
13434 | 2227 } |
2228 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2229 if (FRAME_W32_WINDOW (f) != 0) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2230 XDefineCursor (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), cursor); |
13434 | 2231 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2232 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
|
2233 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
|
2234 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
|
2235 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2236 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
|
2237 && 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
|
2238 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
|
2239 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
|
2240 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2241 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
|
2242 && f->output_data.w32->hourglass_cursor != 0) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
2243 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
|
2244 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
|
2245 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2246 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
|
2247 && 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
|
2248 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
|
2249 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
|
2250 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2251 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
|
2252 && 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
|
2253 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
|
2254 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
|
2255 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2256 XFlush (FRAME_W32_DISPLAY (f)); |
13434 | 2257 UNBLOCK_INPUT; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2258 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2259 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
|
2260 #endif /* TODO */ |
13434 | 2261 } |
2262 | |
34062
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2263 /* 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
|
2264 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
|
2265 |
13434 | 2266 void |
2267 x_set_cursor_color (f, arg, oldval) | |
2268 struct frame *f; | |
2269 Lisp_Object arg, oldval; | |
2270 { | |
34062
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2271 unsigned long fore_pixel, pixel; |
13434 | 2272 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2273 if (!NILP (Vx_cursor_fore_pixel)) |
13434 | 2274 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
|
2275 WHITE_PIX_DEFAULT (f)); |
13434 | 2276 else |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2277 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
|
2278 |
34089 | 2279 pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
13434 | 2280 |
2281 /* 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
|
2282 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
|
2283 { |
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2284 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
|
2285 if (pixel == fore_pixel) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2286 fore_pixel = FRAME_BACKGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2287 } |
34062
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2288 |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
2289 f->output_data.w32->cursor_foreground_pixel = 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
|
2290 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
|
2291 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2292 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 2293 { |
44094
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
2294 BLOCK_INPUT; |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
2295 /* Update frame's cursor_gc. */ |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
2296 f->output_data.w32->cursor_gc->foreground = fore_pixel; |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
2297 f->output_data.w32->cursor_gc->background = pixel; |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
2298 |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
2299 UNBLOCK_INPUT; |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
2300 |
13434 | 2301 if (FRAME_VISIBLE_P (f)) |
2302 { | |
34062
0044985507c7
(x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents:
33929
diff
changeset
|
2303 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
|
2304 x_update_cursor (f, 1); |
13434 | 2305 } |
2306 } | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2307 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2308 update_face_from_frame_parameter (f, Qcursor_color, arg); |
13434 | 2309 } |
2310 | |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2311 /* 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
|
2312 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
|
2313 F has an window. */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2314 void |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2315 x_set_border_pixel (f, pix) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2316 struct frame *f; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2317 int pix; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2318 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2319 f->output_data.w32->border_pixel = pix; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2320 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2321 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
|
2322 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2323 if (FRAME_VISIBLE_P (f)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2324 redraw_frame (f); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2325 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2326 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
2327 |
13434 | 2328 /* Set the border-color of frame F to value described by ARG. |
2329 ARG can be a string naming a color. | |
2330 The border-color is used for the border that is drawn by the server. | |
2331 Note that this does not fully take effect if done before | |
2332 F has a window; it must be redone when the window is created. */ | |
2333 | |
2334 void | |
2335 x_set_border_color (f, arg, oldval) | |
2336 struct frame *f; | |
2337 Lisp_Object arg, oldval; | |
2338 { | |
2339 int pix; | |
2340 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2341 CHECK_STRING (arg); |
13434 | 2342 pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
2343 x_set_border_pixel (f, pix); | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2344 update_face_from_frame_parameter (f, Qborder_color, arg); |
13434 | 2345 } |
2346 | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2347 /* 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
|
2348 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
|
2349 of the bar cursor. */ |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2350 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2351 enum text_cursor_kinds |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2352 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
|
2353 Lisp_Object arg; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2354 int *width; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2355 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2356 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
|
2357 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2358 if (EQ (arg, Qbar)) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2359 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2360 type = BAR_CURSOR; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2361 *width = 2; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2362 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2363 else if (CONSP (arg) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2364 && EQ (XCAR (arg), Qbar) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2365 && INTEGERP (XCDR (arg)) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2366 && XINT (XCDR (arg)) >= 0) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2367 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2368 type = BAR_CURSOR; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2369 *width = XINT (XCDR (arg)); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2370 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2371 else if (NILP (arg)) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2372 type = NO_CURSOR; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2373 else |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2374 /* 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
|
2375 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
|
2376 .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
|
2377 type = FILLED_BOX_CURSOR; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2378 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2379 return type; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2380 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2381 |
13434 | 2382 void |
2383 x_set_cursor_type (f, arg, oldval) | |
2384 FRAME_PTR f; | |
2385 Lisp_Object arg, oldval; | |
2386 { | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2387 int width; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2388 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2389 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
|
2390 f->output_data.w32->cursor_width = width; |
13434 | 2391 |
2392 /* Make sure the cursor gets redrawn. This is overkill, but how | |
2393 often do people change cursor types? */ | |
2394 update_mode_lines++; | |
2395 } | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2396 |
13434 | 2397 void |
2398 x_set_icon_type (f, arg, oldval) | |
2399 struct frame *f; | |
2400 Lisp_Object arg, oldval; | |
2401 { | |
2402 int result; | |
2403 | |
25235
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2404 if (NILP (arg) && NILP (oldval)) |
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2405 return; |
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2406 |
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2407 if (STRINGP (arg) && STRINGP (oldval) |
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2408 && 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
|
2409 return; |
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2410 |
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2411 if (SYMBOLP (arg) && SYMBOLP (oldval) && EQ (arg, oldval)) |
13434 | 2412 return; |
2413 | |
2414 BLOCK_INPUT; | |
25235
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2415 |
98c67187cd6b
(x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents:
25084
diff
changeset
|
2416 result = x_bitmap_icon (f, arg); |
13434 | 2417 if (result) |
2418 { | |
2419 UNBLOCK_INPUT; | |
2420 error ("No icon window available"); | |
2421 } | |
2422 | |
2423 UNBLOCK_INPUT; | |
2424 } | |
2425 | |
2426 /* Return non-nil if frame F wants a bitmap icon. */ | |
2427 | |
2428 Lisp_Object | |
2429 x_icon_type (f) | |
2430 FRAME_PTR f; | |
2431 { | |
2432 Lisp_Object tem; | |
2433 | |
2434 tem = assq_no_quit (Qicon_type, f->param_alist); | |
2435 if (CONSP (tem)) | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
2436 return XCDR (tem); |
13434 | 2437 else |
2438 return Qnil; | |
2439 } | |
2440 | |
2441 void | |
2442 x_set_icon_name (f, arg, oldval) | |
2443 struct frame *f; | |
2444 Lisp_Object arg, oldval; | |
2445 { | |
2446 if (STRINGP (arg)) | |
2447 { | |
2448 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) | |
2449 return; | |
2450 } | |
2451 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) | |
2452 return; | |
2453 | |
2454 f->icon_name = arg; | |
2455 | |
2456 #if 0 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2457 if (f->output_data.w32->icon_bitmap != 0) |
13434 | 2458 return; |
2459 | |
2460 BLOCK_INPUT; | |
2461 | |
2462 result = x_text_icon (f, | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2463 (char *) XSTRING ((!NILP (f->icon_name) |
13434 | 2464 ? f->icon_name |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2465 : !NILP (f->title) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2466 ? f->title |
13434 | 2467 : f->name))->data); |
2468 | |
2469 if (result) | |
2470 { | |
2471 UNBLOCK_INPUT; | |
2472 error ("No icon window available"); | |
2473 } | |
2474 | |
2475 /* If the window was unmapped (and its icon was mapped), | |
2476 the new icon is not mapped, so map the window in its stead. */ | |
2477 if (FRAME_VISIBLE_P (f)) | |
2478 { | |
2479 #ifdef USE_X_TOOLKIT | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2480 XtPopup (f->output_data.w32->widget, XtGrabNone); |
13434 | 2481 #endif |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2482 XMapWindow (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f)); |
13434 | 2483 } |
2484 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2485 XFlush (FRAME_W32_DISPLAY (f)); |
13434 | 2486 UNBLOCK_INPUT; |
2487 #endif | |
2488 } | |
2489 | |
2490 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
|
2491 extern Lisp_Object x_new_fontset(); |
13434 | 2492 |
2493 void | |
2494 x_set_font (f, arg, oldval) | |
2495 struct frame *f; | |
2496 Lisp_Object arg, oldval; | |
2497 { | |
2498 Lisp_Object result; | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2499 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
|
2500 Lisp_Object frame; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2501 int old_fontset = FRAME_FONTSET(f); |
13434 | 2502 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2503 CHECK_STRING (arg); |
13434 | 2504 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2505 fontset_name = Fquery_fontset (arg, Qnil); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2506 |
13434 | 2507 BLOCK_INPUT; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2508 result = (STRINGP (fontset_name) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
2509 ? 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
|
2510 : x_new_font (f, XSTRING (arg)->data)); |
13434 | 2511 UNBLOCK_INPUT; |
2512 | |
2513 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
|
2514 error ("Font `%s' is not defined", XSTRING (arg)->data); |
13434 | 2515 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
|
2516 error ("The characters of the given font have varying widths"); |
13434 | 2517 else if (STRINGP (result)) |
2518 { | |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2519 if (STRINGP (fontset_name)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2520 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2521 /* 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
|
2522 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
|
2523 if (old_fontset == FRAME_FONTSET (f)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2524 return; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2525 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2526 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
|
2527 return; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2528 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2529 store_frame_param (f, Qfont, result); |
13434 | 2530 recompute_basic_faces (f); |
2531 } | |
2532 else | |
2533 abort (); | |
22625
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
2534 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2535 do_pending_window_change (0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2536 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2537 /* 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
|
2538 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
|
2539 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
|
2540 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
|
2541 null widget which gives a segfault. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2542 if (FRAME_FACE_CACHE (f)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2543 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2544 XSETFRAME (frame, f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2545 call1 (Qface_set_after_frame_default, frame); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2546 } |
13434 | 2547 } |
2548 | |
41726
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
2549 static void |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
2550 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
|
2551 struct frame *f; |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
2552 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
|
2553 { |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
2554 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
|
2555 } |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
2556 |
13434 | 2557 void |
2558 x_set_border_width (f, arg, oldval) | |
2559 struct frame *f; | |
2560 Lisp_Object arg, oldval; | |
2561 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2562 CHECK_NUMBER (arg); |
13434 | 2563 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2564 if (XINT (arg) == f->output_data.w32->border_width) |
13434 | 2565 return; |
2566 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2567 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 2568 error ("Cannot change the border width of a window"); |
2569 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2570 f->output_data.w32->border_width = XINT (arg); |
13434 | 2571 } |
2572 | |
2573 void | |
2574 x_set_internal_border_width (f, arg, oldval) | |
2575 struct frame *f; | |
2576 Lisp_Object arg, oldval; | |
2577 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2578 int old = f->output_data.w32->internal_border_width; |
13434 | 2579 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2580 CHECK_NUMBER (arg); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2581 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
|
2582 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
|
2583 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
|
2584 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2585 if (f->output_data.w32->internal_border_width == old) |
13434 | 2586 return; |
2587 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2588 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 2589 { |
2590 x_set_window_size (f, 0, f->width, f->height); | |
2591 SET_FRAME_GARBAGED (f); | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2592 do_pending_window_change (0); |
13434 | 2593 } |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
2594 else |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
2595 SET_FRAME_GARBAGED (f); |
13434 | 2596 } |
2597 | |
2598 void | |
2599 x_set_visibility (f, value, oldval) | |
2600 struct frame *f; | |
2601 Lisp_Object value, oldval; | |
2602 { | |
2603 Lisp_Object frame; | |
2604 XSETFRAME (frame, f); | |
2605 | |
2606 if (NILP (value)) | |
2607 Fmake_frame_invisible (frame, Qt); | |
2608 else if (EQ (value, Qicon)) | |
2609 Ficonify_frame (frame); | |
2610 else | |
2611 Fmake_frame_visible (frame); | |
2612 } | |
2613 | |
33870
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2614 |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2615 /* 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
|
2616 |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2617 static void |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2618 x_change_window_heights (window, n) |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2619 Lisp_Object window; |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2620 int n; |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2621 { |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2622 struct window *w = XWINDOW (window); |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2623 |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2624 XSETFASTINT (w->top, XFASTINT (w->top) + n); |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2625 XSETFASTINT (w->height, XFASTINT (w->height) - n); |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2626 |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2627 if (INTEGERP (w->orig_top)) |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2628 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
|
2629 if (INTEGERP (w->orig_height)) |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2630 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
|
2631 |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2632 /* 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
|
2633 if (!NILP (w->vchild)) |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2634 x_change_window_heights (w->vchild, n); |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2635 |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2636 /* Adjust all children in a horizontal split. */ |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2637 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
|
2638 { |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2639 w = XWINDOW (window); |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2640 x_change_window_heights (window, n); |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2641 } |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2642 } |
8816b5542315
(x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33865
diff
changeset
|
2643 |
13434 | 2644 void |
2645 x_set_menu_bar_lines (f, value, oldval) | |
2646 struct frame *f; | |
2647 Lisp_Object value, oldval; | |
2648 { | |
2649 int nlines; | |
2650 int olines = FRAME_MENU_BAR_LINES (f); | |
2651 | |
2652 /* Right now, menu bars don't work properly in minibuf-only frames; | |
2653 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
|
2654 frame itself, and get an error because you can't switch buffers |
13434 | 2655 in or split the minibuffer window. */ |
2656 if (FRAME_MINIBUF_ONLY_P (f)) | |
2657 return; | |
2658 | |
2659 if (INTEGERP (value)) | |
2660 nlines = XINT (value); | |
2661 else | |
2662 nlines = 0; | |
2663 | |
2664 FRAME_MENU_BAR_LINES (f) = 0; | |
2665 if (nlines) | |
2666 FRAME_EXTERNAL_MENU_BAR (f) = 1; | |
2667 else | |
2668 { | |
2669 if (FRAME_EXTERNAL_MENU_BAR (f) == 1) | |
2670 free_frame_menubar (f); | |
2671 FRAME_EXTERNAL_MENU_BAR (f) = 0; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2672 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2673 /* 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
|
2674 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
|
2675 set correctly. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2676 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
|
2677 do_pending_window_change (0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2678 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2679 adjust_glyphs (f); |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2682 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2683 /* 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
|
2684 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
|
2685 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
|
2686 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
|
2687 The frame's height doesn't change. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2688 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2689 void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2690 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
|
2691 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2692 Lisp_Object value, oldval; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2693 { |
33865
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2694 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
|
2695 Lisp_Object root_window; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2696 |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
2697 /* Treat tool bars like menu bars. */ |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
2698 if (FRAME_MINIBUF_ONLY_P (f)) |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
2699 return; |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
2700 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2701 /* Use VALUE only if an integer >= 0. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2702 if (INTEGERP (value) && XINT (value) >= 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2703 nlines = XFASTINT (value); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2704 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2705 nlines = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2706 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2707 /* 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
|
2708 ++windows_or_buffers_changed; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2709 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2710 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
|
2711 |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2712 /* 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
|
2713 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
|
2714 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
|
2715 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
|
2716 { |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2717 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
|
2718 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
|
2719 } |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2720 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2721 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
|
2722 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
|
2723 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
|
2724 |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2725 /* 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
|
2726 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
|
2727 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
|
2728 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
|
2729 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
|
2730 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
|
2731 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
|
2732 { |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2733 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
|
2734 clear_frame (); |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2735 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
|
2736 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
|
2737 } |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2738 |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2739 /* 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
|
2740 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
|
2741 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
|
2742 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
|
2743 { |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2744 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
|
2745 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
|
2746 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
|
2747 |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2748 BLOCK_INPUT; |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2749 { |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2750 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
|
2751 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
|
2752 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
|
2753 } |
f32333d8172b
(x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents:
33443
diff
changeset
|
2754 UNBLOCK_INPUT; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2755 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2756 if (WINDOWP (f->tool_bar_window)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
2757 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
|
2758 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2759 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2760 |
13434 | 2761 |
2762 /* 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
|
2763 w32_id_name. |
13434 | 2764 |
2765 If EXPLICIT is non-zero, that indicates that lisp code is setting the | |
2766 name; if NAME is a string, set F's name to NAME and set | |
2767 F->explicit_name; if NAME is Qnil, then clear F->explicit_name. | |
2768 | |
2769 If EXPLICIT is zero, that indicates that Emacs redisplay code is | |
2770 suggesting a new name, which lisp code should override; if | |
2771 F->explicit_name is set, ignore the new name; otherwise, set it. */ | |
2772 | |
2773 void | |
2774 x_set_name (f, name, explicit) | |
2775 struct frame *f; | |
2776 Lisp_Object name; | |
2777 int explicit; | |
2778 { | |
2779 /* Make sure that requests from lisp code override requests from | |
2780 Emacs redisplay code. */ | |
2781 if (explicit) | |
2782 { | |
2783 /* If we're switching from explicit to implicit, we had better | |
2784 update the mode lines and thereby update the title. */ | |
2785 if (f->explicit_name && NILP (name)) | |
2786 update_mode_lines = 1; | |
2787 | |
2788 f->explicit_name = ! NILP (name); | |
2789 } | |
2790 else if (f->explicit_name) | |
2791 return; | |
2792 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2793 /* If NAME is nil, set the name to the w32_id_name. */ |
13434 | 2794 if (NILP (name)) |
2795 { | |
2796 /* Check for no change needed in this very common case | |
2797 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
|
2798 if (!strcmp (FRAME_W32_DISPLAY_INFO (f)->w32_id_name, |
13434 | 2799 XSTRING (f->name)->data)) |
2800 return; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2801 name = build_string (FRAME_W32_DISPLAY_INFO (f)->w32_id_name); |
13434 | 2802 } |
2803 else | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
2804 CHECK_STRING (name); |
13434 | 2805 |
2806 /* Don't change the name if it's already NAME. */ | |
2807 if (! NILP (Fstring_equal (name, f->name))) | |
2808 return; | |
2809 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2810 f->name = name; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2811 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2812 /* 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
|
2813 the name parameter. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2814 if (! NILP (f->title)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2815 name = f->title; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2816 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2817 if (FRAME_W32_WINDOW (f)) |
13434 | 2818 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2819 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
|
2820 name = ENCODE_SYSTEM (name); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2821 |
13434 | 2822 BLOCK_INPUT; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2823 SetWindowText(FRAME_W32_WINDOW (f), XSTRING (name)->data); |
13434 | 2824 UNBLOCK_INPUT; |
2825 } | |
2826 } | |
2827 | |
2828 /* This function should be called when the user's lisp code has | |
2829 specified a name for the frame; the name will override any set by the | |
2830 redisplay code. */ | |
2831 void | |
2832 x_explicitly_set_name (f, arg, oldval) | |
2833 FRAME_PTR f; | |
2834 Lisp_Object arg, oldval; | |
2835 { | |
2836 x_set_name (f, arg, 1); | |
2837 } | |
2838 | |
2839 /* This function should be called by Emacs redisplay code to set the | |
2840 name; names set this way will never override names set by the user's | |
2841 lisp code. */ | |
2842 void | |
2843 x_implicitly_set_name (f, arg, oldval) | |
2844 FRAME_PTR f; | |
2845 Lisp_Object arg, oldval; | |
2846 { | |
2847 x_set_name (f, arg, 0); | |
2848 } | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2849 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2850 /* 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
|
2851 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
|
2852 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2853 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
|
2854 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
|
2855 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
|
2856 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2857 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
|
2858 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
|
2859 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
|
2860 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2861 void |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2862 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
|
2863 struct frame *f; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2864 Lisp_Object name, old_name; |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2865 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2866 /* 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
|
2867 if (EQ (name, f->title)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2868 return; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2869 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2870 update_mode_lines = 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2871 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2872 f->title = name; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2873 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2874 if (NILP (name)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2875 name = f->name; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2876 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2877 if (FRAME_W32_WINDOW (f)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2878 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2879 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
|
2880 name = ENCODE_SYSTEM (name); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2881 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2882 BLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2883 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
|
2884 UNBLOCK_INPUT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2885 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2886 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
2887 |
13434 | 2888 void |
2889 x_set_autoraise (f, arg, oldval) | |
2890 struct frame *f; | |
2891 Lisp_Object arg, oldval; | |
2892 { | |
2893 f->auto_raise = !EQ (Qnil, arg); | |
2894 } | |
2895 | |
2896 void | |
2897 x_set_autolower (f, arg, oldval) | |
2898 struct frame *f; | |
2899 Lisp_Object arg, oldval; | |
2900 { | |
2901 f->auto_lower = !EQ (Qnil, arg); | |
2902 } | |
2903 | |
2904 void | |
2905 x_set_unsplittable (f, arg, oldval) | |
2906 struct frame *f; | |
2907 Lisp_Object arg, oldval; | |
2908 { | |
2909 f->no_split = !NILP (arg); | |
2910 } | |
2911 | |
2912 void | |
2913 x_set_vertical_scroll_bars (f, arg, oldval) | |
2914 struct frame *f; | |
2915 Lisp_Object arg, oldval; | |
2916 { | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2917 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
|
2918 || (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
|
2919 || (NILP (arg) && FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2920 || (!NILP (arg) && ! FRAME_HAS_VERTICAL_SCROLL_BARS (f))) |
13434 | 2921 { |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2922 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = NILP (arg) ? |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
2923 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
|
2924 /* 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
|
2925 on MS-Windows. */ |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
2926 EQ (Qleft, arg) |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
2927 ? 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
|
2928 : vertical_scroll_bar_right; |
13434 | 2929 |
2930 /* We set this parameter before creating the window for the | |
2931 frame, so we can get the geometry right from the start. | |
2932 However, if the window hasn't been created yet, we shouldn't | |
2933 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
|
2934 if (FRAME_W32_WINDOW (f)) |
13434 | 2935 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
|
2936 do_pending_window_change (0); |
13434 | 2937 } |
2938 } | |
2939 | |
2940 void | |
2941 x_set_scroll_bar_width (f, arg, oldval) | |
2942 struct frame *f; | |
2943 Lisp_Object arg, oldval; | |
2944 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2945 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
|
2946 |
13434 | 2947 if (NILP (arg)) |
2948 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2949 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
|
2950 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
|
2951 wid - 1) / wid; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2952 if (FRAME_W32_WINDOW (f)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2953 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
|
2954 do_pending_window_change (0); |
13434 | 2955 } |
2956 else if (INTEGERP (arg) && XINT (arg) > 0 | |
2957 && XFASTINT (arg) != FRAME_SCROLL_BAR_PIXEL_WIDTH (f)) | |
2958 { | |
2959 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
|
2960 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
|
2961 + wid-1) / wid; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
2962 if (FRAME_W32_WINDOW (f)) |
13434 | 2963 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
|
2964 do_pending_window_change (0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2965 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2966 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
|
2967 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
|
2968 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0; |
13434 | 2969 } |
2970 | |
2971 /* Subroutines of creating an frame. */ | |
2972 | |
2973 /* Make sure that Vx_resource_name is set to a reasonable value. | |
2974 Fix it up, or set it to `emacs' if it is too hopeless. */ | |
2975 | |
2976 static void | |
2977 validate_x_resource_name () | |
2978 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
2979 int len = 0; |
13434 | 2980 /* Number of valid characters in the resource name. */ |
2981 int good_count = 0; | |
2982 /* Number of invalid characters in the resource name. */ | |
2983 int bad_count = 0; | |
2984 Lisp_Object new; | |
2985 int i; | |
2986 | |
2987 if (STRINGP (Vx_resource_name)) | |
2988 { | |
2989 unsigned char *p = XSTRING (Vx_resource_name)->data; | |
2990 int i; | |
2991 | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
2992 len = STRING_BYTES (XSTRING (Vx_resource_name)); |
13434 | 2993 |
2994 /* Only letters, digits, - and _ are valid in resource names. | |
2995 Count the valid characters and count the invalid ones. */ | |
2996 for (i = 0; i < len; i++) | |
2997 { | |
2998 int c = p[i]; | |
2999 if (! ((c >= 'a' && c <= 'z') | |
3000 || (c >= 'A' && c <= 'Z') | |
3001 || (c >= '0' && c <= '9') | |
3002 || c == '-' || c == '_')) | |
3003 bad_count++; | |
3004 else | |
3005 good_count++; | |
3006 } | |
3007 } | |
3008 else | |
3009 /* Not a string => completely invalid. */ | |
3010 bad_count = 5, good_count = 0; | |
3011 | |
3012 /* If name is valid already, return. */ | |
3013 if (bad_count == 0) | |
3014 return; | |
3015 | |
3016 /* If name is entirely invalid, or nearly so, use `emacs'. */ | |
3017 if (good_count == 0 | |
3018 || (good_count == 1 && bad_count > 0)) | |
3019 { | |
3020 Vx_resource_name = build_string ("emacs"); | |
3021 return; | |
3022 } | |
3023 | |
3024 /* Name is partly valid. Copy it and replace the invalid characters | |
3025 with underscores. */ | |
3026 | |
3027 Vx_resource_name = new = Fcopy_sequence (Vx_resource_name); | |
3028 | |
3029 for (i = 0; i < len; i++) | |
3030 { | |
3031 int c = XSTRING (new)->data[i]; | |
3032 if (! ((c >= 'a' && c <= 'z') | |
3033 || (c >= 'A' && c <= 'Z') | |
3034 || (c >= '0' && c <= '9') | |
3035 || c == '-' || c == '_')) | |
3036 XSTRING (new)->data[i] = '_'; | |
3037 } | |
3038 } | |
3039 | |
3040 | |
3041 extern char *x_get_string_resource (); | |
3042 | |
3043 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
|
3044 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
|
3045 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
|
3046 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
|
3047 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
|
3048 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
3049 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
|
3050 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
|
3051 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
|
3052 and the class is `Emacs.CLASS.SUBCLASS'. */) |
13434 | 3053 (attribute, class, component, subclass) |
3054 Lisp_Object attribute, class, component, subclass; | |
3055 { | |
3056 register char *value; | |
3057 char *name_key; | |
3058 char *class_key; | |
3059 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
3060 CHECK_STRING (attribute); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
3061 CHECK_STRING (class); |
13434 | 3062 |
3063 if (!NILP (component)) | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
3064 CHECK_STRING (component); |
13434 | 3065 if (!NILP (subclass)) |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
3066 CHECK_STRING (subclass); |
13434 | 3067 if (NILP (component) != NILP (subclass)) |
3068 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither"); | |
3069 | |
3070 validate_x_resource_name (); | |
3071 | |
3072 /* Allocate space for the components, the dots which separate them, | |
3073 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
|
3074 name_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_name)) |
13434 | 3075 + (STRINGP (component) |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
3076 ? 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
|
3077 + STRING_BYTES (XSTRING (attribute)) |
13434 | 3078 + 3); |
3079 | |
3080 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
|
3081 + STRING_BYTES (XSTRING (class)) |
13434 | 3082 + (STRINGP (subclass) |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
3083 ? STRING_BYTES (XSTRING (subclass)) : 0) |
13434 | 3084 + 3); |
3085 | |
3086 /* Start with emacs.FRAMENAME for the name (the specific one) | |
3087 and with `Emacs' for the class key (the general one). */ | |
3088 strcpy (name_key, XSTRING (Vx_resource_name)->data); | |
3089 strcpy (class_key, EMACS_CLASS); | |
3090 | |
3091 strcat (class_key, "."); | |
3092 strcat (class_key, XSTRING (class)->data); | |
3093 | |
3094 if (!NILP (component)) | |
3095 { | |
3096 strcat (class_key, "."); | |
3097 strcat (class_key, XSTRING (subclass)->data); | |
3098 | |
3099 strcat (name_key, "."); | |
3100 strcat (name_key, XSTRING (component)->data); | |
3101 } | |
3102 | |
3103 strcat (name_key, "."); | |
3104 strcat (name_key, XSTRING (attribute)->data); | |
3105 | |
3106 value = x_get_string_resource (Qnil, | |
3107 name_key, class_key); | |
3108 | |
3109 if (value != (char *) 0) | |
3110 return build_string (value); | |
3111 else | |
3112 return Qnil; | |
3113 } | |
3114 | |
3115 /* Used when C code wants a resource value. */ | |
3116 | |
3117 char * | |
3118 x_get_resource_string (attribute, class) | |
3119 char *attribute, *class; | |
3120 { | |
3121 char *name_key; | |
3122 char *class_key; | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3123 struct frame *sf = SELECTED_FRAME (); |
13434 | 3124 |
3125 /* Allocate space for the components, the dots which separate them, | |
3126 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
|
3127 name_key = (char *) alloca (STRING_BYTES (XSTRING (Vinvocation_name)) |
13434 | 3128 + strlen (attribute) + 2); |
3129 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) | |
3130 + strlen (class) + 2); | |
3131 | |
3132 sprintf (name_key, "%s.%s", | |
3133 XSTRING (Vinvocation_name)->data, | |
3134 attribute); | |
3135 sprintf (class_key, "%s.%s", EMACS_CLASS, class); | |
3136 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3137 return x_get_string_resource (sf, name_key, class_key); |
13434 | 3138 } |
3139 | |
3140 /* Types we might convert a resource string into. */ | |
3141 enum resource_types | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3142 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3143 RES_TYPE_NUMBER, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3144 RES_TYPE_FLOAT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3145 RES_TYPE_BOOLEAN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3146 RES_TYPE_STRING, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3147 RES_TYPE_SYMBOL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3148 }; |
13434 | 3149 |
3150 /* Return the value of parameter PARAM. | |
3151 | |
3152 First search ALIST, then Vdefault_frame_alist, then the X defaults | |
3153 database, using ATTRIBUTE as the attribute name and CLASS as its class. | |
3154 | |
3155 Convert the resource to the type specified by desired_type. | |
3156 | |
3157 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
|
3158 w32_get_arg, make sure you deal with Qunbound in a reasonable way, |
13434 | 3159 and don't let it get stored in any Lisp-visible variables! */ |
3160 | |
3161 static Lisp_Object | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3162 w32_get_arg (alist, param, attribute, class, type) |
13434 | 3163 Lisp_Object alist, param; |
3164 char *attribute; | |
3165 char *class; | |
3166 enum resource_types type; | |
3167 { | |
3168 register Lisp_Object tem; | |
3169 | |
3170 tem = Fassq (param, alist); | |
3171 if (EQ (tem, Qnil)) | |
3172 tem = Fassq (param, Vdefault_frame_alist); | |
3173 if (EQ (tem, Qnil)) | |
3174 { | |
3175 | |
3176 if (attribute) | |
3177 { | |
3178 tem = Fx_get_resource (build_string (attribute), | |
3179 build_string (class), | |
3180 Qnil, Qnil); | |
3181 | |
3182 if (NILP (tem)) | |
3183 return Qunbound; | |
3184 | |
3185 switch (type) | |
3186 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3187 case RES_TYPE_NUMBER: |
13434 | 3188 return make_number (atoi (XSTRING (tem)->data)); |
3189 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3190 case RES_TYPE_FLOAT: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3191 return make_float (atof (XSTRING (tem)->data)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3192 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3193 case RES_TYPE_BOOLEAN: |
13434 | 3194 tem = Fdowncase (tem); |
3195 if (!strcmp (XSTRING (tem)->data, "on") | |
3196 || !strcmp (XSTRING (tem)->data, "true")) | |
3197 return Qt; | |
3198 else | |
3199 return Qnil; | |
3200 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3201 case RES_TYPE_STRING: |
13434 | 3202 return tem; |
3203 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3204 case RES_TYPE_SYMBOL: |
13434 | 3205 /* As a special case, we map the values `true' and `on' |
3206 to Qt, and `false' and `off' to Qnil. */ | |
3207 { | |
3208 Lisp_Object lower; | |
3209 lower = Fdowncase (tem); | |
3210 if (!strcmp (XSTRING (lower)->data, "on") | |
3211 || !strcmp (XSTRING (lower)->data, "true")) | |
3212 return Qt; | |
3213 else if (!strcmp (XSTRING (lower)->data, "off") | |
3214 || !strcmp (XSTRING (lower)->data, "false")) | |
3215 return Qnil; | |
3216 else | |
3217 return Fintern (tem, Qnil); | |
3218 } | |
3219 | |
3220 default: | |
3221 abort (); | |
3222 } | |
3223 } | |
3224 else | |
3225 return Qunbound; | |
3226 } | |
3227 return Fcdr (tem); | |
3228 } | |
3229 | |
3230 /* 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
|
3231 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
|
3232 If no value is specified for PROP, look for an X default for XPROP |
13434 | 3233 on the frame named NAME. |
3234 If that is not found either, use the value DEFLT. */ | |
3235 | |
3236 static Lisp_Object | |
3237 x_default_parameter (f, alist, prop, deflt, xprop, xclass, type) | |
3238 struct frame *f; | |
3239 Lisp_Object alist; | |
3240 Lisp_Object prop; | |
3241 Lisp_Object deflt; | |
3242 char *xprop; | |
3243 char *xclass; | |
3244 enum resource_types type; | |
3245 { | |
3246 Lisp_Object tem; | |
3247 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3248 tem = w32_get_arg (alist, prop, xprop, xclass, type); |
13434 | 3249 if (EQ (tem, Qunbound)) |
3250 tem = deflt; | |
3251 x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil)); | |
3252 return tem; | |
3253 } | |
3254 | |
3255 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
|
3256 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
|
3257 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
|
3258 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
|
3259 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
|
3260 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
|
3261 or a list (- N) meaning -N pixels relative to bottom/right corner. */) |
13434 | 3262 (string) |
3263 Lisp_Object string; | |
3264 { | |
3265 int geometry, x, y; | |
3266 unsigned int width, height; | |
3267 Lisp_Object result; | |
3268 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
3269 CHECK_STRING (string); |
13434 | 3270 |
3271 geometry = XParseGeometry ((char *) XSTRING (string)->data, | |
3272 &x, &y, &width, &height); | |
3273 | |
3274 result = Qnil; | |
3275 if (geometry & XValue) | |
3276 { | |
3277 Lisp_Object element; | |
3278 | |
3279 if (x >= 0 && (geometry & XNegative)) | |
3280 element = Fcons (Qleft, Fcons (Qminus, Fcons (make_number (-x), Qnil))); | |
3281 else if (x < 0 && ! (geometry & XNegative)) | |
3282 element = Fcons (Qleft, Fcons (Qplus, Fcons (make_number (x), Qnil))); | |
3283 else | |
3284 element = Fcons (Qleft, make_number (x)); | |
3285 result = Fcons (element, result); | |
3286 } | |
3287 | |
3288 if (geometry & YValue) | |
3289 { | |
3290 Lisp_Object element; | |
3291 | |
3292 if (y >= 0 && (geometry & YNegative)) | |
3293 element = Fcons (Qtop, Fcons (Qminus, Fcons (make_number (-y), Qnil))); | |
3294 else if (y < 0 && ! (geometry & YNegative)) | |
3295 element = Fcons (Qtop, Fcons (Qplus, Fcons (make_number (y), Qnil))); | |
3296 else | |
3297 element = Fcons (Qtop, make_number (y)); | |
3298 result = Fcons (element, result); | |
3299 } | |
3300 | |
3301 if (geometry & WidthValue) | |
3302 result = Fcons (Fcons (Qwidth, make_number (width)), result); | |
3303 if (geometry & HeightValue) | |
3304 result = Fcons (Fcons (Qheight, make_number (height)), result); | |
3305 | |
3306 return result; | |
3307 } | |
3308 | |
3309 /* Calculate the desired size and position of this window, | |
3310 and return the flags saying which aspects were specified. | |
3311 | |
3312 This function does not make the coordinates positive. */ | |
3313 | |
3314 #define DEFAULT_ROWS 40 | |
3315 #define DEFAULT_COLS 80 | |
3316 | |
3317 static int | |
3318 x_figure_window_size (f, parms) | |
3319 struct frame *f; | |
3320 Lisp_Object parms; | |
3321 { | |
3322 register Lisp_Object tem0, tem1, tem2; | |
3323 long window_prompting = 0; | |
3324 | |
3325 /* Default values if we fall through. | |
3326 Actually, if that happens we should get | |
3327 window manager prompting. */ | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
3328 SET_FRAME_WIDTH (f, DEFAULT_COLS); |
13434 | 3329 f->height = DEFAULT_ROWS; |
3330 /* Window managers expect that if program-specified | |
3331 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
|
3332 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
|
3333 f->output_data.w32->left_pos = 0; |
13434 | 3334 |
34942
af688bd6c419
(x_figure_window_size): Do not allow new_height and
Jason Rumney <jasonr@gnu.org>
parents:
34729
diff
changeset
|
3335 /* 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
|
3336 values set here. */ |
af688bd6c419
(x_figure_window_size): Do not allow new_height and
Jason Rumney <jasonr@gnu.org>
parents:
34729
diff
changeset
|
3337 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
|
3338 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
|
3339 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3340 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
|
3341 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
|
3342 tem2 = w32_get_arg (parms, Quser_size, 0, 0, RES_TYPE_NUMBER); |
13434 | 3343 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) |
3344 { | |
3345 if (!EQ (tem0, Qunbound)) | |
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 (tem0); |
13434 | 3348 f->height = XINT (tem0); |
3349 } | |
3350 if (!EQ (tem1, Qunbound)) | |
3351 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
3352 CHECK_NUMBER (tem1); |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
3353 SET_FRAME_WIDTH (f, XINT (tem1)); |
13434 | 3354 } |
3355 if (!NILP (tem2) && !EQ (tem2, Qunbound)) | |
3356 window_prompting |= USSize; | |
3357 else | |
3358 window_prompting |= PSize; | |
3359 } | |
3360 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3361 f->output_data.w32->vertical_scroll_bar_extra |
13434 | 3362 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
3363 ? 0 | |
3364 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0 | |
3365 ? 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
|
3366 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font))); |
43398 | 3367 |
41726
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
3368 x_compute_fringe_widths (f, 0); |
43398 | 3369 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3370 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
|
3371 f->output_data.w32->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height); |
13434 | 3372 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3373 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
|
3374 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
|
3375 tem2 = w32_get_arg (parms, Quser_position, 0, 0, RES_TYPE_NUMBER); |
13434 | 3376 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) |
3377 { | |
3378 if (EQ (tem0, Qminus)) | |
3379 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3380 f->output_data.w32->top_pos = 0; |
13434 | 3381 window_prompting |= YNegative; |
3382 } | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3383 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
|
3384 && CONSP (XCDR (tem0)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3385 && INTEGERP (XCAR (XCDR (tem0)))) |
13434 | 3386 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3387 f->output_data.w32->top_pos = - XINT (XCAR (XCDR (tem0))); |
13434 | 3388 window_prompting |= YNegative; |
3389 } | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3390 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
|
3391 && CONSP (XCDR (tem0)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3392 && INTEGERP (XCAR (XCDR (tem0)))) |
13434 | 3393 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3394 f->output_data.w32->top_pos = XINT (XCAR (XCDR (tem0))); |
13434 | 3395 } |
3396 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
|
3397 f->output_data.w32->top_pos = 0; |
13434 | 3398 else |
3399 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
3400 CHECK_NUMBER (tem0); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3401 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
|
3402 if (f->output_data.w32->top_pos < 0) |
13434 | 3403 window_prompting |= YNegative; |
3404 } | |
3405 | |
3406 if (EQ (tem1, Qminus)) | |
3407 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3408 f->output_data.w32->left_pos = 0; |
13434 | 3409 window_prompting |= XNegative; |
3410 } | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3411 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
|
3412 && CONSP (XCDR (tem1)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3413 && INTEGERP (XCAR (XCDR (tem1)))) |
13434 | 3414 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3415 f->output_data.w32->left_pos = - XINT (XCAR (XCDR (tem1))); |
13434 | 3416 window_prompting |= XNegative; |
3417 } | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3418 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
|
3419 && CONSP (XCDR (tem1)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3420 && INTEGERP (XCAR (XCDR (tem1)))) |
13434 | 3421 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
3422 f->output_data.w32->left_pos = XINT (XCAR (XCDR (tem1))); |
13434 | 3423 } |
3424 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
|
3425 f->output_data.w32->left_pos = 0; |
13434 | 3426 else |
3427 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
3428 CHECK_NUMBER (tem1); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3429 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
|
3430 if (f->output_data.w32->left_pos < 0) |
13434 | 3431 window_prompting |= XNegative; |
3432 } | |
3433 | |
3434 if (!NILP (tem2) && ! EQ (tem2, Qunbound)) | |
3435 window_prompting |= USPosition; | |
3436 else | |
3437 window_prompting |= PPosition; | |
3438 } | |
3439 | |
43398 | 3440 if (f->output_data.w32->want_fullscreen != FULLSCREEN_NONE) |
3441 { | |
3442 int left, top; | |
3443 int width, height; | |
3444 | |
3445 /* It takes both for some WM:s to place it where we want */ | |
3446 window_prompting = USPosition | PPosition; | |
3447 x_fullscreen_adjust (f, &width, &height, &top, &left); | |
3448 f->width = width; | |
3449 f->height = height; | |
3450 f->output_data.w32->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width); | |
3451 f->output_data.w32->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height); | |
3452 f->output_data.w32->left_pos = left; | |
3453 f->output_data.w32->top_pos = top; | |
3454 } | |
3455 | |
13434 | 3456 return window_prompting; |
3457 } | |
3458 | |
3459 | |
3460 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3461 extern LRESULT CALLBACK w32_wnd_proc (); |
13434 | 3462 |
3463 BOOL | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3464 w32_init_class (hinst) |
13434 | 3465 HINSTANCE hinst; |
3466 { | |
3467 WNDCLASS wc; | |
3468 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3469 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
|
3470 wc.lpfnWndProc = (WNDPROC) w32_wnd_proc; |
13434 | 3471 wc.cbClsExtra = 0; |
3472 wc.cbWndExtra = WND_EXTRA_BYTES; | |
3473 wc.hInstance = hinst; | |
3474 wc.hIcon = LoadIcon (hinst, EMACS_CLASS); | |
3475 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
|
3476 wc.hbrBackground = NULL; /* GetStockObject (WHITE_BRUSH); */ |
13434 | 3477 wc.lpszMenuName = NULL; |
3478 wc.lpszClassName = EMACS_CLASS; | |
3479 | |
3480 return (RegisterClass (&wc)); | |
3481 } | |
3482 | |
3483 HWND | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3484 w32_createscrollbar (f, bar) |
13434 | 3485 struct frame *f; |
3486 struct scroll_bar * bar; | |
3487 { | |
3488 return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE, | |
3489 /* Position and size of scroll bar. */ | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3490 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
|
3491 XINT(bar->top), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
3492 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
|
3493 XINT(bar->height), |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3494 FRAME_W32_WINDOW (f), |
13434 | 3495 NULL, |
3496 hinst, | |
3497 NULL)); | |
3498 } | |
3499 | |
3500 void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3501 w32_createwindow (f) |
13434 | 3502 struct frame *f; |
3503 { | |
3504 HWND hwnd; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3505 RECT rect; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3506 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3507 rect.left = rect.top = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3508 rect.right = PIXEL_WIDTH (f); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3509 rect.bottom = PIXEL_HEIGHT (f); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3510 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3511 AdjustWindowRect (&rect, f->output_data.w32->dwStyle, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3512 FRAME_EXTERNAL_MENU_BAR (f)); |
13434 | 3513 |
3514 /* Do first time app init */ | |
3515 | |
3516 if (!hprevinst) | |
3517 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3518 w32_init_class (hinst); |
13434 | 3519 } |
3520 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3521 FRAME_W32_WINDOW (f) = hwnd |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3522 = CreateWindow (EMACS_CLASS, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3523 f->namebuf, |
39137
2d2b989f4a4b
(w32_createwindow): Undo last change.
Andrew Innes <andrewi@gnu.org>
parents:
39128
diff
changeset
|
3524 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
|
3525 f->output_data.w32->left_pos, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3526 f->output_data.w32->top_pos, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3527 rect.right - rect.left, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3528 rect.bottom - rect.top, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3529 NULL, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3530 NULL, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3531 hinst, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3532 NULL); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3533 |
13434 | 3534 if (hwnd) |
3535 { | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3536 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
|
3537 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
|
3538 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
|
3539 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
|
3540 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
|
3541 |
21884 | 3542 /* Enable drag-n-drop. */ |
3543 DragAcceptFiles (hwnd, TRUE); | |
3544 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3545 /* 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
|
3546 ShowWindow (hwnd, SW_HIDE); |
13434 | 3547 } |
3548 } | |
3549 | |
3550 void | |
3551 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
|
3552 W32Msg * wmsg; |
13434 | 3553 HWND hwnd; |
3554 UINT msg; | |
3555 WPARAM wParam; | |
3556 LPARAM lParam; | |
3557 { | |
3558 wmsg->msg.hwnd = hwnd; | |
3559 wmsg->msg.message = msg; | |
3560 wmsg->msg.wParam = wParam; | |
3561 wmsg->msg.lParam = lParam; | |
3562 wmsg->msg.time = GetMessageTime (); | |
3563 | |
3564 post_msg (wmsg); | |
3565 } | |
3566 | |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
3567 /* 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
|
3568 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
|
3569 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
|
3570 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
|
3571 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
|
3572 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
|
3573 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
|
3574 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
|
3575 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
|
3576 on Swedish keyboards). */ |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3577 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3578 #define EMACS_LCONTROL 0 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3579 #define EMACS_RCONTROL 1 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3580 #define EMACS_LMENU 2 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3581 #define EMACS_RMENU 3 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3582 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3583 static int modifiers[4]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3584 static int modifiers_recorded; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3585 static int modifier_key_support_tested; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3586 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3587 static void |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3588 test_modifier_support (unsigned int wparam) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3589 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3590 unsigned int l, r; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3591 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3592 if (wparam != VK_CONTROL && wparam != VK_MENU) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3593 return; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3594 if (wparam == VK_CONTROL) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3595 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3596 l = VK_LCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3597 r = VK_RCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3598 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3599 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3600 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3601 l = VK_LMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3602 r = VK_RMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3603 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3604 if (!(GetKeyState (l) & 0x8000) && !(GetKeyState (r) & 0x8000)) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3605 modifiers_recorded = 1; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3606 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3607 modifiers_recorded = 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3608 modifier_key_support_tested = 1; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3609 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3610 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3611 static void |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3612 record_keydown (unsigned int wparam, unsigned int lparam) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3613 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3614 int i; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3615 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3616 if (!modifier_key_support_tested) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3617 test_modifier_support (wparam); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3618 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3619 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
|
3620 return; |
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 if (wparam == VK_CONTROL) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3623 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3624 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3625 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3626 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3627 modifiers[i] = 1; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3628 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3629 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3630 static void |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3631 record_keyup (unsigned int wparam, unsigned int lparam) |
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 int i; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3634 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3635 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
|
3636 return; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3637 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3638 if (wparam == VK_CONTROL) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3639 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3640 else |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3641 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3642 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3643 modifiers[i] = 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3644 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3645 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3646 /* 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
|
3647 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
|
3648 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
|
3649 static void |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3650 reset_modifiers () |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3651 { |
15314
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3652 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
|
3653 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3654 if (GetFocus () == NULL) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3655 /* 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
|
3656 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
|
3657 |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3658 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
|
3659 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
|
3660 |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3661 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
|
3662 /* 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
|
3663 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
|
3664 |
796d825f4444
(reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents:
15290
diff
changeset
|
3665 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
|
3666 /* 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
|
3667 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
|
3668 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3669 /* 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
|
3670 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
|
3671 result of a hot-key being pressed. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3672 { |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3673 BYTE keystate[256]; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3674 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3675 #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
|
3676 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3677 GetKeyboardState (keystate); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3678 keystate[VK_SHIFT] = CURRENT_STATE (VK_SHIFT); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3679 keystate[VK_CONTROL] = CURRENT_STATE (VK_CONTROL); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3680 keystate[VK_LCONTROL] = CURRENT_STATE (VK_LCONTROL); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3681 keystate[VK_RCONTROL] = CURRENT_STATE (VK_RCONTROL); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3682 keystate[VK_MENU] = CURRENT_STATE (VK_MENU); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3683 keystate[VK_LMENU] = CURRENT_STATE (VK_LMENU); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3684 keystate[VK_RMENU] = CURRENT_STATE (VK_RMENU); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3685 keystate[VK_LWIN] = CURRENT_STATE (VK_LWIN); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3686 keystate[VK_RWIN] = CURRENT_STATE (VK_RWIN); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3687 keystate[VK_APPS] = CURRENT_STATE (VK_APPS); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3688 SetKeyboardState (keystate); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3689 } |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3690 } |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3691 |
15377
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3692 /* 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
|
3693 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
|
3694 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
|
3695 the left or right modifier should be set. */ |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3696 static void |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3697 sync_modifiers () |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3698 { |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3699 if (!modifiers_recorded) |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3700 return; |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3701 |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3702 if (!(GetKeyState (VK_CONTROL) & 0x8000)) |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3703 modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0; |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3704 |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3705 if (!(GetKeyState (VK_MENU) & 0x8000)) |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3706 modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0; |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3707 } |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
3708 |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3709 static int |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3710 modifier_set (int vkey) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3711 { |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3712 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
|
3713 return (GetKeyState (vkey) & 0x1); |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3714 if (!modifiers_recorded) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3715 return (GetKeyState (vkey) & 0x8000); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3716 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3717 switch (vkey) |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3718 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3719 case VK_LCONTROL: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3720 return modifiers[EMACS_LCONTROL]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3721 case VK_RCONTROL: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3722 return modifiers[EMACS_RCONTROL]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3723 case VK_LMENU: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3724 return modifiers[EMACS_LMENU]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3725 case VK_RMENU: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3726 return modifiers[EMACS_RMENU]; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3727 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3728 return (GetKeyState (vkey) & 0x8000); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3729 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3730 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3731 /* 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
|
3732 Emacs uses. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3733 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3734 unsigned int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3735 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
|
3736 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3737 Lisp_Object key_mapping; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3738 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3739 switch (key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3740 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3741 case VK_LWIN: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3742 key_mapping = Vw32_lwindow_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3743 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3744 case VK_RWIN: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3745 key_mapping = Vw32_rwindow_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3746 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3747 case VK_APPS: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3748 key_mapping = Vw32_apps_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3749 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3750 case VK_SCROLL: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3751 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
|
3752 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3753 default: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3754 key_mapping = Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3755 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3756 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3757 /* 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
|
3758 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
|
3759 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
|
3760 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
|
3761 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
|
3762 markbits here. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3763 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
|
3764 return hyper_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3765 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
|
3766 return super_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3767 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
|
3768 return meta_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3769 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
|
3770 return alt_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3771 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
|
3772 return ctrl_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3773 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
|
3774 return ctrl_modifier; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3775 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
|
3776 return shift_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3777 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3778 /* 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
|
3779 return 0; |
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 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3782 unsigned int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3783 w32_get_modifiers () |
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 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
|
3786 (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
|
3787 (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
|
3788 (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
|
3789 (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
|
3790 (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
|
3791 (modifier_set (VK_MENU) ? |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3792 ((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
|
3793 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3794 |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3795 /* 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
|
3796 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
|
3797 and window input. */ |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3798 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3799 static int |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3800 construct_console_modifiers () |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3801 { |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3802 int mods; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3803 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3804 mods = 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3805 mods |= (modifier_set (VK_SHIFT)) ? SHIFT_PRESSED : 0; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3806 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
|
3807 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
|
3808 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
|
3809 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
|
3810 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
|
3811 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
|
3812 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
|
3813 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
|
3814 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
|
3815 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
|
3816 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3817 return mods; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3818 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3819 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3820 static int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3821 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
|
3822 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3823 int mods; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3824 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3825 /* Convert to emacs modifiers. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3826 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
|
3827 |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3828 return mods; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3829 } |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
3830 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3831 unsigned int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3832 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
|
3833 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3834 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
|
3835 return virt_key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3836 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3837 if (virt_key == VK_RETURN) |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3838 return (extended ? VK_NUMPAD_ENTER : VK_RETURN); |
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
3839 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3840 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
|
3841 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
|
3842 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3843 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
|
3844 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
|
3845 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3846 if (virt_key == VK_CLEAR) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3847 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
|
3848 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3849 return virt_key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3850 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3851 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3852 /* 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
|
3853 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
|
3854 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
|
3855 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
|
3856 Lisp_Object w32_grabbed_keys; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3857 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3858 #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
|
3859 #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
|
3860 #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
|
3861 #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
|
3862 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3863 /* 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
|
3864 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
|
3865 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
|
3866 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3867 static void |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3868 register_hot_keys (hwnd) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3869 HWND hwnd; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3870 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3871 Lisp_Object keylist; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3872 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3873 /* 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
|
3874 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
|
3875 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3876 Lisp_Object key = XCAR (keylist); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3877 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3878 /* 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
|
3879 if (!INTEGERP (key)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3880 continue; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3881 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3882 RegisterHotKey (hwnd, HOTKEY_ID (key), |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3883 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
|
3884 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3885 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3886 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3887 static void |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3888 unregister_hot_keys (hwnd) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3889 HWND hwnd; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3890 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3891 Lisp_Object keylist; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3892 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3893 /* 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
|
3894 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
|
3895 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3896 Lisp_Object key = XCAR (keylist); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3897 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3898 if (!INTEGERP (key)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3899 continue; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3900 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3901 UnregisterHotKey (hwnd, HOTKEY_ID (key)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3902 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3903 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3904 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3905 /* Main message dispatch loop. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3906 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3907 static void |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3908 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
|
3909 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3910 MSG msg; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3911 int result; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3912 HWND focus_window; |
21874
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
3913 |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
3914 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
|
3915 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3916 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
|
3917 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3918 if (msg.hwnd == NULL) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3919 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3920 switch (msg.message) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3921 { |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3922 case WM_NULL: |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
3923 /* 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
|
3924 break; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3925 case WM_EMACS_CREATEWINDOW: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
3926 w32_createwindow ((struct frame *) msg.wParam); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3927 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
|
3928 abort (); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3929 break; |
21608
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3930 case WM_EMACS_SETLOCALE: |
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3931 SetThreadLocale (msg.wParam); |
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3932 /* Reply is not expected. */ |
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
3933 break; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3934 case WM_EMACS_SETKEYBOARDLAYOUT: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3935 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
|
3936 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
|
3937 result, 0)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3938 abort (); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3939 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3940 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
|
3941 focus_window = GetFocus (); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3942 if (focus_window != NULL) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3943 RegisterHotKey (focus_window, |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3944 HOTKEY_ID (msg.wParam), |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3945 HOTKEY_MODIFIERS (msg.wParam), |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3946 HOTKEY_VK_CODE (msg.wParam)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3947 /* Reply is not expected. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3948 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3949 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
|
3950 focus_window = GetFocus (); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3951 if (focus_window != NULL) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3952 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
|
3953 /* 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
|
3954 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
|
3955 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
|
3956 GC. */ |
39973
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
39812
diff
changeset
|
3957 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
|
3958 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
|
3959 abort (); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
3960 break; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3961 case WM_EMACS_TOGGLE_LOCK_KEY: |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3962 { |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3963 int vk_code = (int) msg.wParam; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3964 int cur_state = (GetKeyState (vk_code) & 1); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3965 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
|
3966 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3967 /* 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
|
3968 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
|
3969 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
|
3970 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
|
3971 immediate values. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3972 if (NILP (new_state) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3973 || (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
|
3974 && ((XUINT (new_state)) & 1) != cur_state)) |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3975 { |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3976 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
|
3977 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3978 keybd_event ((BYTE) vk_code, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3979 (BYTE) MapVirtualKey (vk_code, 0), |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3980 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3981 keybd_event ((BYTE) vk_code, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3982 (BYTE) MapVirtualKey (vk_code, 0), |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3983 KEYEVENTF_EXTENDEDKEY | 0, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3984 keybd_event ((BYTE) vk_code, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3985 (BYTE) MapVirtualKey (vk_code, 0), |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3986 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3987 cur_state = !cur_state; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3988 } |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3989 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3990 cur_state, 0)) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3991 abort (); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3992 } |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
3993 break; |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3994 default: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
3995 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
|
3996 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3997 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3998 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
3999 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4000 DispatchMessage (&msg); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4001 } |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4002 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4003 /* 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
|
4004 if (msg_buf->completed) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4005 break; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
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 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4009 deferred_msg * deferred_msg_head; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4010 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4011 static deferred_msg * |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4012 find_deferred_msg (HWND hwnd, UINT msg) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4013 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4014 deferred_msg * item; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4015 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4016 /* 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
|
4017 modification of single pointer is always atomic. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4018 /* enter_crit (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4019 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4020 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
|
4021 if (item->w32msg.msg.hwnd == hwnd |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4022 && item->w32msg.msg.message == msg) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4023 break; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4024 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4025 /* leave_crit (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4026 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4027 return item; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4028 } |
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 static LRESULT |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4031 send_deferred_msg (deferred_msg * msg_buf, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4032 HWND hwnd, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4033 UINT msg, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4034 WPARAM wParam, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4035 LPARAM lParam) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4036 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4037 /* Only input thread can send deferred messages. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4038 if (GetCurrentThreadId () != dwWindowsThreadId) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4039 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4040 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4041 /* 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
|
4042 if (find_deferred_msg (hwnd, msg) != NULL) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4043 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4044 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4045 /* 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
|
4046 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
|
4047 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
|
4048 input thread can call us). */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4049 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4050 /* enter_crit (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4051 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4052 msg_buf->completed = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4053 msg_buf->next = deferred_msg_head; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4054 deferred_msg_head = msg_buf; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4055 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
|
4056 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4057 /* leave_crit (); */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4058 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4059 /* 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
|
4060 this one is completed. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4061 w32_msg_pump (msg_buf); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4062 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4063 deferred_msg_head = msg_buf->next; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4064 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4065 return msg_buf->result; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4066 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4067 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4068 void |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4069 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
|
4070 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4071 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
|
4072 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4073 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
|
4074 /* 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
|
4075 return; |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4076 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4077 msg_buf->result = result; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4078 msg_buf->completed = 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4079 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4080 /* 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
|
4081 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4082 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4083 |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4084 void |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4085 cancel_all_deferred_msgs () |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4086 { |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4087 deferred_msg * item; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4088 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4089 /* 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
|
4090 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
|
4091 /* enter_crit (); */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4092 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4093 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
|
4094 { |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4095 item->result = 0; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4096 item->completed = 1; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4097 } |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4098 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4099 /* leave_crit (); */ |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4100 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4101 /* 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
|
4102 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
|
4103 } |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4104 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4105 DWORD |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4106 w32_msg_worker (dw) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4107 DWORD dw; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4108 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4109 MSG msg; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4110 deferred_msg dummy_buf; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4111 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4112 /* 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
|
4113 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4114 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4115 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4116 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
|
4117 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4118 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4119 memset (&dummy_buf, 0, sizeof (dummy_buf)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4120 dummy_buf.w32msg.msg.hwnd = NULL; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4121 dummy_buf.w32msg.msg.message = WM_NULL; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4122 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4123 /* 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
|
4124 application quits. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4125 w32_msg_pump (&dummy_buf); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4126 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4127 return 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4128 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4129 |
23950
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4130 static void |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4131 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
|
4132 HWND hwnd; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4133 UINT msg; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4134 WPARAM wParam; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4135 LPARAM lParam; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4136 DWORD modifiers; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4137 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4138 { |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4139 W32Msg wmsg; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4140 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4141 wmsg.dwModifiers = modifiers; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4142 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4143 /* 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
|
4144 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
|
4145 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
|
4146 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
|
4147 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
|
4148 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
|
4149 { |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4150 int c = wParam; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4151 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
|
4152 c = make_ctrl_char (c) & 0377; |
24339
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
4153 if (c == quit_char |
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
4154 || (wmsg.dwModifiers == 0 && |
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
4155 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
|
4156 { |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4157 Vquit_flag = Qt; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4158 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4159 /* 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
|
4160 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
|
4161 msg = WM_NULL; |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4162 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4163 /* 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
|
4164 signal_quit (); |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4165 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4166 /* 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
|
4167 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
|
4168 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
|
4169 "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
|
4170 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
|
4171 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
|
4172 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
|
4173 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
|
4174 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
|
4175 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
|
4176 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
|
4177 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
|
4178 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
|
4179 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
|
4180 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4181 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
|
4182 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
|
4183 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
|
4184 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
|
4185 cancel_all_deferred_msgs (); |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4186 } |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4187 } |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4188 |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4189 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
|
4190 } |
d8f8533db4cc
(w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents:
23803
diff
changeset
|
4191 |
13434 | 4192 /* Main window procedure */ |
4193 | |
4194 LRESULT CALLBACK | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4195 w32_wnd_proc (hwnd, msg, wParam, lParam) |
13434 | 4196 HWND hwnd; |
4197 UINT msg; | |
4198 WPARAM wParam; | |
4199 LPARAM lParam; | |
4200 { | |
4201 struct frame *f; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4202 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
|
4203 W32Msg wmsg; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4204 int windows_translate; |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4205 int key; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4206 |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4207 /* 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
|
4208 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
|
4209 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
|
4210 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
|
4211 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
|
4212 |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4213 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
|
4214 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
|
4215 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
|
4216 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
|
4217 delete-frame has synchronized with this thread. |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4218 |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4219 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
|
4220 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
|
4221 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
|
4222 |
13434 | 4223 switch (msg) |
4224 { | |
4225 case WM_ERASEBKGND: | |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4226 f = x_window_to_frame (dpyinfo, hwnd); |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4227 if (f) |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4228 { |
27407
7df920562cbe
(w32_defined_color): Apply gamma correction before trying to map to
Jason Rumney <jasonr@gnu.org>
parents:
27397
diff
changeset
|
4229 HDC hdc = get_frame_dc (f); |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4230 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
|
4231 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
|
4232 release_frame_dc (f, hdc); |
24718
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
4233 |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
4234 #if defined (W32_DEBUG_DISPLAY) |
39128
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4235 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
|
4236 f, |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4237 wmsg.rect.left, wmsg.rect.top, |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4238 wmsg.rect.right, wmsg.rect.bottom)); |
24718
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
4239 #endif /* W32_DEBUG_DISPLAY */ |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4240 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4241 return 1; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4242 case WM_PALETTECHANGED: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4243 /* ignore our own changes */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4244 if ((HWND)wParam != hwnd) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4245 { |
15650
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4246 f = x_window_to_frame (dpyinfo, hwnd); |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4247 if (f) |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4248 /* 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
|
4249 frames to be redrawn if needed. */ |
bc9525478463
(win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents:
15459
diff
changeset
|
4250 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
|
4251 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4252 return 0; |
13434 | 4253 case WM_PAINT: |
24718
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
4254 { |
24670 | 4255 PAINTSTRUCT paintStruct; |
4256 RECT update_rect; | |
42935
20a21fb23284
(w32_wnd_proc) <WM_PAINT>: Initialize update_rect.
Jason Rumney <jasonr@gnu.org>
parents:
42918
diff
changeset
|
4257 bzero (&update_rect, sizeof (update_rect)); |
24670 | 4258 |
39128
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4259 f = x_window_to_frame (dpyinfo, hwnd); |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4260 if (f == 0) |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4261 { |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4262 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
|
4263 return 0; |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4264 } |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4265 |
24670 | 4266 /* MSDN Docs say not to call BeginPaint if GetUpdateRect |
4267 fails. Apparently this can happen under some | |
4268 circumstances. */ | |
42935
20a21fb23284
(w32_wnd_proc) <WM_PAINT>: Initialize update_rect.
Jason Rumney <jasonr@gnu.org>
parents:
42918
diff
changeset
|
4269 if (GetUpdateRect (hwnd, &update_rect, FALSE) || !w32_strict_painting) |
24670 | 4270 { |
4271 enter_crit (); | |
4272 BeginPaint (hwnd, &paintStruct); | |
4273 | |
42935
20a21fb23284
(w32_wnd_proc) <WM_PAINT>: Initialize update_rect.
Jason Rumney <jasonr@gnu.org>
parents:
42918
diff
changeset
|
4274 /* 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
|
4275 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
|
4276 are invalid. */ |
20a21fb23284
(w32_wnd_proc) <WM_PAINT>: Initialize update_rect.
Jason Rumney <jasonr@gnu.org>
parents:
42918
diff
changeset
|
4277 UnionRect (&(wmsg.rect), &update_rect, &(paintStruct.rcPaint)); |
24670 | 4278 |
4279 #if defined (W32_DEBUG_DISPLAY) | |
39128
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4280 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
|
4281 f, |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4282 wmsg.rect.left, wmsg.rect.top, |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4283 wmsg.rect.right, wmsg.rect.bottom)); |
42efaa34094a
(w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents:
37707
diff
changeset
|
4284 DebPrint ((" [update region is %d,%d-%d,%d]\n", |
24670 | 4285 update_rect.left, update_rect.top, |
4286 update_rect.right, update_rect.bottom)); | |
4287 #endif | |
4288 EndPaint (hwnd, &paintStruct); | |
4289 leave_crit (); | |
4290 | |
4291 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); | |
4292 | |
4293 return 0; | |
4294 } | |
24695
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
4295 |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
4296 /* If GetUpdateRect returns 0 (meaning there is no update |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
4297 region), assume the whole window needs to be repainted. */ |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
4298 GetClientRect(hwnd, &wmsg.rect); |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
4299 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
4300 return 0; |
13434 | 4301 } |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
4302 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4303 case WM_INPUTLANGCHANGE: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4304 /* 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
|
4305 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
|
4306 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4307 /* 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
|
4308 preserve modifier key states. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4309 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4310 int i; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4311 BYTE keystate[256]; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4312 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4313 GetKeyboardState (keystate); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4314 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
|
4315 if (1 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4316 && i != VK_SHIFT |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4317 && i != VK_LSHIFT |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4318 && i != VK_RSHIFT |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4319 && i != VK_CAPITAL |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4320 && i != VK_NUMLOCK |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4321 && i != VK_SCROLL |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4322 && i != VK_CONTROL |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4323 && i != VK_LCONTROL |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4324 && i != VK_RCONTROL |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4325 && i != VK_MENU |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4326 && i != VK_LMENU |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4327 && i != VK_RMENU |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4328 && i != VK_LWIN |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4329 && i != VK_RWIN) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4330 keystate[i] = 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4331 SetKeyboardState (keystate); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4332 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4333 goto dflt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4334 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4335 case WM_HOTKEY: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4336 /* 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
|
4337 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
|
4338 return (0); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4339 |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
4340 case WM_KEYUP: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
4341 case WM_SYSKEYUP: |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
4342 record_keyup (wParam, lParam); |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
4343 goto dflt; |
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
4344 |
13434 | 4345 case WM_KEYDOWN: |
4346 case WM_SYSKEYDOWN: | |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4347 /* 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
|
4348 if (dpyinfo->faked_key == wParam) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4349 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4350 dpyinfo->faked_key = 0; |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4351 /* 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
|
4352 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
|
4353 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
|
4354 example. */ |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4355 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
|
4356 { |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4357 windows_translate = 1; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4358 goto translate; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4359 } |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4360 return 0; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4361 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4362 |
15377
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
4363 /* Synchronize modifiers with current keystroke. */ |
65d9ff2c8602
(sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents:
15314
diff
changeset
|
4364 sync_modifiers (); |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
4365 record_keydown (wParam, lParam); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4366 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
|
4367 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4368 windows_translate = 0; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4369 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4370 switch (wParam) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4371 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4372 case VK_LWIN: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4373 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
|
4374 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4375 /* 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
|
4376 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
|
4377 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
|
4378 if (GetAsyncKeyState (wParam) & 1) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4379 { |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4380 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
|
4381 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
|
4382 else |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4383 key = VK_SPACE; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4384 dpyinfo->faked_key = key; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4385 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
|
4386 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4387 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4388 if (!NILP (Vw32_lwindow_modifier)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4389 return 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4390 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4391 case VK_RWIN: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4392 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
|
4393 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4394 if (GetAsyncKeyState (wParam) & 1) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4395 { |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4396 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
|
4397 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
|
4398 else |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4399 key = VK_SPACE; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4400 dpyinfo->faked_key = key; |
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4401 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
|
4402 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4403 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4404 if (!NILP (Vw32_rwindow_modifier)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4405 return 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4406 break; |
24206
d3649b38bb37
(w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents:
24147
diff
changeset
|
4407 case VK_APPS: |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4408 if (!NILP (Vw32_apps_modifier)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4409 return 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4410 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4411 case VK_MENU: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4412 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
|
4413 /* 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
|
4414 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
|
4415 return 0; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4416 windows_translate = 1; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4417 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4418 case VK_CAPITAL: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4419 /* 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
|
4420 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
|
4421 goto disable_lock_key; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4422 windows_translate = 1; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4423 break; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4424 case VK_NUMLOCK: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4425 /* 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
|
4426 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
|
4427 goto disable_lock_key; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4428 windows_translate = 1; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4429 break; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4430 case VK_SCROLL: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4431 /* 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
|
4432 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
|
4433 goto disable_lock_key; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4434 windows_translate = 1; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4435 break; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4436 disable_lock_key: |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4437 /* 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
|
4438 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
|
4439 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
|
4440 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
|
4441 dpyinfo->faked_key = wParam; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4442 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
|
4443 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4444 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
|
4445 KEYEVENTF_EXTENDEDKEY | 0, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4446 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
|
4447 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4448 /* 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
|
4449 (TranslateMessage apparently does this), after forwarding |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4450 input event. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4451 post_character_message (hwnd, msg, wParam, lParam, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4452 w32_get_key_modifiers (wParam, lParam)); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4453 windows_translate = 1; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4454 break; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4455 case VK_CONTROL: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4456 case VK_SHIFT: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4457 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
|
4458 windows_translate = 1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4459 break; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4460 case VK_CANCEL: |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4461 /* 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
|
4462 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
|
4463 VK_CANCEL events into VK_PAUSE events. */ |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4464 wParam = VK_PAUSE; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4465 break; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4466 case VK_PAUSE: |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4467 /* 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
|
4468 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
|
4469 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
|
4470 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
|
4471 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
|
4472 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
|
4473 wParam = VK_NUMLOCK; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4474 break; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4475 default: |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4476 /* 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
|
4477 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
|
4478 { |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4479 DWORD modifiers = construct_console_modifiers (); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4480 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4481 if (!NILP (Vw32_recognize_altgr) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4482 && 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
|
4483 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4484 /* 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
|
4485 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
|
4486 chords correctly. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4487 windows_translate = 1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4488 } |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4489 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
|
4490 { |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4491 /* Handle key chords including any modifiers other |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4492 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
|
4493 modifier information as possible. */ |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4494 if ('A' <= wParam && wParam <= 'Z') |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4495 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4496 /* 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
|
4497 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
|
4498 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
|
4499 the normal layout translates alphabetic |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4500 characters to non-ascii characters. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4501 if (!modifier_set (VK_SHIFT)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4502 wParam += ('a' - 'A'); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4503 msg = WM_CHAR; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4504 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4505 else |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4506 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4507 /* 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
|
4508 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
|
4509 shift modifier). */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4510 int add; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4511 int isdead = 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4512 KEY_EVENT_RECORD key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4513 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4514 key.bKeyDown = TRUE; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4515 key.wRepeatCount = 1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4516 key.wVirtualKeyCode = wParam; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4517 key.wVirtualScanCode = (lParam & 0xFF0000) >> 16; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4518 key.uChar.AsciiChar = 0; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4519 key.dwControlKeyState = modifiers; |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4520 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4521 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
|
4522 /* 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
|
4523 dead key. Ignore both. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4524 while (--add >= 0) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4525 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4526 /* Forward asciified character sequence. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4527 post_character_message |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4528 (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
|
4529 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
|
4530 w32_kbd_patch_key (&key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4531 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4532 return 0; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4533 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4534 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4535 else |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4536 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4537 /* Let TranslateMessage handle everything else. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4538 windows_translate = 1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4539 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4540 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4541 } |
14461
4fe9540be594
(modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14353
diff
changeset
|
4542 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4543 translate: |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4544 if (windows_translate) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4545 { |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
4546 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
|
4547 |
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
4548 windows_msg.time = GetMessageTime (); |
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
4549 TranslateMessage (&windows_msg); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4550 goto dflt; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4551 } |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4552 |
13434 | 4553 /* Fall through */ |
4554 | |
4555 case WM_SYSCHAR: | |
4556 case WM_CHAR: | |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4557 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
|
4558 w32_get_key_modifiers (wParam, lParam)); |
13434 | 4559 break; |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4560 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4561 /* 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
|
4562 are used together, but only if user has two button mouse. */ |
13434 | 4563 case WM_LBUTTONDOWN: |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4564 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
|
4565 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
|
4566 goto handle_plain_button; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4567 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4568 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4569 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
|
4570 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
|
4571 |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4572 if (button_state & this) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4573 return 0; |
15147
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 if (button_state == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4576 SetCapture (hwnd); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4577 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4578 button_state |= this; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4579 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4580 if (button_state & other) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4581 { |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4582 if (mouse_button_timer) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4583 { |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4584 KillTimer (hwnd, mouse_button_timer); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4585 mouse_button_timer = 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4586 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4587 /* Generate middle mouse event instead. */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4588 msg = WM_MBUTTONDOWN; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4589 button_state |= MMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4590 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4591 else if (button_state & MMOUSE) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4592 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4593 /* 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
|
4594 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
|
4595 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
|
4596 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
|
4597 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4598 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4599 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4600 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4601 /* Flush out saved message. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4602 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
|
4603 } |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4604 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
|
4605 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
|
4606 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4607 /* Clear message buffer. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4608 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
|
4609 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4610 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4611 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4612 /* Hold onto message for now. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4613 mouse_button_timer = |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4614 SetTimer (hwnd, MOUSE_BUTTON_ID, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4615 XINT (Vw32_mouse_button_tolerance), NULL); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4616 saved_mouse_button_msg.msg.hwnd = hwnd; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4617 saved_mouse_button_msg.msg.message = msg; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4618 saved_mouse_button_msg.msg.wParam = wParam; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4619 saved_mouse_button_msg.msg.lParam = lParam; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4620 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
|
4621 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
|
4622 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4623 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4624 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4625 |
13434 | 4626 case WM_LBUTTONUP: |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4627 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
|
4628 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
|
4629 goto handle_plain_button; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4630 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4631 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4632 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
|
4633 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
|
4634 |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4635 if ((button_state & this) == 0) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
4636 return 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4637 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4638 button_state &= ~this; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4639 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4640 if (button_state & MMOUSE) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4641 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4642 /* 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
|
4643 if ((button_state & other) == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4644 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4645 msg = WM_MBUTTONUP; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4646 button_state &= ~MMOUSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4647 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4648 if (button_state) abort (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4649 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4650 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4651 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4652 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4653 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4654 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4655 /* Flush out saved message if necessary. */ |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4656 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
|
4657 { |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4658 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
|
4659 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4660 } |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4661 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
|
4662 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
|
4663 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4664 /* 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
|
4665 saved_mouse_button_msg.msg.hwnd = 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4666 KillTimer (hwnd, mouse_button_timer); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4667 mouse_button_timer = 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4668 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4669 if (button_state == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4670 ReleaseCapture (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4671 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4672 return 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4673 |
42719
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
4674 case WM_XBUTTONDOWN: |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
4675 case WM_XBUTTONUP: |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
4676 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
|
4677 goto dflt; |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
4678 /* else fall through and process them. */ |
13434 | 4679 case WM_MBUTTONDOWN: |
4680 case WM_MBUTTONUP: | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4681 handle_plain_button: |
13434 | 4682 { |
4683 BOOL up; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4684 int button; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4685 |
42719
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
4686 if (parse_button (msg, HIWORD (wParam), &button, &up)) |
13434 | 4687 { |
4688 if (up) ReleaseCapture (); | |
4689 else SetCapture (hwnd); | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4690 button = (button == 0) ? LMOUSE : |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4691 ((button == 1) ? MMOUSE : RMOUSE); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4692 if (up) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4693 button_state &= ~button; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4694 else |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4695 button_state |= button; |
13434 | 4696 } |
4697 } | |
4698 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4699 wmsg.dwModifiers = w32_get_modifiers (); |
13434 | 4700 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
|
4701 |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
4702 /* 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
|
4703 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
|
4704 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
|
4705 |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4706 case WM_MOUSEMOVE: |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4707 /* 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
|
4708 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
|
4709 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
|
4710 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
|
4711 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
|
4712 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
|
4713 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
|
4714 { |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4715 TRACKMOUSEEVENT tme; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4716 tme.cbSize = sizeof (tme); |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4717 tme.dwFlags = TME_LEAVE; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4718 tme.hwndTrack = hwnd; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4719 |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4720 track_mouse_event_fn (&tme); |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4721 track_mouse_window = hwnd; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4722 } |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4723 case WM_VSCROLL: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4724 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
|
4725 || (msg == WM_MOUSEMOVE && button_state == 0)) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4726 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
4727 wmsg.dwModifiers = w32_get_modifiers (); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4728 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
|
4729 return 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4730 } |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4731 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4732 /* 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
|
4733 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
|
4734 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
|
4735 expires, we just replace the first message. */ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4736 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4737 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
|
4738 mouse_move_timer = |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4739 SetTimer (hwnd, MOUSE_MOVE_ID, |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4740 XINT (Vw32_mouse_move_interval), NULL); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4741 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4742 /* Hold onto message for now. */ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4743 saved_mouse_move_msg.msg.hwnd = hwnd; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4744 saved_mouse_move_msg.msg.message = msg; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4745 saved_mouse_move_msg.msg.wParam = wParam; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4746 saved_mouse_move_msg.msg.lParam = lParam; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4747 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
|
4748 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
|
4749 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4750 return 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4751 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4752 case WM_MOUSEWHEEL: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4753 wmsg.dwModifiers = w32_get_modifiers (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4754 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
|
4755 return 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4756 |
21884 | 4757 case WM_DROPFILES: |
4758 wmsg.dwModifiers = w32_get_modifiers (); | |
4759 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); | |
4760 return 0; | |
4761 | |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4762 case WM_TIMER: |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4763 /* Flush out saved messages if necessary. */ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4764 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
|
4765 { |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4766 if (saved_mouse_button_msg.msg.hwnd) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4767 { |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4768 post_msg (&saved_mouse_button_msg); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4769 saved_mouse_button_msg.msg.hwnd = 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4770 } |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4771 KillTimer (hwnd, mouse_button_timer); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4772 mouse_button_timer = 0; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4773 } |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4774 else if (wParam == mouse_move_timer) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4775 { |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4776 if (saved_mouse_move_msg.msg.hwnd) |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4777 { |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4778 post_msg (&saved_mouse_move_msg); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4779 saved_mouse_move_msg.msg.hwnd = 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4780 } |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4781 KillTimer (hwnd, mouse_move_timer); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4782 mouse_move_timer = 0; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4783 } |
43472
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4784 else if (wParam == menu_free_timer) |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4785 { |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4786 KillTimer (hwnd, menu_free_timer); |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4787 menu_free_timer = 0; |
43484
a3cecd273126
(w32_wnd_proc) <WM_TIMER>: Fix last change.
Jason Rumney <jasonr@gnu.org>
parents:
43472
diff
changeset
|
4788 f = x_window_to_frame (dpyinfo, hwnd); |
43472
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4789 if (!f->output_data.w32->menu_command_in_progress) |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4790 { |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4791 /* Free memory used by owner-drawn and help-echo strings. */ |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4792 w32_free_menu_strings (hwnd); |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4793 f->output_data.w32->menubar_active = 0; |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4794 } |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4795 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
4796 return 0; |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4797 |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4798 case WM_NCACTIVATE: |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4799 /* 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
|
4800 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
|
4801 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
|
4802 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
|
4803 keyboard modifiers' state. */ |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4804 reset_modifiers (); |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4805 goto dflt; |
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
4806 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4807 case WM_INITMENU: |
24751
e0eaca5025bc
(w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents:
24718
diff
changeset
|
4808 button_state = 0; |
e0eaca5025bc
(w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents:
24718
diff
changeset
|
4809 ReleaseCapture (); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4810 /* 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
|
4811 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
|
4812 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
|
4813 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
|
4814 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
|
4815 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4816 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
|
4817 loop that can process all other messages. |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4818 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4819 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
|
4820 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
|
4821 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
|
4822 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
|
4823 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
|
4824 being active). */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4825 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4826 f = x_window_to_frame (dpyinfo, hwnd); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4827 if (f |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4828 && (f->output_data.w32->menubar_active |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4829 /* 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
|
4830 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
|
4831 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
|
4832 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
|
4833 had requested it to be turned off! */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4834 || f->output_data.w32->menubar_widget == NULL)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4835 return 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4836 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4837 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4838 deferred_msg msg_buf; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4839 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4840 /* 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
|
4841 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
|
4842 if (find_deferred_msg (hwnd, msg) != NULL) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4843 abort (); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4844 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4845 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
|
4846 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4847 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4848 case WM_EXITMENULOOP: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4849 f = x_window_to_frame (dpyinfo, hwnd); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4850 |
43472
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4851 /* If a menu command is not already in progress, check again |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4852 after a short delay, since Windows often (always?) sends the |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4853 WM_EXITMENULOOP before the corresponding WM_COMMAND message. */ |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4854 if (f && !f->output_data.w32->menu_command_in_progress) |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4855 menu_free_timer = SetTimer (hwnd, MENU_FREE_ID, MENU_FREE_DELAY, NULL); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4856 goto dflt; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4857 |
28272
f62bb21d38db
(w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents:
27936
diff
changeset
|
4858 case WM_MENUSELECT: |
41638
aadcf676d5de
(w32_wnd_proc) <WM_MENUSELECT>: Display help directly.
Jason Rumney <jasonr@gnu.org>
parents:
41480
diff
changeset
|
4859 /* 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
|
4860 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
|
4861 keyboard buffer. */ |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
4862 { |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
4863 HMENU menu = (HMENU) lParam; |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
4864 UINT menu_item = (UINT) LOWORD (wParam); |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
4865 UINT flags = (UINT) HIWORD (wParam); |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
4866 |
41638
aadcf676d5de
(w32_wnd_proc) <WM_MENUSELECT>: Display help directly.
Jason Rumney <jasonr@gnu.org>
parents:
41480
diff
changeset
|
4867 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
|
4868 } |
28272
f62bb21d38db
(w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents:
27936
diff
changeset
|
4869 return 0; |
f62bb21d38db
(w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents:
27936
diff
changeset
|
4870 |
21735
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4871 case WM_MEASUREITEM: |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4872 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
|
4873 if (f) |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4874 { |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4875 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
|
4876 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4877 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
|
4878 { |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4879 /* 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
|
4880 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
|
4881 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
|
4882 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
|
4883 LOGFONT menu_logfont; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4884 HFONT old_font; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4885 SIZE size; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4886 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4887 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
|
4888 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
|
4889 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
|
4890 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
|
4891 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4892 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
|
4893 if (title) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4894 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4895 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
|
4896 pMis->itemWidth = size.cx; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4897 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
|
4898 pMis->itemHeight = size.cy; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4899 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4900 else |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
4901 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
|
4902 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4903 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
|
4904 DeleteObject (menu_font); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4905 ReleaseDC (hwnd, hdc); |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4906 return TRUE; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4907 } |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4908 } |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4909 return 0; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4910 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4911 case WM_DRAWITEM: |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4912 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
|
4913 if (f) |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4914 { |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4915 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
|
4916 |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4917 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
|
4918 { |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4919 /* 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
|
4920 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
|
4921 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
|
4922 { |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4923 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
|
4924 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
|
4925 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
|
4926 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
|
4927 |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4928 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
|
4929 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
|
4930 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
|
4931 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
|
4932 |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4933 /* 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
|
4934 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
|
4935 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
|
4936 + 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
|
4937 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
|
4938 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
|
4939 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
|
4940 |
6a55bd8a85f8
(w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents:
29317
diff
changeset
|
4941 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
|
4942 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
|
4943 } |
21735
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4944 return TRUE; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4945 } |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4946 } |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4947 return 0; |
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
4948 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4949 #if 0 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4950 /* 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
|
4951 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
|
4952 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
|
4953 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
|
4954 case WM_MOUSEACTIVATE: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4955 /* 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
|
4956 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
|
4957 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
|
4958 if (LOWORD (lParam) == HTCLIENT ) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4959 return MA_ACTIVATEANDEAT; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4960 goto dflt; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4961 #endif |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4962 |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4963 case WM_MOUSELEAVE: |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4964 /* No longer tracking mouse. */ |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4965 track_mouse_window = NULL; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
4966 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4967 case WM_ACTIVATEAPP: |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4968 case WM_ACTIVATE: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4969 case WM_WINDOWPOSCHANGED: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4970 case WM_SHOWWINDOW: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4971 /* 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
|
4972 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
|
4973 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
|
4974 goto dflt; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
4975 |
14810
4dd6867765b9
(Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents:
14461
diff
changeset
|
4976 case WM_SETFOCUS: |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4977 dpyinfo->faked_key = 0; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
4978 reset_modifiers (); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4979 register_hot_keys (hwnd); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4980 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
|
4981 case WM_KILLFOCUS: |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
4982 unregister_hot_keys (hwnd); |
24751
e0eaca5025bc
(w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents:
24718
diff
changeset
|
4983 button_state = 0; |
e0eaca5025bc
(w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents:
24718
diff
changeset
|
4984 ReleaseCapture (); |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
4985 /* Relinquish the system caret. */ |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
4986 if (w32_system_caret_hwnd) |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
4987 { |
42918
9b06036a8c5e
(syms_of_w32fns): Initialize w32_visible_system_caret_hwnd.
Jason Rumney <jasonr@gnu.org>
parents:
42865
diff
changeset
|
4988 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
|
4989 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
|
4990 DestroyCaret (); |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
4991 } |
43472
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4992 goto command; |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4993 case WM_COMMAND: |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4994 f = x_window_to_frame (dpyinfo, hwnd); |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4995 if (f && HIWORD (wParam) == 0) |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4996 { |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4997 f->output_data.w32->menu_command_in_progress = 1; |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4998 if (menu_free_timer) |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
4999 { |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
5000 KillTimer (hwnd, menu_free_timer); |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
5001 menu_free_timer = 0; |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
5002 } |
7faac536665f
(mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents:
43398
diff
changeset
|
5003 } |
13434 | 5004 case WM_MOVE: |
5005 case WM_SIZE: | |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
5006 command: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5007 wmsg.dwModifiers = w32_get_modifiers (); |
13434 | 5008 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
5009 goto dflt; | |
15034
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
5010 |
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
5011 case WM_CLOSE: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5012 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
|
5013 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
|
5014 return 0; |
fb947ec168a8
(defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents:
14983
diff
changeset
|
5015 |
13434 | 5016 case WM_WINDOWPOSCHANGING: |
41448
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5017 /* 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
|
5018 if (hwnd == tip_window) |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5019 return 0; |
13434 | 5020 { |
5021 WINDOWPLACEMENT wp; | |
5022 LPWINDOWPOS lppos = (WINDOWPOS *) lParam; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5023 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5024 wp.length = sizeof (WINDOWPLACEMENT); |
13434 | 5025 GetWindowPlacement (hwnd, &wp); |
5026 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5027 if (wp.showCmd != SW_SHOWMINIMIZED && (lppos->flags & SWP_NOSIZE) == 0) |
13434 | 5028 { |
5029 RECT rect; | |
5030 int wdiff; | |
5031 int hdiff; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5032 DWORD font_width; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5033 DWORD line_height; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5034 DWORD internal_border; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5035 DWORD scrollbar_extra; |
13434 | 5036 RECT wr; |
5037 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5038 wp.length = sizeof(wp); |
13434 | 5039 GetWindowRect (hwnd, &wr); |
5040 | |
14353 | 5041 enter_crit (); |
13434 | 5042 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5043 font_width = GetWindowLong (hwnd, WND_FONTWIDTH_INDEX); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5044 line_height = GetWindowLong (hwnd, WND_LINEHEIGHT_INDEX); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5045 internal_border = GetWindowLong (hwnd, WND_BORDER_INDEX); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5046 scrollbar_extra = GetWindowLong (hwnd, WND_SCROLLBAR_INDEX); |
13434 | 5047 |
14353 | 5048 leave_crit (); |
13434 | 5049 |
5050 memset (&rect, 0, sizeof (rect)); | |
5051 AdjustWindowRect (&rect, GetWindowLong (hwnd, GWL_STYLE), | |
5052 GetMenu (hwnd) != NULL); | |
5053 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5054 /* 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
|
5055 multiples of the character cell dimensions. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5056 wdiff = (lppos->cx - (rect.right - rect.left) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5057 - 2 * internal_border - scrollbar_extra) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5058 % font_width; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5059 hdiff = (lppos->cy - (rect.bottom - rect.top) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5060 - 2 * internal_border) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5061 % line_height; |
13434 | 5062 |
5063 if (wdiff || hdiff) | |
5064 { | |
5065 /* For right/bottom sizing we can just fix the sizes. | |
5066 However for top/left sizing we will need to fix the X | |
5067 and Y positions as well. */ | |
5068 | |
5069 lppos->cx -= wdiff; | |
5070 lppos->cy -= hdiff; | |
5071 | |
5072 if (wp.showCmd != SW_SHOWMAXIMIZED | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5073 && (lppos->flags & SWP_NOMOVE) == 0) |
13434 | 5074 { |
5075 if (lppos->x != wr.left || lppos->y != wr.top) | |
5076 { | |
5077 lppos->x += wdiff; | |
5078 lppos->y += hdiff; | |
5079 } | |
5080 else | |
5081 { | |
5082 lppos->flags |= SWP_NOMOVE; | |
5083 } | |
5084 } | |
5085 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5086 return 0; |
13434 | 5087 } |
5088 } | |
5089 } | |
5090 | |
5091 goto dflt; | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5092 |
24479
3b2c3636bf0e
(w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24412
diff
changeset
|
5093 case WM_GETMINMAXINFO: |
3b2c3636bf0e
(w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24412
diff
changeset
|
5094 /* 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
|
5095 below the Minimum Tracking Size. */ |
3b2c3636bf0e
(w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24412
diff
changeset
|
5096 ((LPMINMAXINFO) lParam)->ptMinTrackSize.y++; |
36080
743534626f73
(w32_wnd_proc) <WM_GETMINMAXINFO>: Allow resizing the
Andrew Innes <andrewi@gnu.org>
parents:
36000
diff
changeset
|
5097 /* 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
|
5098 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
|
5099 ((LPMINMAXINFO) lParam)->ptMaxTrackSize.x = 32767; |
743534626f73
(w32_wnd_proc) <WM_GETMINMAXINFO>: Allow resizing the
Andrew Innes <andrewi@gnu.org>
parents:
36000
diff
changeset
|
5100 ((LPMINMAXINFO) lParam)->ptMaxTrackSize.y = 32767; |
24479
3b2c3636bf0e
(w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24412
diff
changeset
|
5101 return 0; |
3b2c3636bf0e
(w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24412
diff
changeset
|
5102 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5103 case WM_EMACS_CREATESCROLLBAR: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5104 return (LRESULT) w32_createscrollbar ((struct frame *) wParam, |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5105 (struct scroll_bar *) lParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5106 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5107 case WM_EMACS_SHOWWINDOW: |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5108 return ShowWindow ((HWND) wParam, (WPARAM) lParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5109 |
21608
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
5110 case WM_EMACS_SETFOREGROUND: |
24718
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5111 { |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5112 HWND foreground_window; |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5113 DWORD foreground_thread, retval; |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5114 |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5115 /* 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
|
5116 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
|
5117 pull the focus away from it. */ |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5118 foreground_window = GetForegroundWindow (); |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5119 foreground_thread = GetWindowThreadProcessId (foreground_window, NULL); |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5120 if (!foreground_window |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5121 || foreground_thread == GetCurrentThreadId () |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5122 || !AttachThreadInput (GetCurrentThreadId (), |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5123 foreground_thread, TRUE)) |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5124 foreground_thread = 0; |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5125 |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5126 retval = SetForegroundWindow ((HWND) wParam); |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5127 |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5128 /* Detach from the previous foreground thread. */ |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5129 if (foreground_thread) |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5130 AttachThreadInput (GetCurrentThreadId (), |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5131 foreground_thread, FALSE); |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5132 |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5133 return retval; |
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
5134 } |
21608
d191a8737145
(w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19707
diff
changeset
|
5135 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5136 case WM_EMACS_SETWINDOWPOS: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5137 { |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5138 WINDOWPOS * pos = (WINDOWPOS *) wParam; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5139 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
|
5140 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
|
5141 } |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5142 |
13434 | 5143 case WM_EMACS_DESTROYWINDOW: |
21884 | 5144 DragAcceptFiles ((HWND) wParam, FALSE); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5145 return DestroyWindow ((HWND) wParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5146 |
42865
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5147 case WM_EMACS_HIDE_CARET: |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5148 return HideCaret (hwnd); |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5149 |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5150 case WM_EMACS_SHOW_CARET: |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5151 return ShowCaret (hwnd); |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5152 |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5153 case WM_EMACS_DESTROY_CARET: |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5154 w32_system_caret_hwnd = NULL; |
42865
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5155 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
|
5156 return DestroyCaret (); |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5157 |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5158 case WM_EMACS_TRACK_CARET: |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5159 /* 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
|
5160 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
|
5161 { |
42865
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5162 /* 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
|
5163 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
|
5164 w32_system_caret_hwnd = hwnd; |
42865
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5165 CreateCaret (hwnd, NULL, 0, |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5166 w32_system_caret_height); |
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5167 } |
42865
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5168 |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5169 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
|
5170 return 0; |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5171 /* 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
|
5172 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
|
5173 && w32_visible_system_caret_hwnd != hwnd) |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5174 { |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5175 w32_visible_system_caret_hwnd = hwnd; |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5176 return ShowCaret (hwnd); |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5177 } |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5178 /* 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
|
5179 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
|
5180 && w32_visible_system_caret_hwnd) |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5181 { |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5182 w32_visible_system_caret_hwnd = NULL; |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5183 return HideCaret (hwnd); |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5184 } |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5185 else |
40d08b8571ec
(w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents:
42845
diff
changeset
|
5186 return 1; |
40385
b3dbd98f9b97
(w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents:
40120
diff
changeset
|
5187 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5188 case WM_EMACS_TRACKPOPUPMENU: |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5189 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5190 UINT flags; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5191 POINT *pos; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5192 int retval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5193 pos = (POINT *)lParam; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5194 flags = TPM_CENTERALIGN; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5195 if (button_state & LMOUSE) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5196 flags |= TPM_LEFTBUTTON; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5197 else if (button_state & RMOUSE) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5198 flags |= TPM_RIGHTBUTTON; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5199 |
21735
711a61942023
(x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
21608
diff
changeset
|
5200 /* 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
|
5201 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
|
5202 ReleaseCapture (); |
23160
95a213639589
(w32_wnd_proc): Always zero button_state when releasing
Geoff Voelker <voelker@cs.washington.edu>
parents:
22625
diff
changeset
|
5203 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
|
5204 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5205 /* 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
|
5206 TrackPopupMenu below, and should be ignored. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5207 f = x_window_to_frame (dpyinfo, hwnd); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5208 if (f) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5209 f->output_data.w32->menubar_active = 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5210 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5211 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
|
5212 0, hwnd, NULL)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5213 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5214 MSG amsg; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5215 /* Eat any mouse messages during popupmenu */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5216 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
|
5217 PM_REMOVE)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5218 /* Get the menu selection, if any */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5219 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
|
5220 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5221 retval = LOWORD (amsg.wParam); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5222 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5223 else |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5224 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5225 retval = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5226 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5227 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5228 else |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5229 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5230 retval = -1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5231 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5232 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5233 return retval; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5234 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5235 |
13434 | 5236 default: |
21874
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
5237 /* Check for messages registered at runtime. */ |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
5238 if (msg == msh_mousewheel) |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
5239 { |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
5240 wmsg.dwModifiers = w32_get_modifiers (); |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
5241 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
5242 return 0; |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
5243 } |
c0871d40073e
(msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21735
diff
changeset
|
5244 |
13434 | 5245 dflt: |
5246 return DefWindowProc (hwnd, msg, wParam, lParam); | |
5247 } | |
5248 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5249 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5250 /* 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
|
5251 return 0; |
13434 | 5252 } |
5253 | |
5254 void | |
5255 my_create_window (f) | |
5256 struct frame * f; | |
5257 { | |
5258 MSG msg; | |
5259 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5260 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
|
5261 abort (); |
13434 | 5262 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); |
5263 } | |
5264 | |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5265 |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5266 /* 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
|
5267 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
|
5268 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
|
5269 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
|
5270 void |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5271 my_create_tip_window (f) |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5272 struct frame *f; |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5273 { |
41448
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5274 RECT rect; |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5275 |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5276 rect.left = rect.top = 0; |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5277 rect.right = PIXEL_WIDTH (f); |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5278 rect.bottom = PIXEL_HEIGHT (f); |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5279 |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5280 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
|
5281 FRAME_EXTERNAL_MENU_BAR (f)); |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5282 |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5283 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
|
5284 = CreateWindow (EMACS_CLASS, |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5285 f->namebuf, |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5286 f->output_data.w32->dwStyle, |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5287 f->output_data.w32->left_pos, |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5288 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
|
5289 rect.right - rect.left, |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5290 rect.bottom - rect.top, |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5291 FRAME_W32_WINDOW (SELECTED_FRAME ()), /* owner */ |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5292 NULL, |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5293 hinst, |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5294 NULL); |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5295 |
41448
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5296 if (tip_window) |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5297 { |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5298 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
|
5299 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
|
5300 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
|
5301 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
|
5302 |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5303 /* Tip frames have no scrollbars. */ |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
5304 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
|
5305 |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5306 /* 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
|
5307 ShowWindow (tip_window, SW_HIDE); |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5308 } |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5309 } |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5310 |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
5311 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5312 /* Create and set up the w32 window for frame F. */ |
13434 | 5313 |
5314 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5315 w32_window (f, window_prompting, minibuffer_only) |
13434 | 5316 struct frame *f; |
5317 long window_prompting; | |
5318 int minibuffer_only; | |
5319 { | |
5320 BLOCK_INPUT; | |
5321 | |
5322 /* Use the resource name as the top-level window name | |
5323 for looking up resources. Make a non-Lisp copy | |
5324 for the window manager, so GC relocation won't bother it. | |
5325 | |
5326 Elsewhere we specify the window name for the window manager. */ | |
5327 | |
5328 { | |
5329 char *str = (char *) XSTRING (Vx_resource_name)->data; | |
5330 f->namebuf = (char *) xmalloc (strlen (str) + 1); | |
5331 strcpy (f->namebuf, str); | |
5332 } | |
5333 | |
5334 my_create_window (f); | |
5335 | |
5336 validate_x_resource_name (); | |
5337 | |
5338 /* x_set_name normally ignores requests to set the name if the | |
5339 requested name is the same as the current name. This is the one | |
5340 place where that assumption isn't correct; f->name is set, but | |
5341 the server hasn't been told. */ | |
5342 { | |
5343 Lisp_Object name; | |
5344 int explicit = f->explicit_name; | |
5345 | |
5346 f->explicit_name = 0; | |
5347 name = f->name; | |
5348 f->name = Qnil; | |
5349 x_set_name (f, name, explicit); | |
5350 } | |
5351 | |
5352 UNBLOCK_INPUT; | |
5353 | |
5354 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f)) | |
5355 initialize_frame_menubar (f); | |
5356 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5357 if (FRAME_W32_WINDOW (f) == 0) |
13434 | 5358 error ("Unable to create window"); |
5359 } | |
5360 | |
5361 /* Handle the icon stuff for this window. Perhaps later we might | |
5362 want an x_set_icon_position which can be called interactively as | |
5363 well. */ | |
5364 | |
5365 static void | |
5366 x_icon (f, parms) | |
5367 struct frame *f; | |
5368 Lisp_Object parms; | |
5369 { | |
5370 Lisp_Object icon_x, icon_y; | |
5371 | |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16602
diff
changeset
|
5372 /* Set the position of the icon. Note that Windows 95 groups all |
13434 | 5373 icons in the tray. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5374 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
|
5375 icon_y = w32_get_arg (parms, Qicon_top, 0, 0, RES_TYPE_NUMBER); |
13434 | 5376 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound)) |
5377 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
5378 CHECK_NUMBER (icon_x); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
5379 CHECK_NUMBER (icon_y); |
13434 | 5380 } |
5381 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) | |
5382 error ("Both left and top icon corners of icon must be specified"); | |
5383 | |
5384 BLOCK_INPUT; | |
5385 | |
5386 if (! EQ (icon_x, Qunbound)) | |
5387 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y)); | |
5388 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5389 #if 0 /* TODO */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5390 /* Start up iconic or window? */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5391 x_wm_set_window_state |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5392 (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
|
5393 ? IconicState |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5394 : NormalState)); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5395 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5396 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
|
5397 ? f->icon_name |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5398 : f->name))->data); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5399 #endif |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5400 |
13434 | 5401 UNBLOCK_INPUT; |
5402 } | |
5403 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5404 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5405 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5406 x_make_gc (f) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5407 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5408 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5409 XGCValues gc_values; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5410 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5411 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5412 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5413 /* Create the GC's of this frame. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5414 Note that many default values are used. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5415 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5416 /* Normal video */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5417 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
|
5418 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5419 /* 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
|
5420 gc_values.foreground = FRAME_BACKGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5421 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
|
5422 f->output_data.w32->cursor_gc |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5423 = XCreateGC (NULL, FRAME_W32_WINDOW (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5424 (GCFont | GCForeground | GCBackground), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5425 &gc_values); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5426 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5427 /* Reliefs. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5428 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
|
5429 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
|
5430 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5431 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5432 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5433 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5434 |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5435 /* 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
|
5436 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
|
5437 constructed. */ |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5438 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5439 static Lisp_Object |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5440 unwind_create_frame (frame) |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5441 Lisp_Object frame; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5442 { |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5443 struct frame *f = XFRAME (frame); |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5444 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5445 /* 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
|
5446 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
|
5447 { |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5448 #ifdef GLYPH_DEBUG |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5449 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
|
5450 #endif |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5451 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5452 x_free_frame_resources (f); |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5453 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5454 /* 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
|
5455 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
|
5456 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
|
5457 |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
5458 return Qt; |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5459 } |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5460 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5461 return Qnil; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5462 } |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5463 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5464 |
13434 | 5465 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, |
5466 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
|
5467 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
|
5468 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
|
5469 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
|
5470 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
|
5471 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
|
5472 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
|
5473 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
|
5474 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
5475 This function is an internal primitive--use `make-frame' instead. */) |
13434 | 5476 (parms) |
5477 Lisp_Object parms; | |
5478 { | |
5479 struct frame *f; | |
5480 Lisp_Object frame, tem; | |
5481 Lisp_Object name; | |
5482 int minibuffer_only = 0; | |
5483 long window_prompting = 0; | |
5484 int width, height; | |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
5485 int count = BINDING_STACK_SIZE (); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5486 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
13434 | 5487 Lisp_Object display; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5488 struct w32_display_info *dpyinfo = NULL; |
13434 | 5489 Lisp_Object parent; |
5490 struct kboard *kb; | |
5491 | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5492 check_w32 (); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5493 |
13434 | 5494 /* Use this general default value to start with |
5495 until we know if this frame has a specified name. */ | |
5496 Vx_resource_name = Vinvocation_name; | |
5497 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5498 display = w32_get_arg (parms, Qdisplay, 0, 0, RES_TYPE_STRING); |
13434 | 5499 if (EQ (display, Qunbound)) |
5500 display = Qnil; | |
5501 dpyinfo = check_x_display_info (display); | |
5502 #ifdef MULTI_KBOARD | |
5503 kb = dpyinfo->kboard; | |
5504 #else | |
5505 kb = &the_only_kboard; | |
5506 #endif | |
5507 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5508 name = w32_get_arg (parms, Qname, "name", "Name", RES_TYPE_STRING); |
13434 | 5509 if (!STRINGP (name) |
5510 && ! EQ (name, Qunbound) | |
5511 && ! NILP (name)) | |
5512 error ("Invalid frame name--not a string or nil"); | |
5513 | |
5514 if (STRINGP (name)) | |
5515 Vx_resource_name = name; | |
5516 | |
5517 /* See if parent window is specified. */ | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5518 parent = w32_get_arg (parms, Qparent_id, NULL, NULL, RES_TYPE_NUMBER); |
13434 | 5519 if (EQ (parent, Qunbound)) |
5520 parent = Qnil; | |
5521 if (! NILP (parent)) | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
5522 CHECK_NUMBER (parent); |
13434 | 5523 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5524 /* 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
|
5525 /* 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
|
5526 it to make_frame_without_minibuffer. */ |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5527 frame = Qnil; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5528 GCPRO4 (parms, parent, name, frame); |
32669
092d2df2a6c3
(Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents:
31110
diff
changeset
|
5529 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
|
5530 RES_TYPE_SYMBOL); |
13434 | 5531 if (EQ (tem, Qnone) || NILP (tem)) |
5532 f = make_frame_without_minibuffer (Qnil, kb, display); | |
5533 else if (EQ (tem, Qonly)) | |
5534 { | |
5535 f = make_minibuffer_frame (); | |
5536 minibuffer_only = 1; | |
5537 } | |
5538 else if (WINDOWP (tem)) | |
5539 f = make_frame_without_minibuffer (tem, kb, display); | |
5540 else | |
5541 f = make_frame (1); | |
5542 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5543 XSETFRAME (frame, f); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5544 |
13434 | 5545 /* Note that Windows does support scroll bars. */ |
5546 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
|
5547 /* 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
|
5548 f->scroll_bar_pixel_width = GetSystemMetrics (SM_CXVSCROLL); |
13434 | 5549 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5550 f->output_method = output_w32; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5551 f->output_data.w32 = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5552 (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
|
5553 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
|
5554 FRAME_FONTSET (f) = -1; |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
5555 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
|
5556 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5557 f->icon_name |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5558 = 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
|
5559 if (! STRINGP (f->icon_name)) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5560 f->icon_name = Qnil; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5561 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5562 /* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */ |
13434 | 5563 #ifdef MULTI_KBOARD |
5564 FRAME_KBOARD (f) = kb; | |
5565 #endif | |
5566 | |
5567 /* Specify the parent under which to make this window. */ | |
5568 | |
5569 if (!NILP (parent)) | |
5570 { | |
32669
092d2df2a6c3
(Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents:
31110
diff
changeset
|
5571 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
|
5572 f->output_data.w32->explicit_parent = 1; |
13434 | 5573 } |
5574 else | |
5575 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5576 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
|
5577 f->output_data.w32->explicit_parent = 0; |
13434 | 5578 } |
5579 | |
5580 /* Set the name; the functions to which we pass f expect the name to | |
5581 be set. */ | |
5582 if (EQ (name, Qunbound) || NILP (name)) | |
5583 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5584 f->name = build_string (dpyinfo->w32_id_name); |
13434 | 5585 f->explicit_name = 0; |
5586 } | |
5587 else | |
5588 { | |
5589 f->name = name; | |
5590 f->explicit_name = 1; | |
5591 /* use the frame's title when getting resources for this frame. */ | |
5592 specbind (Qx_resource_name, name); | |
5593 } | |
5594 | |
5595 /* Extract the window parameters from the supplied values | |
5596 that are needed to determine window geometry. */ | |
5597 { | |
5598 Lisp_Object font; | |
5599 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5600 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
|
5601 |
13434 | 5602 BLOCK_INPUT; |
5603 /* First, try whatever font the caller has specified. */ | |
5604 if (STRINGP (font)) | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5605 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5606 tem = Fquery_fontset (font, Qnil); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5607 if (STRINGP (tem)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5608 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
|
5609 else |
24481
f65692fe7dd5
(w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24479
diff
changeset
|
5610 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
|
5611 } |
13434 | 5612 /* Try out a font which we hope has bold and italic variations. */ |
5613 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
|
5614 font = x_new_font (f, "-*-Courier New-normal-r-*-*-*-100-*-*-c-*-iso8859-1"); |
13434 | 5615 if (! STRINGP (font)) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5616 font = x_new_font (f, "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1"); |
13434 | 5617 /* If those didn't work, look for something which will at least work. */ |
5618 if (! STRINGP (font)) | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5619 font = x_new_font (f, "-*-Fixedsys-normal-r-*-*-12-*-*-*-c-*-iso8859-1"); |
13434 | 5620 UNBLOCK_INPUT; |
5621 if (! STRINGP (font)) | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5622 font = build_string ("Fixedsys"); |
13434 | 5623 |
5624 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
|
5625 "font", "Font", RES_TYPE_STRING); |
13434 | 5626 } |
5627 | |
5628 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
|
5629 "borderWidth", "BorderWidth", RES_TYPE_NUMBER); |
13434 | 5630 /* This defaults to 2 in order to match xterm. We recognize either |
5631 internalBorderWidth or internalBorder (which is what xterm calls | |
5632 it). */ | |
5633 if (NILP (Fassq (Qinternal_border_width, parms))) | |
5634 { | |
5635 Lisp_Object value; | |
5636 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5637 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
|
5638 "internalBorder", "InternalBorder", RES_TYPE_NUMBER); |
13434 | 5639 if (! EQ (value, Qunbound)) |
5640 parms = Fcons (Fcons (Qinternal_border_width, value), | |
5641 parms); | |
5642 } | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5643 /* Default internalBorderWidth to 0 on Windows to match other programs. */ |
13434 | 5644 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
|
5645 "internalBorderWidth", "InternalBorder", RES_TYPE_NUMBER); |
092d2df2a6c3
(Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents:
31110
diff
changeset
|
5646 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
|
5647 "verticalScrollBars", "ScrollBars", RES_TYPE_SYMBOL); |
13434 | 5648 |
5649 /* Also do the stuff which must be set before the window exists. */ | |
5650 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
|
5651 "foreground", "Foreground", RES_TYPE_STRING); |
13434 | 5652 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
|
5653 "background", "Background", RES_TYPE_STRING); |
13434 | 5654 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
|
5655 "pointerColor", "Foreground", RES_TYPE_STRING); |
13434 | 5656 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
|
5657 "cursorColor", "Foreground", RES_TYPE_STRING); |
13434 | 5658 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
|
5659 "borderColor", "BorderColor", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5660 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
|
5661 "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
|
5662 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
|
5663 "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
|
5664 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
|
5665 "leftFringe", "LeftFringe", RES_TYPE_NUMBER); |
2dd41afd9b55
Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents:
41638
diff
changeset
|
5666 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
|
5667 "rightFringe", "RightFringe", RES_TYPE_NUMBER); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5668 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5669 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5670 /* 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
|
5671 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
|
5672 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
|
5673 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
|
5674 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
|
5675 happen. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5676 init_frame_faces (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5677 |
13434 | 5678 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
|
5679 "menuBar", "MenuBar", RES_TYPE_NUMBER); |
44097
e3dca9179494
(Fx_create_frame): Enable tool-bar when images are supported.
Jason Rumney <jasonr@gnu.org>
parents:
44094
diff
changeset
|
5680 x_default_parameter (f, parms, Qtool_bar_lines, make_number (1), |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5681 "toolBar", "ToolBar", RES_TYPE_NUMBER); |
44109
b615e4daf825
[HAVE_IMAGES, HAVE_PBM]: Remove conditionals.
Jason Rumney <jasonr@gnu.org>
parents:
44097
diff
changeset
|
5682 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5683 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
|
5684 "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5685 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
|
5686 "title", "Title", RES_TYPE_STRING); |
43398 | 5687 x_default_parameter (f, parms, Qfullscreen, Qnil, |
5688 "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); | |
13434 | 5689 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5690 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
|
5691 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
|
5692 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5693 /* 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
|
5694 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
|
5695 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
|
5696 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
|
5697 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
|
5698 will get. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5699 if (FRAME_TOOL_BAR_LINES (f)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5700 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5701 int margin, relief, bar_height; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5702 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
5703 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
|
5704 ? tool_bar_button_relief |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5705 : DEFAULT_TOOL_BAR_BUTTON_RELIEF); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5706 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5707 if (INTEGERP (Vtool_bar_button_margin) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5708 && XINT (Vtool_bar_button_margin) > 0) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5709 margin = XFASTINT (Vtool_bar_button_margin); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5710 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
|
5711 && INTEGERP (XCDR (Vtool_bar_button_margin)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5712 && 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
|
5713 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
|
5714 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5715 margin = 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5716 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5717 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
|
5718 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
|
5719 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
5720 |
13434 | 5721 window_prompting = x_figure_window_size (f, parms); |
5722 | |
5723 if (window_prompting & XNegative) | |
5724 { | |
5725 if (window_prompting & YNegative) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5726 f->output_data.w32->win_gravity = SouthEastGravity; |
13434 | 5727 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5728 f->output_data.w32->win_gravity = NorthEastGravity; |
13434 | 5729 } |
5730 else | |
5731 { | |
5732 if (window_prompting & YNegative) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5733 f->output_data.w32->win_gravity = SouthWestGravity; |
13434 | 5734 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5735 f->output_data.w32->win_gravity = NorthWestGravity; |
13434 | 5736 } |
5737 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5738 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
|
5739 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5740 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
|
5741 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
|
5742 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5743 w32_window (f, window_prompting, minibuffer_only); |
13434 | 5744 x_icon (f, parms); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5745 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5746 x_make_gc (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5747 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5748 /* Now consider the frame official. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5749 FRAME_W32_DISPLAY_INFO (f)->reference_count++; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5750 Vframe_list = Fcons (frame, Vframe_list); |
13434 | 5751 |
5752 /* We need to do this after creating the window, so that the | |
5753 icon-creation functions can say whose icon they're describing. */ | |
5754 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
|
5755 "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL); |
13434 | 5756 |
5757 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
|
5758 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); |
13434 | 5759 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
|
5760 "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN); |
13434 | 5761 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
|
5762 "cursorType", "CursorType", RES_TYPE_SYMBOL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5763 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
|
5764 "scrollBarWidth", "ScrollBarWidth", RES_TYPE_NUMBER); |
13434 | 5765 |
5766 /* Dimensions, especially f->height, must be done via change_frame_size. | |
5767 Change will not be effected unless different from the current | |
5768 f->height. */ | |
5769 width = f->width; | |
5770 height = f->height; | |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
5771 |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
5772 f->height = 0; |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
5773 SET_FRAME_WIDTH (f, 0); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5774 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
|
5775 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5776 /* 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
|
5777 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
|
5778 bar so that its size can be taken into account. */ |
13434 | 5779 BLOCK_INPUT; |
5780 x_wm_set_size_hint (f, window_prompting, 0); | |
5781 UNBLOCK_INPUT; | |
5782 | |
42833
4510d4d4bac4
(Fx_create_frame): Bind redisplay-dont-pause around
Jason Rumney <jasonr@gnu.org>
parents:
42719
diff
changeset
|
5783 /* 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
|
5784 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
|
5785 specbind(Qredisplay_dont_pause, Qt); |
4510d4d4bac4
(Fx_create_frame): Bind redisplay-dont-pause around
Jason Rumney <jasonr@gnu.org>
parents:
42719
diff
changeset
|
5786 |
34133
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
5787 /* 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
|
5788 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
|
5789 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
|
5790 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
|
5791 new frames. */ |
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
5792 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
|
5793 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5794 /* 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
|
5795 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
|
5796 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
|
5797 if (! f->output_data.w32->explicit_parent) |
13434 | 5798 { |
5799 Lisp_Object visibility; | |
5800 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5801 visibility = w32_get_arg (parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL); |
13434 | 5802 if (EQ (visibility, Qunbound)) |
5803 visibility = Qt; | |
5804 | |
5805 if (EQ (visibility, Qicon)) | |
5806 x_iconify_frame (f); | |
5807 else if (! NILP (visibility)) | |
5808 x_make_frame_visible (f); | |
5809 else | |
5810 /* Must have been Qnil. */ | |
5811 ; | |
5812 } | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5813 UNGCPRO; |
36594
756c28377036
(Fx_create_frame): Clear Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
36312
diff
changeset
|
5814 |
756c28377036
(Fx_create_frame): Clear Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
36312
diff
changeset
|
5815 /* 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
|
5816 and similar functions. */ |
756c28377036
(Fx_create_frame): Clear Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
36312
diff
changeset
|
5817 Vwindow_list = Qnil; |
756c28377036
(Fx_create_frame): Clear Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
36312
diff
changeset
|
5818 |
13434 | 5819 return unbind_to (count, frame); |
5820 } | |
5821 | |
5822 /* FRAME is used only to get a handle on the X display. We don't pass the | |
5823 display info directly because we're called from frame.c, which doesn't | |
5824 know about that structure. */ | |
5825 Lisp_Object | |
5826 x_get_focus_frame (frame) | |
5827 struct frame *frame; | |
5828 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5829 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (frame); |
13434 | 5830 Lisp_Object xfocus; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5831 if (! dpyinfo->w32_focus_frame) |
13434 | 5832 return Qnil; |
5833 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
5834 XSETFRAME (xfocus, dpyinfo->w32_focus_frame); |
13434 | 5835 return xfocus; |
5836 } | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5837 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5838 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
|
5839 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
|
5840 (frame) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5841 Lisp_Object frame; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5842 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5843 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
|
5844 return Qnil; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5845 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
5846 |
13434 | 5847 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5848 /* 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
|
5849 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
|
5850 { |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5851 char *charset, *encoding; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5852 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5853 encoding = strrchr(fontname, '-'); |
34284
3a21ff35392b
(xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents:
34133
diff
changeset
|
5854 if (!encoding || encoding == fontname) |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5855 return NULL; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5856 |
34314
8318a4ea6764
(xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents:
34284
diff
changeset
|
5857 for (charset = encoding - 1; charset >= fontname; charset--) |
8318a4ea6764
(xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents:
34284
diff
changeset
|
5858 if (*charset == '-') |
8318a4ea6764
(xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents:
34284
diff
changeset
|
5859 break; |
8318a4ea6764
(xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents:
34284
diff
changeset
|
5860 |
8318a4ea6764
(xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents:
34284
diff
changeset
|
5861 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
|
5862 return NULL; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5863 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5864 return charset + 1; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5865 } |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5866 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5867 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
|
5868 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
|
5869 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
|
5870 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
|
5871 char * charset); |
6bc1c4d4eb50
(w32_to_x_font): Change prototype to fit the declaration.
Eli Zaretskii <eliz@gnu.org>
parents:
36594
diff
changeset
|
5872 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
|
5873 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
5874 static struct font_info * |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5875 w32_load_system_font (f,fontname,size) |
24670 | 5876 struct frame *f; |
5877 char * fontname; | |
5878 int size; | |
13434 | 5879 { |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5880 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
|
5881 Lisp_Object font_names; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5882 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5883 /* 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
|
5884 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
|
5885 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
|
5886 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
|
5887 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5888 if (!NILP (font_names)) |
14353 | 5889 { |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5890 Lisp_Object tail; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5891 int i; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5892 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5893 /* 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
|
5894 than loading another one. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5895 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
|
5896 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
|
5897 if (dpyinfo->font_table[i].name |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5898 && (!strcmp (dpyinfo->font_table[i].name, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5899 XSTRING (XCAR (tail))->data) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5900 || !strcmp (dpyinfo->font_table[i].full_name, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5901 XSTRING (XCAR (tail))->data))) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5902 return (dpyinfo->font_table + i); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5903 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
5904 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
|
5905 } |
24481
f65692fe7dd5
(w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24479
diff
changeset
|
5906 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
|
5907 { |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5908 /* 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
|
5909 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
|
5910 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
|
5911 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
|
5912 listed or not. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5913 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
|
5914 FARPROC enum_font_families_ex |
24481
f65692fe7dd5
(w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24479
diff
changeset
|
5915 = 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
|
5916 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
|
5917 return NULL; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
5918 } |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5919 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5920 /* 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
|
5921 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
5922 char *full_name, *encoding, *charset; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5923 XFontStruct *font; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5924 struct font_info *fontp; |
14353 | 5925 LOGFONT lf; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5926 BOOL ok; |
40009
f6ecf530f0a3
(w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
5927 int codepage; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5928 int i; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5929 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5930 if (!fontname || !x_to_w32_font (fontname, &lf)) |
14353 | 5931 return (NULL); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5932 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5933 if (!*lf.lfFaceName) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5934 /* 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
|
5935 from CreateFontIndirect - this is not particularly |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5936 desirable, especially since CreateFontIndirect does not |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5937 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
|
5938 ended up with. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5939 return NULL; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
5940 |
43210
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
5941 /* Specify anti-aliasing to prevent Cleartype fonts being used, |
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
5942 since those fonts leave garbage behind. */ |
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
5943 lf.lfQuality = ANTIALIASED_QUALITY; |
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
5944 |
14353 | 5945 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
|
5946 bzero (font, sizeof (*font)); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5947 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
5948 /* 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
|
5949 font->bdf = NULL; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5950 |
14353 | 5951 BLOCK_INPUT; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5952 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5953 font->hfont = CreateFontIndirect (&lf); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
5954 |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5955 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
|
5956 { |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5957 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
|
5958 } |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5959 else |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5960 { |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5961 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
|
5962 HANDLE oldobj; |
40009
f6ecf530f0a3
(w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
5963 |
f6ecf530f0a3
(w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
5964 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
|
5965 |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5966 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
|
5967 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
|
5968 |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5969 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
|
5970 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
|
5971 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
|
5972 else |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5973 { |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5974 /* 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
|
5975 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
|
5976 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
|
5977 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
|
5978 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
|
5979 working from anyway. */ |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5980 /* 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
|
5981 CPINFO cpi = {0}; |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5982 GetCPInfo (codepage, &cpi); |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
5983 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
|
5984 } |
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
|
5985 |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
5986 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
|
5987 ReleaseDC (dpyinfo->root_window, hdc); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5988 /* 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
|
5989 actually loaded. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5990 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
|
5991 lf.lfWidth = font->tm.tmAveCharWidth; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5992 lf.lfWeight = font->tm.tmWeight; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5993 lf.lfItalic = font->tm.tmItalic; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5994 lf.lfCharSet = font->tm.tmCharSet; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5995 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
|
5996 ? VARIABLE_PITCH : FIXED_PITCH); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5997 lf.lfOutPrecision = ((font->tm.tmPitchAndFamily & TMPF_VECTOR) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
5998 ? 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
|
5999 |
0574ffc14f77
(w32_load_system_font): Call w32_cache_char_metrics.
Andrew Innes <andrewi@gnu.org>
parents:
32669
diff
changeset
|
6000 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
|
6001 } |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
6002 |
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
6003 UNBLOCK_INPUT; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6004 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6005 if (!ok) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6006 { |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
6007 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
|
6008 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
|
6009 } |
13434 | 6010 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6011 /* 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
|
6012 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
|
6013 if (dpyinfo->font_table[i].name == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6014 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6015 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6016 /* 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
|
6017 if (i == dpyinfo->n_fonts |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6018 && 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
|
6019 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6020 int sz; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6021 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
|
6022 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
|
6023 dpyinfo->font_table |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6024 = (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
|
6025 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6026 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6027 fontp = dpyinfo->font_table + i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6028 if (i == dpyinfo->n_fonts) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6029 ++dpyinfo->n_fonts; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6030 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6031 /* 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
|
6032 BLOCK_INPUT; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6033 fontp->font = font; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6034 fontp->font_idx = i; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6035 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
|
6036 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
|
6037 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6038 charset = xlfd_charset_of_font (fontname); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6039 |
40009
f6ecf530f0a3
(w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
6040 /* 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
|
6041 (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
|
6042 fontp->codepage = codepage; |
f6ecf530f0a3
(w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents:
39973
diff
changeset
|
6043 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6044 /* 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
|
6045 full_name = (char *)xmalloc (100); |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6046 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
|
6047 fontp->full_name = full_name; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6048 else |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6049 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6050 /* If 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
|
6051 xfree (full_name); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6052 fontp->full_name = fontp->name; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6053 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6054 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6055 fontp->size = FONT_WIDTH (font); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6056 fontp->height = FONT_HEIGHT (font); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6057 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6058 /* 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
|
6059 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
|
6060 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
|
6061 (0:0x20..0x7F, 1:0xA0..0xFF, |
f62bb21d38db
(w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents:
27936
diff
changeset
|
6062 (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
|
6063 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
|
6064 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
|
6065 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
|
6066 decided, set FONT_ENCODING_NOT_DECIDED. */ |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6067 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6068 /* 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
|
6069 type FONT_ENCODING_NOT_DECIDED. */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6070 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
|
6071 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
|
6072 fontp->encoding[1] = 4; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6073 else |
24692
a0a2521b783d
(x_to_w32_charset): Fix typo: want to map all Japanese
Andrew Innes <andrewi@gnu.org>
parents:
24679
diff
changeset
|
6074 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
|
6075 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6076 /* 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
|
6077 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
|
6078 fontp->baseline_offset = 0; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6079 fontp->relative_compose = 0; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6080 fontp->default_ascent = 0; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6081 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6082 /* 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
|
6083 has a character with a smaller width than any other character |
43398 | 6084 before, or if the font loaded has a smaller height than any |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6085 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
|
6086 glyph matrix reallocation necessary. */ |
43398 | 6087 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
|
6088 UNBLOCK_INPUT; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6089 return fontp; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6090 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6091 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6092 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6093 /* 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
|
6094 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
|
6095 If loading fails, return NULL. */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6096 struct font_info * |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6097 w32_load_font (f,fontname,size) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6098 struct frame *f; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6099 char * fontname; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6100 int size; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6101 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6102 Lisp_Object bdf_fonts; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6103 struct font_info *retval = NULL; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6104 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6105 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
|
6106 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6107 while (!retval && CONSP (bdf_fonts)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6108 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6109 char *bdf_name, *bdf_file; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6110 Lisp_Object bdf_pair; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6111 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
6112 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
|
6113 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
|
6114 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
|
6115 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6116 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
|
6117 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
6118 bdf_fonts = XCDR (bdf_fonts); |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6119 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6120 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6121 if (retval) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6122 return retval; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6123 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6124 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
|
6125 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6126 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6127 |
13434 | 6128 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6129 w32_unload_font (dpyinfo, font) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6130 struct w32_display_info *dpyinfo; |
13434 | 6131 XFontStruct * font; |
6132 { | |
6133 if (font) | |
6134 { | |
32721
0574ffc14f77
(w32_load_system_font): Call w32_cache_char_metrics.
Andrew Innes <andrewi@gnu.org>
parents:
32669
diff
changeset
|
6135 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
|
6136 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
|
6137 |
14353 | 6138 if (font->hfont) DeleteObject(font->hfont); |
13434 | 6139 xfree (font); |
6140 } | |
6141 } | |
6142 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6143 /* The font conversion stuff between x and w32 */ |
13434 | 6144 |
6145 /* X font string is as follows (from faces.el) | |
6146 * (let ((- "[-?]") | |
6147 * (foundry "[^-]+") | |
6148 * (family "[^-]+") | |
6149 * (weight "\\(bold\\|demibold\\|medium\\)") ; 1 | |
6150 * (weight\? "\\([^-]*\\)") ; 1 | |
6151 * (slant "\\([ior]\\)") ; 2 | |
6152 * (slant\? "\\([^-]?\\)") ; 2 | |
6153 * (swidth "\\([^-]*\\)") ; 3 | |
6154 * (adstyle "[^-]*") ; 4 | |
6155 * (pixelsize "[0-9]+") | |
6156 * (pointsize "[0-9][0-9]+") | |
6157 * (resx "[0-9][0-9]+") | |
6158 * (resy "[0-9][0-9]+") | |
6159 * (spacing "[cmp?*]") | |
6160 * (avgwidth "[0-9]+") | |
6161 * (registry "[^-]+") | |
6162 * (encoding "[^-]+") | |
6163 * ) | |
6164 */ | |
6165 | |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6166 static LONG |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6167 x_to_w32_weight (lpw) |
13434 | 6168 char * lpw; |
6169 { | |
6170 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
|
6171 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6172 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
|
6173 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
|
6174 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
|
6175 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
|
6176 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
|
6177 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
|
6178 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
|
6179 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
|
6180 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
|
6181 else if (stricmp (lpw,"thin") == 0) return FW_THIN; |
13434 | 6182 else |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6183 return FW_DONTCARE; |
13434 | 6184 } |
6185 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6186 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6187 static char * |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6188 w32_to_x_weight (fnweight) |
13434 | 6189 int fnweight; |
6190 { | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6191 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
|
6192 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
|
6193 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
|
6194 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
|
6195 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
|
6196 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
|
6197 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
|
6198 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
|
6199 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
|
6200 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6201 return "*"; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6202 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6203 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6204 static LONG |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6205 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
|
6206 char * lpcs; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6207 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6208 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
|
6209 char *charset; |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6210 int len = strlen (lpcs); |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6211 |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6212 /* Support "*-#nnn" format for unknown charsets. */ |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6213 if (strncmp (lpcs, "*-#", 3) == 0) |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6214 return atoi (lpcs + 3); |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6215 |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6216 /* 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
|
6217 charset = alloca (len + 1); |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6218 strcpy (charset, lpcs); |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6219 lpcs = strchr (charset, '*'); |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6220 if (lpcs) |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6221 *lpcs = 0; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6222 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6223 /* 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
|
6224 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
|
6225 (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
|
6226 */ |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6227 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
|
6228 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6229 if (NILP(this_entry)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6230 { |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6231 /* 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
|
6232 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
|
6233 return ANSI_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6234 else |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6235 return DEFAULT_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6236 } |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6237 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6238 w32_charset = Fcar (Fcdr (this_entry)); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6239 |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6240 /* Translate Lisp symbol to number. */ |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6241 if (w32_charset == Qw32_charset_ansi) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6242 return ANSI_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6243 if (w32_charset == Qw32_charset_symbol) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6244 return SYMBOL_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6245 if (w32_charset == Qw32_charset_shiftjis) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6246 return SHIFTJIS_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6247 if (w32_charset == Qw32_charset_hangeul) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6248 return HANGEUL_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6249 if (w32_charset == Qw32_charset_chinesebig5) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6250 return CHINESEBIG5_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6251 if (w32_charset == Qw32_charset_gb2312) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6252 return GB2312_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6253 if (w32_charset == Qw32_charset_oem) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6254 return OEM_CHARSET; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6255 #ifdef JOHAB_CHARSET |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6256 if (w32_charset == Qw32_charset_johab) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6257 return JOHAB_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6258 if (w32_charset == Qw32_charset_easteurope) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6259 return EASTEUROPE_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6260 if (w32_charset == Qw32_charset_turkish) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6261 return TURKISH_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6262 if (w32_charset == Qw32_charset_baltic) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6263 return BALTIC_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6264 if (w32_charset == Qw32_charset_russian) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6265 return RUSSIAN_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6266 if (w32_charset == Qw32_charset_arabic) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6267 return ARABIC_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6268 if (w32_charset == Qw32_charset_greek) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6269 return GREEK_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6270 if (w32_charset == Qw32_charset_hebrew) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6271 return HEBREW_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6272 if (w32_charset == Qw32_charset_vietnamese) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6273 return VIETNAMESE_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6274 if (w32_charset == Qw32_charset_thai) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6275 return THAI_CHARSET; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6276 if (w32_charset == Qw32_charset_mac) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6277 return MAC_CHARSET; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6278 #endif /* JOHAB_CHARSET */ |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6279 #ifdef UNICODE_CHARSET |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6280 if (w32_charset == Qw32_charset_unicode) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6281 return UNICODE_CHARSET; |
24718
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
6282 #endif |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6283 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6284 return DEFAULT_CHARSET; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6285 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6286 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6287 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6288 static char * |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6289 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
|
6290 int fncharset; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6291 { |
40528
7fb50bbb61ad
(w32_to_x_charset): Increase size of XLFD charset buffer.
Jason Rumney <jasonr@gnu.org>
parents:
40385
diff
changeset
|
6292 static char buf[32]; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6293 Lisp_Object charset_type; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6294 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6295 switch (fncharset) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6296 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6297 case ANSI_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6298 /* 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
|
6299 being set up yet. */ |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6300 if (NILP(Vw32_charset_info_alist)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6301 return "iso8859-1"; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6302 charset_type = Qw32_charset_ansi; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6303 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6304 case DEFAULT_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6305 charset_type = Qw32_charset_default; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6306 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6307 case SYMBOL_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6308 charset_type = Qw32_charset_symbol; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6309 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6310 case SHIFTJIS_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6311 charset_type = Qw32_charset_shiftjis; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6312 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6313 case HANGEUL_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6314 charset_type = Qw32_charset_hangeul; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6315 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6316 case GB2312_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6317 charset_type = Qw32_charset_gb2312; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6318 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6319 case CHINESEBIG5_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6320 charset_type = Qw32_charset_chinesebig5; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6321 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6322 case OEM_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6323 charset_type = Qw32_charset_oem; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6324 break; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6325 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6326 /* 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
|
6327 character sets. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6328 #ifdef EASTEUROPE_CHARSET |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6329 case EASTEUROPE_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6330 charset_type = Qw32_charset_easteurope; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6331 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6332 case TURKISH_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6333 charset_type = Qw32_charset_turkish; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6334 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6335 case BALTIC_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6336 charset_type = Qw32_charset_baltic; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6337 break; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6338 case RUSSIAN_CHARSET: |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6339 charset_type = Qw32_charset_russian; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6340 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6341 case ARABIC_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6342 charset_type = Qw32_charset_arabic; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6343 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6344 case GREEK_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6345 charset_type = Qw32_charset_greek; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6346 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6347 case HEBREW_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6348 charset_type = Qw32_charset_hebrew; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6349 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6350 case VIETNAMESE_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6351 charset_type = Qw32_charset_vietnamese; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6352 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6353 case THAI_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6354 charset_type = Qw32_charset_thai; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6355 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6356 case MAC_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6357 charset_type = Qw32_charset_mac; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6358 break; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6359 case JOHAB_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6360 charset_type = Qw32_charset_johab; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6361 break; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6362 #endif |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6363 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6364 #ifdef UNICODE_CHARSET |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6365 case UNICODE_CHARSET: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6366 charset_type = Qw32_charset_unicode; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6367 break; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6368 #endif |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6369 default: |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6370 /* Encode numerical value of unknown charset. */ |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6371 sprintf (buf, "*-#%u", fncharset); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6372 return buf; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6373 } |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6374 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6375 { |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6376 Lisp_Object rest; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6377 char * best_match = NULL; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6378 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6379 /* 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
|
6380 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
|
6381 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
|
6382 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6383 Format of each entry is |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6384 (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE)). |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6385 */ |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6386 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
|
6387 { |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6388 char * x_charset; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6389 Lisp_Object w32_charset; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6390 Lisp_Object codepage; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6391 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6392 Lisp_Object this_entry = XCAR (rest); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6393 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6394 /* Skip invalid entries in alist. */ |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6395 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
|
6396 || !CONSP (XCDR (this_entry)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6397 || !SYMBOLP (XCAR (XCDR (this_entry)))) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6398 continue; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6399 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6400 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
|
6401 w32_charset = XCAR (XCDR (this_entry)); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6402 codepage = XCDR (XCDR (this_entry)); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6403 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6404 /* 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
|
6405 which means ignore). */ |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6406 if (w32_charset == charset_type |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6407 && (!INTEGERP (codepage) || codepage == CP_DEFAULT |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6408 || IsValidCodePage (XINT (codepage)))) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6409 { |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6410 /* 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
|
6411 best. */ |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6412 if (!best_match) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6413 best_match = x_charset; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6414 /* 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
|
6415 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
|
6416 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
|
6417 && 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
|
6418 best_match = x_charset; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6419 /* 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
|
6420 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
|
6421 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
|
6422 && 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
|
6423 { |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6424 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
|
6425 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
|
6426 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
|
6427 best_match = x_charset; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6428 } |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6429 } |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6430 } |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6431 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6432 /* 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
|
6433 if (!best_match) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6434 { |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6435 sprintf (buf, "*-#%u", fncharset); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6436 return buf; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6437 } |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6438 |
40528
7fb50bbb61ad
(w32_to_x_charset): Increase size of XLFD charset buffer.
Jason Rumney <jasonr@gnu.org>
parents:
40385
diff
changeset
|
6439 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
|
6440 buf[31] = '\0'; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6441 return buf; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6442 } |
13434 | 6443 } |
6444 | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6445 |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6446 /* 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
|
6447 static Lisp_Object |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6448 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
|
6449 int fncharset; |
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 static char buf[32]; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6452 Lisp_Object charset_type; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6453 Lisp_Object retval = Qnil; |
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 switch (fncharset) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6456 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6457 case ANSI_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6458 /* 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
|
6459 being set up yet. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6460 if (NILP(Vw32_charset_info_alist)) |
43963
f5a7ee0b1b0e
(w32_to_all_x_charsets): Return correct type in startup case.
Jason Rumney <jasonr@gnu.org>
parents:
43773
diff
changeset
|
6461 return Fcons (build_string ("iso8859-1"), Qnil); |
f5a7ee0b1b0e
(w32_to_all_x_charsets): Return correct type in startup case.
Jason Rumney <jasonr@gnu.org>
parents:
43773
diff
changeset
|
6462 |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6463 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
|
6464 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6465 case DEFAULT_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6466 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
|
6467 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6468 case SYMBOL_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6469 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
|
6470 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6471 case SHIFTJIS_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6472 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
|
6473 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6474 case HANGEUL_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6475 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
|
6476 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6477 case GB2312_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6478 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
|
6479 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6480 case CHINESEBIG5_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6481 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
|
6482 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6483 case OEM_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6484 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
|
6485 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6486 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6487 /* 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
|
6488 character sets. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6489 #ifdef EASTEUROPE_CHARSET |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6490 case EASTEUROPE_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6491 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
|
6492 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6493 case TURKISH_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6494 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
|
6495 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6496 case BALTIC_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6497 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
|
6498 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6499 case RUSSIAN_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6500 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
|
6501 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6502 case ARABIC_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6503 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
|
6504 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6505 case GREEK_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6506 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
|
6507 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6508 case HEBREW_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6509 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
|
6510 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6511 case VIETNAMESE_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6512 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
|
6513 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6514 case THAI_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6515 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
|
6516 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6517 case MAC_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6518 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
|
6519 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6520 case JOHAB_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6521 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
|
6522 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6523 #endif |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6524 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6525 #ifdef UNICODE_CHARSET |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6526 case UNICODE_CHARSET: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6527 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
|
6528 break; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6529 #endif |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6530 default: |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6531 /* 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
|
6532 sprintf (buf, "*-#%u", fncharset); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6533 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
|
6534 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6535 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6536 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6537 Lisp_Object rest; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6538 /* 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
|
6539 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
|
6540 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6541 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
|
6542 (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
|
6543 */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6544 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
|
6545 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6546 Lisp_Object x_charset; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6547 Lisp_Object w32_charset; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6548 Lisp_Object codepage; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6549 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6550 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
|
6551 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6552 /* 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
|
6553 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
|
6554 || !CONSP (XCDR (this_entry)) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6555 || !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
|
6556 continue; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6557 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6558 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
|
6559 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
|
6560 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
|
6561 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6562 /* 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
|
6563 which means ignore). */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6564 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
|
6565 && (!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
|
6566 || IsValidCodePage (XINT (codepage)))) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6567 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6568 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
|
6569 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6570 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6571 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6572 /* 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
|
6573 if (NILP (retval)) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6574 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6575 sprintf (buf, "*-#%u", fncharset); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6576 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
|
6577 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6578 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6579 return retval; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6580 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6581 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
6582 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6583 /* 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
|
6584 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
|
6585 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
|
6586 int |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6587 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
|
6588 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6589 Lisp_Object codepage, entry; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6590 char *charset_str, *charset, *end; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6591 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6592 if (NILP (Vw32_charset_info_alist)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6593 return CP_DEFAULT; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6594 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6595 /* 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
|
6596 charset = xlfd_charset_of_font (fontname); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6597 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6598 if (!charset) |
34284
3a21ff35392b
(xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents:
34133
diff
changeset
|
6599 return CP_UNKNOWN; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6600 |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6601 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
|
6602 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
|
6603 |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6604 #if 0 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6605 /* Remove leading "*-". */ |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6606 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
|
6607 charset = charset_str + 2; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6608 else |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6609 #endif |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6610 charset = charset_str; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6611 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6612 /* 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
|
6613 if (end = strchr (charset, '*')) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6614 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6615 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
|
6616 end--; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6617 *end = '\0'; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6618 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6619 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6620 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
|
6621 if (NILP (entry)) |
34284
3a21ff35392b
(xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents:
34133
diff
changeset
|
6622 return CP_UNKNOWN; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6623 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6624 codepage = Fcdr (Fcdr (entry)); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6625 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6626 if (NILP (codepage)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6627 return CP_8BIT; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6628 else if (XFASTINT (codepage) == XFASTINT (Qt)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6629 return CP_UNICODE; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6630 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
|
6631 return XINT (codepage); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6632 else |
34284
3a21ff35392b
(xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents:
34133
diff
changeset
|
6633 return CP_UNKNOWN; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6634 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6635 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
6636 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6637 static BOOL |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6638 w32_to_x_font (lplogfont, lpxstr, len, specific_charset) |
13434 | 6639 LOGFONT * lplogfont; |
6640 char * lpxstr; | |
6641 int len; | |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6642 char * specific_charset; |
13434 | 6643 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6644 char* fonttype; |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6645 char *fontname; |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6646 char height_pixels[8]; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6647 char height_dpi[8]; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6648 char width_pixels[8]; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6649 char *fontname_dash; |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
6650 int display_resy = (int) one_w32_display_info.resy; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
6651 int display_resx = (int) 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
|
6652 int bufsz; |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6653 struct coding_system coding; |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6654 |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6655 if (!lpxstr) abort (); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6656 |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6657 if (!lplogfont) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6658 return FALSE; |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6659 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6660 if (lplogfont->lfOutPrecision == OUT_STRING_PRECIS) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6661 fonttype = "raster"; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6662 else if (lplogfont->lfOutPrecision == OUT_STROKE_PRECIS) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6663 fonttype = "outline"; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6664 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6665 fonttype = "unknown"; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6666 |
41322
482c520b29ba
(Vw32_system_coding_system): Remove.
Jason Rumney <jasonr@gnu.org>
parents:
41250
diff
changeset
|
6667 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
|
6668 &coding); |
29021
be2769eac1a5
(w32_to_x_font): Setup members src_multibyte and
Kenichi Handa <handa@m17n.org>
parents:
28983
diff
changeset
|
6669 coding.src_multibyte = 0; |
be2769eac1a5
(w32_to_x_font): Setup members src_multibyte and
Kenichi Handa <handa@m17n.org>
parents:
28983
diff
changeset
|
6670 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
|
6671 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
|
6672 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
|
6673 |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6674 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
|
6675 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
|
6676 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
|
6677 *(fontname + coding.produced) = '\0'; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6678 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6679 /* 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
|
6680 misinterpreted. */ |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6681 fontname_dash = fontname; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6682 while (fontname_dash = strchr (fontname_dash, '-')) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6683 *fontname_dash = '_'; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6684 |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6685 if (lplogfont->lfHeight) |
13434 | 6686 { |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6687 sprintf (height_pixels, "%u", abs (lplogfont->lfHeight)); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6688 sprintf (height_dpi, "%u", |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6689 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
|
6690 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6691 else |
13434 | 6692 { |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6693 strcpy (height_pixels, "*"); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6694 strcpy (height_dpi, "*"); |
13434 | 6695 } |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6696 if (lplogfont->lfWidth) |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6697 sprintf (width_pixels, "%u", lplogfont->lfWidth * 10); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6698 else |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6699 strcpy (width_pixels, "*"); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6700 |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6701 _snprintf (lpxstr, len - 1, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6702 "-%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
|
6703 fonttype, /* foundry */ |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6704 fontname, /* family */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6705 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
|
6706 lplogfont->lfItalic?'i':'r', /* slant */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6707 /* setwidth name */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6708 /* add style name */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6709 height_pixels, /* pixel size */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6710 height_dpi, /* point size */ |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6711 display_resx, /* resx */ |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6712 display_resy, /* resy */ |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6713 ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6714 ? 'p' : 'c', /* spacing */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6715 width_pixels, /* avg width */ |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6716 specific_charset ? specific_charset |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6717 : w32_to_x_charset (lplogfont->lfCharSet) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6718 /* charset registry and encoding */ |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6719 ); |
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
6720 |
13434 | 6721 lpxstr[len - 1] = 0; /* just to be sure */ |
6722 return (TRUE); | |
6723 } | |
6724 | |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6725 static BOOL |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6726 x_to_w32_font (lpxstr, lplogfont) |
13434 | 6727 char * lpxstr; |
6728 LOGFONT * lplogfont; | |
6729 { | |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6730 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
|
6731 |
13434 | 6732 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
|
6733 |
13434 | 6734 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
|
6735 |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
6736 /* 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
|
6737 #if 1 |
13434 | 6738 lplogfont->lfOutPrecision = OUT_DEFAULT_PRECIS; |
6739 lplogfont->lfClipPrecision = CLIP_DEFAULT_PRECIS; | |
6740 lplogfont->lfQuality = DEFAULT_QUALITY; | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6741 #else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6742 /* go for maximum quality */ |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6743 lplogfont->lfOutPrecision = OUT_STROKE_PRECIS; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6744 lplogfont->lfClipPrecision = CLIP_STROKE_PRECIS; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6745 lplogfont->lfQuality = PROOF_QUALITY; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6746 #endif |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6747 |
23620
2b55b8f8cdc1
(x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents:
23558
diff
changeset
|
6748 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
|
6749 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
|
6750 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
|
6751 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6752 if (!lpxstr) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6753 return FALSE; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6754 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6755 /* 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
|
6756 * 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
|
6757 * format: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6758 * "<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
|
6759 */ |
13434 | 6760 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6761 if (*lpxstr == '-') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6762 { |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6763 int fields, tem; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6764 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
|
6765 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
|
6766 char * encoding; |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
6767 int dpi = (int) 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
|
6768 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6769 fields = sscanf (lpxstr, |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6770 "-%*[^-]-%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
|
6771 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
|
6772 if (fields == EOF) |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6773 return (FALSE); |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6774 |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6775 /* 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
|
6776 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
|
6777 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
|
6778 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
|
6779 "-raster-6x10-*-gb2312*-*" |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6780 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
|
6781 if (fields == 3) |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6782 { |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6783 fields = sscanf (lpxstr, |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6784 "-%*[^-]-%49[^-]-*-%49s", |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6785 name, remainder); |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6786 } |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6787 else if (fields < 9) |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6788 { |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6789 fields = 0; |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6790 remainder[0] = 0; |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6791 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6792 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6793 if (fields > 0 && name[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6794 { |
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
|
6795 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
|
6796 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
|
6797 |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
6798 setup_coding_system |
41322
482c520b29ba
(Vw32_system_coding_system): Remove.
Jason Rumney <jasonr@gnu.org>
parents:
41250
diff
changeset
|
6799 (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
|
6800 coding.src_multibyte = 1; |
be2769eac1a5
(w32_to_x_font): Setup members src_multibyte and
Kenichi Handa <handa@m17n.org>
parents:
28983
diff
changeset
|
6801 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
|
6802 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
|
6803 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
|
6804 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
|
6805 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
|
6806 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
|
6807 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
|
6808 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
|
6809 strcpy (lplogfont->lfFaceName, buf); |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6810 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6811 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6812 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6813 lplogfont->lfFaceName[0] = '\0'; |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6814 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6815 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6816 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6817 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6818 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
|
6819 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6820 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6821 |
33879
9bbea0dda9cd
(x_to_w32_font): Do not filter out italic fonts, as new
Jason Rumney <jasonr@gnu.org>
parents:
33870
diff
changeset
|
6822 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
|
6823 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6824 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6825 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6826 if (fields > 0 && pixels[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6827 lplogfont->lfHeight = atoi (pixels); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6828 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6829 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6830 fields--; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6831 if (fields > 0 && resy[0] != '*') |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6832 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6833 tem = atoi (resy); |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6834 if (tem > 0) dpi = tem; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6835 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6836 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6837 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
|
6838 lplogfont->lfHeight = atoi (height) * dpi / 720; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6839 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
6840 if (fields > 0) |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6841 lplogfont->lfPitchAndFamily = |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6842 (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
|
6843 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6844 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6845 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6846 if (fields > 0 && width[0] != '*') |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6847 lplogfont->lfWidth = atoi (width) / 10; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6848 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6849 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6850 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
6851 /* 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
|
6852 fails the test against xlfd-tight-regexp in fontset.el). */ |
14353 | 6853 { |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6854 int len = strlen (remainder); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6855 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
|
6856 remainder[len-1] = 0; |
13434 | 6857 } |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6858 encoding = remainder; |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6859 #if 0 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6860 if (strncmp (encoding, "*-", 2) == 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6861 encoding += 2; |
39548
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6862 #endif |
6192be048459
(x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents:
39137
diff
changeset
|
6863 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
|
6864 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6865 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6866 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6867 int fields; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6868 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
|
6869 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6870 fields = sscanf (lpxstr, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6871 "%99[^:]:%9[^:]:%9[^:]:%19s", |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6872 name, height, width, weight); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6873 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6874 if (fields == EOF) return (FALSE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6875 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6876 if (fields > 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6877 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6878 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
|
6879 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
|
6880 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6881 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6882 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6883 lplogfont->lfFaceName[0] = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6884 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6885 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6886 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6887 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6888 if (fields > 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6889 lplogfont->lfHeight = atoi (height); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6890 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6891 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6892 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6893 if (fields > 0) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6894 lplogfont->lfWidth = atoi (width); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6895 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6896 fields--; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6897 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
6898 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
|
6899 } |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6900 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
6901 /* 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
|
6902 lplogfont->lfHeight = - abs (lplogfont->lfHeight); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
6903 |
13434 | 6904 return (TRUE); |
6905 } | |
6906 | |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6907 /* 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
|
6908 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
|
6909 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
|
6910 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
|
6911 */ |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6912 static int |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6913 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
|
6914 { |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
6915 int pixel_height, field_number; |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6916 char *read_from, *write_to; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6917 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6918 xassert (fontname); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6919 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6920 pixel_height = field_number = 0; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6921 write_to = NULL; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6922 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6923 /* Look for height fields. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6924 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
|
6925 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6926 if (*read_from == '-') |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6927 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6928 field_number++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6929 if (field_number == 7) /* Pixel height. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6930 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6931 read_from++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6932 write_to = read_from; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6933 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6934 /* Find end of field. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6935 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
|
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 /* 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
|
6939 if (*read_from) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6940 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6941 *read_from = '\0'; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6942 read_from++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6943 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6944 pixel_height = atoi (write_to); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6945 /* Blank out field. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6946 if (read_from > write_to) |
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 *write_to = '-'; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6949 write_to++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6950 } |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
6951 /* 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
|
6952 return now. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6953 else |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6954 return pixel_height; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6955 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6956 /* 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
|
6957 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
|
6958 if (pixel_height) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6959 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6960 /* Find end of point size field. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6961 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
|
6962 ; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6963 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6964 if (*read_from) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6965 read_from++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6966 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6967 /* Blank out the point size field. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6968 if (read_from > write_to) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6969 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6970 *write_to = '-'; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6971 write_to++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6972 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6973 else |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6974 return pixel_height; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6975 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6976 break; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6977 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6978 /* 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
|
6979 if (*read_from == '-') |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6980 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6981 read_from++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6982 break; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6983 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6984 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6985 else if (field_number == 8) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6986 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6987 /* 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
|
6988 height and convert that. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6989 int point_size; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6990 char *point_size_start = read_from++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6991 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6992 /* Find end of field. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6993 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
|
6994 ; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6995 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6996 if (*read_from) |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6997 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6998 *read_from = '\0'; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
6999 read_from++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7000 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7001 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7002 point_size = atoi (point_size_start); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7003 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7004 /* Convert to pixel height. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7005 pixel_height = point_size |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7006 * 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
|
7007 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7008 /* Blank out this field and break. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7009 *write_to = '-'; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7010 write_to++; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7011 break; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7012 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7013 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7014 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7015 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7016 /* 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
|
7017 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
|
7018 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7019 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
|
7020 *write_to = *read_from; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7021 *write_to = '\0'; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7022 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7023 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7024 return pixel_height; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7025 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7026 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7027 /* 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
|
7028 static BOOL |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7029 w32_font_match (fontname, pattern) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7030 char * fontname; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7031 char * pattern; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7032 { |
35674
62b578dd28ce
(w32_font_match): Allocate three more bytes to regex
Kenichi Handa <handa@m17n.org>
parents:
35359
diff
changeset
|
7033 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
|
7034 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
|
7035 char *ptr; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7036 |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7037 /* 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
|
7038 strcpy (font_name_copy, fontname); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7039 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7040 ptr = regex; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7041 *ptr++ = '^'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7042 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7043 /* 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
|
7044 for (; *pattern; pattern++) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7045 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7046 if (*pattern == '?') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7047 *ptr++ = '.'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7048 else if (*pattern == '*') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7049 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7050 *ptr++ = '.'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7051 *ptr++ = '*'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7052 } |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7053 else |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7054 *ptr++ = *pattern; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7055 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7056 *ptr = '$'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7057 *(ptr + 1) = '\0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7058 |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7059 /* 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
|
7060 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
|
7061 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
|
7062 pattern that declares the point height. |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7063 */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7064 { |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7065 int font_height, pattern_height; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7066 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7067 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
|
7068 pattern_height = xlfd_strip_height (regex); |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7069 |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7070 /* 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
|
7071 if the heights differ. */ |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7072 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
|
7073 return FALSE; |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7074 } |
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
7075 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7076 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
|
7077 font_name_copy) >= 0); |
13434 | 7078 } |
7079 | |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7080 /* 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
|
7081 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
|
7082 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
|
7083 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
|
7084 fall back on. |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7085 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7086 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
|
7087 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
|
7088 each family. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7089 |
13434 | 7090 typedef struct enumfont_t |
7091 { | |
7092 HDC hdc; | |
7093 int numFonts; | |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
7094 LOGFONT logfont; |
13434 | 7095 XFontStruct *size_ref; |
7096 Lisp_Object *pattern; | |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7097 Lisp_Object list; |
13434 | 7098 Lisp_Object *tail; |
7099 } enumfont_t; | |
7100 | |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7101 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7102 static void |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7103 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
|
7104 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7105 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7106 static int CALLBACK |
13434 | 7107 enum_font_cb2 (lplf, lptm, FontType, lpef) |
7108 ENUMLOGFONT * lplf; | |
7109 NEWTEXTMETRIC * lptm; | |
7110 int FontType; | |
7111 enumfont_t * lpef; | |
7112 { | |
40873
f288d1d604a7
(enum_font_cb2): Use leading @ on face name to detect
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
7113 /* 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
|
7114 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
|
7115 return 1; |
f288d1d604a7
(enum_font_cb2): Use leading @ on face name to detect
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
7116 |
f288d1d604a7
(enum_font_cb2): Use leading @ on face name to detect
Jason Rumney <jasonr@gnu.org>
parents:
40656
diff
changeset
|
7117 /* 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
|
7118 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
|
7119 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
|
7120 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
|
7121 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
|
7122 && 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
|
7123 return 1; |
7fb50bbb61ad
(w32_to_x_charset): Increase size of XLFD charset buffer.
Jason Rumney <jasonr@gnu.org>
parents:
40385
diff
changeset
|
7124 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7125 /* 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
|
7126 if (lpef->logfont.lfCharSet != DEFAULT_CHARSET && |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7127 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
|
7128 return 1; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7129 |
13434 | 7130 { |
7131 char buf[100]; | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7132 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
|
7133 Lisp_Object charset_list = Qnil; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7134 char *charset = NULL; |
13434 | 7135 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7136 /* 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
|
7137 if (FontType != RASTER_FONTTYPE) |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
7138 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7139 if (!NILP (*(lpef->pattern))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7140 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7141 /* 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
|
7142 lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7143 lplf->elfLogFont.lfWidth = lpef->logfont.lfWidth; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7144 width = make_number (lpef->logfont.lfWidth); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7145 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7146 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7147 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7148 lplf->elfLogFont.lfHeight = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7149 lplf->elfLogFont.lfWidth = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7150 } |
15205
0f5d6cd72e21
(win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents:
15148
diff
changeset
|
7151 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7152 |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
7153 /* 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
|
7154 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
|
7155 if (lplf->elfLogFont.lfHeight > 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7156 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7157 /* 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
|
7158 if (FontType == RASTER_FONTTYPE) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7159 lplf->elfLogFont.lfHeight = lptm->tmInternalLeading - lptm->tmHeight; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7160 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7161 lplf->elfLogFont.lfHeight = -lplf->elfLogFont.lfHeight; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7162 } |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7163 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7164 if (!NILP (*(lpef->pattern))) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7165 { |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7166 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
|
7167 |
43207
2dc57fcf62e9
(enum_font_cb2): Don't let charsets unknown to Windows
Jason Rumney <jasonr@gnu.org>
parents:
42935
diff
changeset
|
7168 /* We already checked charsets above, but DEFAULT_CHARSET |
2dc57fcf62e9
(enum_font_cb2): Don't let charsets unknown to Windows
Jason Rumney <jasonr@gnu.org>
parents:
42935
diff
changeset
|
7169 slipped through. So only allow exact matches for DEFAULT_CHARSET. */ |
2dc57fcf62e9
(enum_font_cb2): Don't let charsets unknown to Windows
Jason Rumney <jasonr@gnu.org>
parents:
42935
diff
changeset
|
7170 if (charset |
2dc57fcf62e9
(enum_font_cb2): Don't let charsets unknown to Windows
Jason Rumney <jasonr@gnu.org>
parents:
42935
diff
changeset
|
7171 && strncmp (charset, "*-*", 3) != 0 |
2dc57fcf62e9
(enum_font_cb2): Don't let charsets unknown to Windows
Jason Rumney <jasonr@gnu.org>
parents:
42935
diff
changeset
|
7172 && lpef->logfont.lfCharSet == DEFAULT_CHARSET |
2dc57fcf62e9
(enum_font_cb2): Don't let charsets unknown to Windows
Jason Rumney <jasonr@gnu.org>
parents:
42935
diff
changeset
|
7173 && strcmp (charset, w32_to_x_charset (DEFAULT_CHARSET)) != 0) |
2dc57fcf62e9
(enum_font_cb2): Don't let charsets unknown to Windows
Jason Rumney <jasonr@gnu.org>
parents:
42935
diff
changeset
|
7174 return 1; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7175 } |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7176 |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7177 if (charset) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7178 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
|
7179 else |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7180 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
|
7181 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7182 /* Loop through the charsets. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7183 for ( ; CONSP (charset_list); charset_list = Fcdr (charset_list)) |
13434 | 7184 { |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7185 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
|
7186 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
|
7187 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7188 /* 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
|
7189 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
|
7190 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
|
7191 && 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
|
7192 && lplf->elfLogFont.lfItalic == FALSE) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7193 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7194 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
|
7195 charset, width); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7196 /* bold. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7197 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
|
7198 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
|
7199 charset, width); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7200 /* bold italic. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7201 lplf->elfLogFont.lfItalic = TRUE; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7202 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
|
7203 charset, width); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7204 /* italic. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7205 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
|
7206 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
|
7207 charset, width); |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7208 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7209 else |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7210 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
|
7211 charset, width); |
13434 | 7212 } |
7213 } | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7214 |
40528
7fb50bbb61ad
(w32_to_x_charset): Increase size of XLFD charset buffer.
Jason Rumney <jasonr@gnu.org>
parents:
40385
diff
changeset
|
7215 return 1; |
13434 | 7216 } |
7217 | |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7218 static void |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7219 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
|
7220 enumfont_t * lpef; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7221 LOGFONT * logfont; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7222 char * match_charset; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7223 Lisp_Object width; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7224 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7225 char buf[100]; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7226 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7227 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
|
7228 return; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7229 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7230 if (NILP (*(lpef->pattern)) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7231 || 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
|
7232 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7233 /* 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
|
7234 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
|
7235 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
|
7236 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
|
7237 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
|
7238 { |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7239 *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
|
7240 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
|
7241 lpef->numFonts++; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7242 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7243 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7244 } |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7245 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7246 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7247 static int CALLBACK |
13434 | 7248 enum_font_cb1 (lplf, lptm, FontType, lpef) |
7249 ENUMLOGFONT * lplf; | |
7250 NEWTEXTMETRIC * lptm; | |
7251 int FontType; | |
7252 enumfont_t * lpef; | |
7253 { | |
7254 return EnumFontFamilies (lpef->hdc, | |
7255 lplf->elfLogFont.lfFaceName, | |
7256 (FONTENUMPROC) enum_font_cb2, | |
7257 (LPARAM) lpef); | |
7258 } | |
7259 | |
7260 | |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7261 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
|
7262 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
|
7263 ENUMLOGFONTEX * lplf; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7264 NEWTEXTMETRICEX * lptm; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7265 int font_type; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7266 enumfont_t * lpef; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7267 { |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7268 /* 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
|
7269 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
|
7270 enumerated seperately. */ |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7271 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
|
7272 font_type, lpef); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7273 } |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7274 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7275 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
|
7276 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
|
7277 ENUMLOGFONTEX * lplf; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7278 NEWTEXTMETRICEX * lptm; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7279 int font_type; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7280 enumfont_t * lpef; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7281 { |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7282 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
|
7283 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
|
7284 = GetProcAddress ( gdi32, "EnumFontFamiliesExA"); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7285 /* 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
|
7286 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
|
7287 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
|
7288 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
|
7289 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
|
7290 &lplf->elfLogFont, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7291 (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
|
7292 (LPARAM) lpef, 0); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7293 } |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7294 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7295 /* 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
|
7296 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
|
7297 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7298 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
|
7299 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7300 char *fontname, *ptnstr; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7301 Lisp_Object list, tem, newlist = Qnil; |
24670 | 7302 int n_fonts = 0; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7303 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7304 list = Vw32_bdf_filename_alist; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7305 ptnstr = XSTRING (pattern)->data; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7306 |
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)) |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7308 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7309 tem = XCAR (list); |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7310 if (CONSP (tem)) |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7311 fontname = XSTRING (XCAR (tem))->data; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7312 else if (STRINGP (tem)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7313 fontname = XSTRING (tem)->data; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7314 else |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7315 continue; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7316 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7317 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
|
7318 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7319 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
|
7320 n_fonts++; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7321 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
|
7322 break; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7323 } |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7324 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7325 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7326 return newlist; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7327 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7328 |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7329 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7330 /* 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
|
7331 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
|
7332 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
|
7333 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
|
7334 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
|
7335 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
|
7336 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7337 Lisp_Object |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
7338 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
|
7339 struct frame *f; |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
7340 Lisp_Object pattern; |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
7341 int size; |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
7342 int maxnames; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7343 { |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7344 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
|
7345 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
|
7346 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
|
7347 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
|
7348 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7349 patterns = Fassoc (pattern, Valternate_fontname_alist); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7350 if (NILP (patterns)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7351 patterns = Fcons (pattern, Qnil); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7352 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7353 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
|
7354 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7355 enumfont_t ef; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7356 int codepage; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7357 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7358 tpat = XCAR (patterns); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7359 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7360 if (!STRINGP (tpat)) |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7361 continue; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7362 |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7363 /* 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
|
7364 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
|
7365 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
|
7366 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
|
7367 && codepage != CP_DEFAULT && codepage != CP_UNKNOWN |
3a21ff35392b
(xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents:
34133
diff
changeset
|
7368 && !IsValidCodePage(codepage)) |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7369 continue; |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
7370 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7371 /* 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
|
7372 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
|
7373 ((PATTERN (FONTNAME . WIDTH) ...) ...) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7374 */ |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7375 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
|
7376 !NILP (list = Fassoc (tpat, tem))) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7377 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7378 list = Fcdr_safe (list); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7379 /* 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
|
7380 goto label_cached; |
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 BLOCK_INPUT; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7384 /* 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
|
7385 list = Qnil; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7386 ef.pattern = &tpat; |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
7387 ef.list = list; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7388 ef.tail = &list; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7389 ef.numFonts = 0; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7390 |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7391 /* 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
|
7392 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
|
7393 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
|
7394 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
|
7395 { |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7396 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
|
7397 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
|
7398 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
|
7399 = GetProcAddress ( gdi32, "EnumFontFamiliesExA"); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7400 |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7401 /* 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
|
7402 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
|
7403 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
|
7404 /* 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
|
7405 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
|
7406 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
|
7407 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7408 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
|
7409 |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7410 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
|
7411 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
|
7412 &font_match_pattern, |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7413 (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
|
7414 (LPARAM) &ef, 0); |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7415 else |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7416 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
|
7417 (LPARAM)&ef); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7418 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7419 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
|
7420 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7421 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7422 UNBLOCK_INPUT; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7423 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7424 /* 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
|
7425 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
|
7426 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
|
7427 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
|
7428 XCDR (dpyinfo->name_list_element))); |
23506
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 label_cached: |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7431 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
|
7432 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7433 newlist = second_best = Qnil; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7434 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7435 /* 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
|
7436 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
|
7437 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7438 int found_size; |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7439 tem = XCAR (list); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7440 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7441 if (!CONSP (tem)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7442 continue; |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7443 if (NILP (XCAR (tem))) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7444 continue; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7445 if (!size) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7446 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7447 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
|
7448 n_fonts++; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7449 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
|
7450 break; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7451 else |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7452 continue; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7453 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7454 if (!INTEGERP (XCDR (tem))) |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7455 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7456 /* 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
|
7457 load it and try GetTextMetrics. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7458 W32FontStruct thisinfo; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7459 LOGFONT lf; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7460 HDC hdc; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7461 HANDLE oldobj; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7462 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7463 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
|
7464 continue; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7465 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7466 BLOCK_INPUT; |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7467 thisinfo.bdf = NULL; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7468 thisinfo.hfont = CreateFontIndirect (&lf); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7469 if (thisinfo.hfont == NULL) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7470 continue; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7471 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7472 hdc = GetDC (dpyinfo->root_window); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7473 oldobj = SelectObject (hdc, thisinfo.hfont); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7474 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
|
7475 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
|
7476 else |
39973
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
39812
diff
changeset
|
7477 XSETCDR (tem, make_number (0)); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7478 SelectObject (hdc, oldobj); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7479 ReleaseDC (dpyinfo->root_window, hdc); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7480 DeleteObject(thisinfo.hfont); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7481 UNBLOCK_INPUT; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7482 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7483 found_size = XINT (XCDR (tem)); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7484 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
|
7485 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7486 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
|
7487 n_fonts++; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7488 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
|
7489 break; |
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7490 } |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7491 /* 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
|
7492 no exact match is found. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7493 else if (found_size > 0) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7494 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7495 if (NILP (second_best)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7496 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
|
7497 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7498 else if (found_size < size) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7499 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7500 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
|
7501 || 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
|
7502 second_best = tem; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7503 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7504 else |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7505 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7506 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
|
7507 && XINT (XCDR (second_best)) > |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7508 found_size) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7509 second_best = tem; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7510 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7511 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7512 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7513 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7514 if (!NILP (newlist)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7515 break; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7516 else if (!NILP (second_best)) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7517 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7518 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
|
7519 break; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7520 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7521 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7522 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7523 /* 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
|
7524 if (n_fonts < maxnames) |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7525 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7526 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
|
7527 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
|
7528 combined[1] = newlist; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7529 newlist = Fnconc(2, combined); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7530 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7531 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7532 return newlist; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7533 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7534 |
24214
4fb0bce809bc
(w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents:
24211
diff
changeset
|
7535 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7536 /* 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
|
7537 struct font_info * |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7538 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
|
7539 FRAME_PTR f; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7540 int font_idx; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7541 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7542 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
|
7543 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7544 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7545 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7546 struct font_info* |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7547 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
|
7548 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7549 int i; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7550 struct font_info *pfi; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7551 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7552 pfi = FRAME_W32_FONT_TABLE (f); |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7553 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7554 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
|
7555 { |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7556 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
|
7557 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7558 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7559 return NULL; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7560 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7561 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7562 /* 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
|
7563 `encoder' of the structure. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7564 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7565 void |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7566 w32_find_ccl_program (fontp) |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7567 struct font_info *fontp; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7568 { |
25069
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
7569 Lisp_Object list, elt; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7570 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7571 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
|
7572 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7573 elt = XCAR (list); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7574 if (CONSP (elt) |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7575 && STRINGP (XCAR (elt)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7576 && (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
|
7577 >= 0)) |
25069
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
7578 break; |
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
7579 } |
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
7580 if (! NILP (list)) |
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
7581 { |
25084
d89aa269255d
(w32_find_ccl_program): Add casting.
Kenichi Handa <handa@m17n.org>
parents:
25069
diff
changeset
|
7582 struct ccl_program *ccl |
d89aa269255d
(w32_find_ccl_program): Add casting.
Kenichi Handa <handa@m17n.org>
parents:
25069
diff
changeset
|
7583 = (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
|
7584 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7585 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
|
7586 xfree (ccl); |
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
7587 else |
ee9bfbc340ba
(w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents:
24856
diff
changeset
|
7588 fontp->font_encoder = ccl; |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7589 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7590 } |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7591 |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
7592 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7593 /* 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
|
7594 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
|
7595 static Lisp_Object |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7596 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
|
7597 { |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7598 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
|
7599 char fontname[100]; |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7600 |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7601 if (!STRINGP(directory)) |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7602 return Qnil; |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7603 |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7604 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
|
7605 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
|
7606 |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7607 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
|
7608 { |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7609 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
|
7610 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
|
7611 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
|
7612 } |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7613 return list; |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7614 } |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
7615 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7616 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
|
7617 1, 1, 0, |
41019 | 7618 doc: /* Return a list of BDF fonts in DIR. |
7619 The list is suitable for appending to w32-bdf-filename-alist. Fonts | |
7620 which do not contain an xlfd description will not be included in the | |
7621 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
|
7622 (directory) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7623 Lisp_Object directory; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7624 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7625 Lisp_Object list = Qnil; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7626 struct gcpro gcpro1, gcpro2; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7627 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7628 if (!CONSP (directory)) |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7629 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
|
7630 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7631 for ( ; CONSP (directory); directory = XCDR (directory)) |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7632 { |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7633 Lisp_Object pair[2]; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7634 pair[0] = list; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7635 pair[1] = Qnil; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7636 GCPRO2 (directory, list); |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7637 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
|
7638 list = Fnconc( 2, pair ); |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7639 UNGCPRO; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7640 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7641 return list; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7642 } |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7643 |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
7644 |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
25646
diff
changeset
|
7645 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
|
7646 doc: /* Internal function called by `color-defined-p', which see. */) |
13434 | 7647 (color, frame) |
7648 Lisp_Object color, frame; | |
7649 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7650 XColor foo; |
13434 | 7651 FRAME_PTR f = check_x_frame (frame); |
7652 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
7653 CHECK_STRING (color); |
13434 | 7654 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7655 if (w32_defined_color (f, XSTRING (color)->data, &foo, 0)) |
13434 | 7656 return Qt; |
7657 else | |
7658 return Qnil; | |
7659 } | |
7660 | |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
25646
diff
changeset
|
7661 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
|
7662 doc: /* Internal function called by `color-values', which see. */) |
13434 | 7663 (color, frame) |
7664 Lisp_Object color, frame; | |
7665 { | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7666 XColor foo; |
13434 | 7667 FRAME_PTR f = check_x_frame (frame); |
7668 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
7669 CHECK_STRING (color); |
13434 | 7670 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7671 if (w32_defined_color (f, XSTRING (color)->data, &foo, 0)) |
13434 | 7672 { |
7673 Lisp_Object rgb[3]; | |
7674 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7675 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
|
7676 | GetRValue (foo.pixel)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7677 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
|
7678 | GetGValue (foo.pixel)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7679 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
|
7680 | GetBValue (foo.pixel)); |
13434 | 7681 return Flist (3, rgb); |
7682 } | |
7683 else | |
7684 return Qnil; | |
7685 } | |
7686 | |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
25646
diff
changeset
|
7687 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
|
7688 doc: /* Internal function called by `display-color-p', which see. */) |
13434 | 7689 (display) |
7690 Lisp_Object display; | |
7691 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7692 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7693 |
7694 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 2) | |
7695 return Qnil; | |
7696 | |
7697 return Qt; | |
7698 } | |
7699 | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7700 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
|
7701 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
|
7702 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
|
7703 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
|
7704 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
|
7705 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
|
7706 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7707 (display) |
7708 Lisp_Object display; | |
7709 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7710 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7711 |
7712 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 1) | |
7713 return Qnil; | |
7714 | |
7715 return Qt; | |
7716 } | |
7717 | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7718 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
|
7719 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
|
7720 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
|
7721 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
|
7722 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
|
7723 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7724 (display) |
7725 Lisp_Object display; | |
7726 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7727 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7728 |
7729 return make_number (dpyinfo->width); | |
7730 } | |
7731 | |
7732 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
|
7733 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
|
7734 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
|
7735 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
|
7736 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
|
7737 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7738 (display) |
7739 Lisp_Object display; | |
7740 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7741 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7742 |
7743 return make_number (dpyinfo->height); | |
7744 } | |
7745 | |
7746 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
|
7747 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
|
7748 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
|
7749 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
|
7750 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
|
7751 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7752 (display) |
7753 Lisp_Object display; | |
7754 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7755 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7756 |
7757 return make_number (dpyinfo->n_planes * dpyinfo->n_cbits); | |
7758 } | |
7759 | |
7760 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
|
7761 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
|
7762 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
|
7763 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
|
7764 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
|
7765 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7766 (display) |
7767 Lisp_Object display; | |
7768 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7769 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7770 HDC hdc; |
7771 int cap; | |
7772 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7773 hdc = GetDC (dpyinfo->root_window); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7774 if (dpyinfo->has_palette) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7775 cap = GetDeviceCaps (hdc,SIZEPALETTE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7776 else |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7777 cap = GetDeviceCaps (hdc,NUMCOLORS); |
34998
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7778 |
43773
8d3931ead0df
(Fx_display_color_cells): Force 24+ bit color depths to 24-bit.
Juanma Barranquero <lekktu@gmail.com>
parents:
43484
diff
changeset
|
7779 /* We force 24+ bit depths to 24-bit, both to prevent an overflow |
8d3931ead0df
(Fx_display_color_cells): Force 24+ bit color depths to 24-bit.
Juanma Barranquero <lekktu@gmail.com>
parents:
43484
diff
changeset
|
7780 and because probably is more meaningful on Windows anyway */ |
34998
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7781 if (cap < 0) |
43773
8d3931ead0df
(Fx_display_color_cells): Force 24+ bit color depths to 24-bit.
Juanma Barranquero <lekktu@gmail.com>
parents:
43484
diff
changeset
|
7782 cap = 1 << min(dpyinfo->n_planes * dpyinfo->n_cbits, 24); |
13434 | 7783 |
7784 ReleaseDC (dpyinfo->root_window, hdc); | |
7785 | |
7786 return make_number (cap); | |
7787 } | |
7788 | |
7789 DEFUN ("x-server-max-request-size", Fx_server_max_request_size, | |
7790 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
|
7791 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
|
7792 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
|
7793 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
|
7794 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
|
7795 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7796 (display) |
7797 Lisp_Object display; | |
7798 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7799 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7800 |
7801 return make_number (1); | |
7802 } | |
7803 | |
7804 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
|
7805 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
|
7806 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
|
7807 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
|
7808 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7809 (display) |
7810 Lisp_Object display; | |
7811 { | |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
7812 return build_string ("Microsoft Corp."); |
13434 | 7813 } |
7814 | |
7815 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
|
7816 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
|
7817 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
|
7818 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
|
7819 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
|
7820 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7821 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
|
7822 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
|
7823 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7824 (display) |
7825 Lisp_Object display; | |
7826 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7827 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
|
7828 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
|
7829 Fcons (make_number (w32_build_number), Qnil))); |
13434 | 7830 } |
7831 | |
7832 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
|
7833 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
|
7834 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
|
7835 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
|
7836 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7837 (display) |
7838 Lisp_Object display; | |
7839 { | |
7840 return make_number (1); | |
7841 } | |
7842 | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7843 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
|
7844 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
|
7845 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
|
7846 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
|
7847 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
|
7848 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7849 (display) |
7850 Lisp_Object display; | |
7851 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7852 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7853 HDC hdc; |
7854 int cap; | |
7855 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7856 hdc = GetDC (dpyinfo->root_window); |
14353 | 7857 |
13434 | 7858 cap = GetDeviceCaps (hdc, VERTSIZE); |
14353 | 7859 |
13434 | 7860 ReleaseDC (dpyinfo->root_window, hdc); |
7861 | |
7862 return make_number (cap); | |
7863 } | |
7864 | |
7865 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
|
7866 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
|
7867 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
|
7868 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
|
7869 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7870 (display) |
7871 Lisp_Object display; | |
7872 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7873 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 7874 |
7875 HDC hdc; | |
7876 int cap; | |
7877 | |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
7878 hdc = GetDC (dpyinfo->root_window); |
14353 | 7879 |
13434 | 7880 cap = GetDeviceCaps (hdc, HORZSIZE); |
14353 | 7881 |
13434 | 7882 ReleaseDC (dpyinfo->root_window, hdc); |
7883 | |
7884 return make_number (cap); | |
7885 } | |
7886 | |
7887 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
|
7888 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
|
7889 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
|
7890 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
|
7891 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
|
7892 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
|
7893 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7894 (display) |
7895 Lisp_Object display; | |
7896 { | |
7897 return intern ("not-useful"); | |
7898 } | |
7899 | |
7900 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
|
7901 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
|
7902 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
|
7903 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
|
7904 `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
|
7905 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
7906 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
|
7907 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
|
7908 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7909 (display) |
7910 Lisp_Object display; | |
7911 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7912 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
|
7913 Lisp_Object result = Qnil; |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7914 |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7915 if (dpyinfo->has_palette) |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7916 result = intern ("pseudo-color"); |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7917 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
|
7918 result = intern ("static-grey"); |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7919 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
|
7920 result = intern ("static-color"); |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7921 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
|
7922 result = intern ("true-color"); |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7923 |
5091928844df
(Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents:
34942
diff
changeset
|
7924 return result; |
13434 | 7925 } |
7926 | |
7927 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
|
7928 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
|
7929 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
|
7930 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
|
7931 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
|
7932 If omitted or nil, that stands for the selected frame's display. */) |
13434 | 7933 (display) |
7934 Lisp_Object display; | |
7935 { | |
7936 return Qnil; | |
7937 } | |
7938 | |
7939 int | |
7940 x_pixel_width (f) | |
7941 register struct frame *f; | |
7942 { | |
7943 return PIXEL_WIDTH (f); | |
7944 } | |
7945 | |
7946 int | |
7947 x_pixel_height (f) | |
7948 register struct frame *f; | |
7949 { | |
7950 return PIXEL_HEIGHT (f); | |
7951 } | |
7952 | |
7953 int | |
7954 x_char_width (f) | |
7955 register struct frame *f; | |
7956 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7957 return FONT_WIDTH (f->output_data.w32->font); |
13434 | 7958 } |
7959 | |
7960 int | |
7961 x_char_height (f) | |
7962 register struct frame *f; | |
7963 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7964 return f->output_data.w32->line_height; |
13434 | 7965 } |
7966 | |
7967 int | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7968 x_screen_planes (f) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7969 register struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7970 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
7971 return FRAME_W32_DISPLAY_INFO (f)->n_planes; |
13434 | 7972 } |
7973 | |
7974 /* Return the display structure for the display named NAME. | |
7975 Open a new connection if necessary. */ | |
7976 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7977 struct w32_display_info * |
13434 | 7978 x_display_info_for_name (name) |
7979 Lisp_Object name; | |
7980 { | |
7981 Lisp_Object names; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7982 struct w32_display_info *dpyinfo; |
13434 | 7983 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
7984 CHECK_STRING (name); |
13434 | 7985 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
7986 for (dpyinfo = &one_w32_display_info, names = w32_display_name_list; |
13434 | 7987 dpyinfo; |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7988 dpyinfo = dpyinfo->next, names = XCDR (names)) |
13434 | 7989 { |
7990 Lisp_Object tem; | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
7991 tem = Fstring_equal (XCAR (XCAR (names)), name); |
13434 | 7992 if (!NILP (tem)) |
7993 return dpyinfo; | |
7994 } | |
7995 | |
7996 /* Use this general default value to start with. */ | |
7997 Vx_resource_name = Vinvocation_name; | |
7998 | |
7999 validate_x_resource_name (); | |
8000 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
8001 dpyinfo = w32_term_init (name, (unsigned char *)0, |
13434 | 8002 (char *) XSTRING (Vx_resource_name)->data); |
8003 | |
8004 if (dpyinfo == 0) | |
8005 error ("Cannot connect to server %s", XSTRING (name)->data); | |
8006 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
8007 w32_in_use = 1; |
13434 | 8008 XSETFASTINT (Vwindow_system_version, 3); |
8009 | |
8010 return dpyinfo; | |
8011 } | |
8012 | |
8013 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
|
8014 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
|
8015 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
|
8016 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
|
8017 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
|
8018 terminate Emacs if we can't open the connection. */) |
13434 | 8019 (display, xrm_string, must_succeed) |
8020 Lisp_Object display, xrm_string, must_succeed; | |
8021 { | |
8022 unsigned char *xrm_option; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
8023 struct w32_display_info *dpyinfo; |
13434 | 8024 |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
8025 /* 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
|
8026 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
|
8027 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
|
8028 return Qnil; |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
8029 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
8030 CHECK_STRING (display); |
13434 | 8031 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
|
8032 CHECK_STRING (xrm_string); |
13434 | 8033 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
8034 if (! EQ (Vwindow_system, intern ("w32"))) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
8035 error ("Not using Microsoft Windows"); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
8036 |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8037 /* 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
|
8038 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
|
8039 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8040 Lisp_Object color_file; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8041 struct gcpro gcpro1; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8042 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8043 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
|
8044 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8045 GCPRO1 (color_file); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8046 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8047 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
|
8048 color_file = |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8049 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
|
8050 Fsymbol_value (intern ("data-directory"))); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8051 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
8052 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
|
8053 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8054 UNGCPRO; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8055 } |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
8056 if (NILP (Vw32_color_map)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
8057 Vw32_color_map = Fw32_default_color_map (); |
13434 | 8058 |
8059 if (! NILP (xrm_string)) | |
8060 xrm_option = (unsigned char *) XSTRING (xrm_string)->data; | |
8061 else | |
8062 xrm_option = (unsigned char *) 0; | |
8063 | |
8064 /* 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
|
8065 /* 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
|
8066 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8067 char basename[ MAX_PATH ], *str; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8068 |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8069 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
|
8070 str = strrchr (basename, '.'); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8071 if (str) *str = 0; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8072 Vinvocation_name = build_string (basename); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
8073 } |
13434 | 8074 Vx_resource_name = Vinvocation_name; |
8075 | |
8076 validate_x_resource_name (); | |
8077 | |
8078 /* This is what opens the connection and sets x_current_display. | |
8079 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
|
8080 dpyinfo = w32_term_init (display, xrm_option, |
13434 | 8081 (char *) XSTRING (Vx_resource_name)->data); |
8082 | |
8083 if (dpyinfo == 0) | |
8084 { | |
8085 if (!NILP (must_succeed)) | |
14353 | 8086 fatal ("Cannot connect to server %s.\n", |
8087 XSTRING (display)->data); | |
13434 | 8088 else |
8089 error ("Cannot connect to server %s", XSTRING (display)->data); | |
8090 } | |
8091 | |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
8092 w32_in_use = 1; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
8093 |
13434 | 8094 XSETFASTINT (Vwindow_system_version, 3); |
8095 return Qnil; | |
8096 } | |
8097 | |
8098 DEFUN ("x-close-connection", Fx_close_connection, | |
8099 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
|
8100 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
|
8101 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
|
8102 If DISPLAY is nil, that stands for the selected frame's display. */) |
13434 | 8103 (display) |
8104 Lisp_Object display; | |
8105 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
8106 struct w32_display_info *dpyinfo = check_x_display_info (display); |
13434 | 8107 int i; |
8108 | |
8109 if (dpyinfo->reference_count > 0) | |
8110 error ("Display still has frames on it"); | |
8111 | |
8112 BLOCK_INPUT; | |
8113 /* Free the fonts in the font table. */ | |
8114 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
|
8115 if (dpyinfo->font_table[i].name) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8116 { |
28272
f62bb21d38db
(w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents:
27936
diff
changeset
|
8117 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
|
8118 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
|
8119 xfree (dpyinfo->font_table[i].name); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8120 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
|
8121 } |
13434 | 8122 x_destroy_all_bitmaps (dpyinfo); |
8123 | |
8124 x_delete_display (dpyinfo); | |
8125 UNBLOCK_INPUT; | |
8126 | |
8127 return Qnil; | |
8128 } | |
8129 | |
8130 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
|
8131 doc: /* Return the list of display names that Emacs has connections to. */) |
13434 | 8132 () |
8133 { | |
8134 Lisp_Object tail, result; | |
8135 | |
8136 result = Qnil; | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25289
diff
changeset
|
8137 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
|
8138 result = Fcons (XCAR (XCAR (tail)), result); |
13434 | 8139 |
8140 return result; | |
8141 } | |
8142 | |
8143 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, | |
41008 | 8144 doc: /* This is a noop on W32 systems. */) |
8145 (on, display) | |
8146 Lisp_Object display, on; | |
13434 | 8147 { |
8148 return Qnil; | |
8149 } | |
8150 | |
8151 | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8152 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8153 Image types |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8154 ***********************************************************************/ |
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 /* 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
|
8157 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8158 #define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR)) |
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 /* 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
|
8161 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
|
8162 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8163 static struct image_type *image_types; |
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 /* 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
|
8166 images in Lisp. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8167 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8168 extern Lisp_Object Qimage; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8169 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8170 /* 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
|
8171 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8172 Lisp_Object Qxbm; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8173 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8174 /* Keywords. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8175 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8176 extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile; |
44068
85388a495f68
(QCtype): Remove duplicate declaration and
Kim F. Storm <storm@cua.dk>
parents:
44047
diff
changeset
|
8177 extern Lisp_Object QCdata, QCtype; |
85388a495f68
(QCtype): Remove duplicate declaration and
Kim F. Storm <storm@cua.dk>
parents:
44047
diff
changeset
|
8178 Lisp_Object QCascent, QCmargin, QCrelief; |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
8179 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
|
8180 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
|
8181 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8182 /* Other symbols. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8183 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8184 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
|
8185 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8186 /* 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
|
8187 if not displayed. */ |
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 Lisp_Object Vimage_cache_eviction_delay; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8190 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8191 /* Function prototypes. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8192 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8193 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
|
8194 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
|
8195 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
|
8196 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
|
8197 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
|
8198 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
|
8199 Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8200 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8201 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8202 /* 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
|
8203 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
|
8204 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8205 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8206 define_image_type (type) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8207 struct image_type *type; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8208 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8209 /* 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
|
8210 The initialized data segment is read-only. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8211 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
|
8212 bcopy (type, p, sizeof *p); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8213 p->next = image_types; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8214 image_types = p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8215 Vimage_types = Fcons (*p->type, Vimage_types); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8216 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8217 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8218 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8219 /* 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
|
8220 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
|
8221 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8222 static INLINE struct image_type * |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8223 lookup_image_type (symbol) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8224 Lisp_Object symbol; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8225 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8226 struct image_type *type; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8227 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8228 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
|
8229 if (EQ (symbol, *type->type)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8230 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8231 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8232 return type; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8233 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8234 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8235 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8236 /* 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
|
8237 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
|
8238 `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
|
8239 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
|
8240 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
|
8241 image type. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8242 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8243 int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8244 valid_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8245 Lisp_Object object; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8246 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8247 int valid_p = 0; |
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 if (CONSP (object) && EQ (XCAR (object), Qimage)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8250 { |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8251 Lisp_Object tem; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8252 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8253 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
|
8254 if (EQ (XCAR (tem), QCtype)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8255 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8256 tem = XCDR (tem); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8257 if (CONSP (tem) && SYMBOLP (XCAR (tem))) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8258 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8259 struct image_type *type; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8260 type = lookup_image_type (XCAR (tem)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8261 if (type) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8262 valid_p = type->valid_p (object); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8263 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8264 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8265 break; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8266 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8267 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8268 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8269 return valid_p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8270 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8271 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8272 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8273 /* 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
|
8274 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
|
8275 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
|
8276 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
|
8277 therefore simply displays a message. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8278 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8279 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8280 image_error (format, arg1, arg2) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8281 char *format; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8282 Lisp_Object arg1, arg2; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8283 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8284 add_to_log (format, arg1, arg2); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8285 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8286 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8287 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8288 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8289 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8290 Image specifications |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8291 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8292 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8293 enum image_value_type |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8294 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8295 IMAGE_DONT_CHECK_VALUE_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8296 IMAGE_STRING_VALUE, |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8297 IMAGE_STRING_OR_NIL_VALUE, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8298 IMAGE_SYMBOL_VALUE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8299 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
|
8300 IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8301 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
|
8302 IMAGE_ASCENT_VALUE, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8303 IMAGE_INTEGER_VALUE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8304 IMAGE_FUNCTION_VALUE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8305 IMAGE_NUMBER_VALUE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8306 IMAGE_BOOL_VALUE |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8307 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8308 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8309 /* Structure used when parsing image specifications. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8310 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8311 struct image_keyword |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8312 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8313 /* Name of keyword. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8314 char *name; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8315 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8316 /* The type of value allowed. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8317 enum image_value_type type; |
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 /* Non-zero means key must be present. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8320 int mandatory_p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8321 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8322 /* 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
|
8323 int count; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8324 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8325 /* The value that was found. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8326 Lisp_Object value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8327 }; |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8330 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
|
8331 int, Lisp_Object)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8332 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
|
8333 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8334 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8335 /* 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
|
8336 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
|
8337 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
|
8338 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
|
8339 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
|
8340 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8341 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8342 parse_image_spec (spec, keywords, nkeywords, type) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8343 Lisp_Object spec; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8344 struct image_keyword *keywords; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8345 int nkeywords; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8346 Lisp_Object type; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8347 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8348 int i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8349 Lisp_Object plist; |
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 if (!CONSP (spec) || !EQ (XCAR (spec), Qimage)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8352 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8353 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8354 plist = XCDR (spec); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8355 while (CONSP (plist)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8356 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8357 Lisp_Object key, value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8358 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8359 /* 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
|
8360 key = XCAR (plist); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8361 plist = XCDR (plist); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8362 if (!SYMBOLP (key)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8363 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8364 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8365 /* There must follow a value. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8366 if (!CONSP (plist)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8367 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8368 value = XCAR (plist); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8369 plist = XCDR (plist); |
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 /* 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
|
8372 for (i = 0; i < nkeywords; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8373 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
|
8374 break; |
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 if (i == nkeywords) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8377 continue; |
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 /* 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
|
8380 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
|
8381 keywords[i].value = value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8382 ++keywords[i].count; |
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 if (keywords[i].count > 1) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8385 return 0; |
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 /* Check type of value against allowed type. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8388 switch (keywords[i].type) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8389 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8390 case IMAGE_STRING_VALUE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8391 if (!STRINGP (value)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8392 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8393 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8394 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8395 case IMAGE_STRING_OR_NIL_VALUE: |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8396 if (!STRINGP (value) && !NILP (value)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8397 return 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8398 break; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
8399 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8400 case IMAGE_SYMBOL_VALUE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8401 if (!SYMBOLP (value)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8402 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8403 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8404 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8405 case IMAGE_POSITIVE_INTEGER_VALUE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8406 if (!INTEGERP (value) || XINT (value) <= 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8407 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8408 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8409 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8410 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
|
8411 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
|
8412 break; |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8413 if (CONSP (value) |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8414 && 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
|
8415 && 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
|
8416 break; |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8417 return 0; |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8418 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8419 case IMAGE_ASCENT_VALUE: |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8420 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
|
8421 break; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8422 else if (INTEGERP (value) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8423 && XINT (value) >= 0 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8424 && XINT (value) <= 100) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8425 break; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8426 return 0; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8427 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8428 case IMAGE_NON_NEGATIVE_INTEGER_VALUE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8429 if (!INTEGERP (value) || XINT (value) < 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8430 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8431 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8432 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8433 case IMAGE_DONT_CHECK_VALUE_TYPE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8434 break; |
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 case IMAGE_FUNCTION_VALUE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8437 value = indirect_function (value); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8438 if (SUBRP (value) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8439 || COMPILEDP (value) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8440 || (CONSP (value) && EQ (XCAR (value), Qlambda))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8441 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8442 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8443 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8444 case IMAGE_NUMBER_VALUE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8445 if (!INTEGERP (value) && !FLOATP (value)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8446 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8447 break; |
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 case IMAGE_INTEGER_VALUE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8450 if (!INTEGERP (value)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8451 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8452 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8453 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8454 case IMAGE_BOOL_VALUE: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8455 if (!NILP (value) && !EQ (value, Qt)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8456 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8457 break; |
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 default: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8460 abort (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8461 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8462 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8463 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8464 if (EQ (key, QCtype) && !EQ (type, value)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8465 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8466 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8467 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8468 /* Check that all mandatory fields are present. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8469 for (i = 0; i < nkeywords; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8470 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
|
8471 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8472 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8473 return NILP (plist); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8474 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8475 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8476 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8477 /* 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
|
8478 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
|
8479 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
|
8480 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8481 static Lisp_Object |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8482 image_spec_value (spec, key, found) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8483 Lisp_Object spec, key; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8484 int *found; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8485 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8486 Lisp_Object tail; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8487 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8488 xassert (valid_image_p (spec)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8489 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8490 for (tail = XCDR (spec); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8491 CONSP (tail) && CONSP (XCDR (tail)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8492 tail = XCDR (XCDR (tail))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8493 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8494 if (EQ (XCAR (tail), key)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8495 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8496 if (found) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8497 *found = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8498 return XCAR (XCDR (tail)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8499 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8500 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8501 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8502 if (found) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8503 *found = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8504 return Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8505 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8506 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8507 |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8508 DEFUN ("image-size", Fimage_size, Simage_size, 1, 3, 0, |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8509 doc: /* Return the size of image SPEC as pair (WIDTH . HEIGHT). |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8510 PIXELS non-nil means return the size in pixels, otherwise return the |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8511 size in canonical character units. |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8512 FRAME is the frame on which the image will be displayed. FRAME nil |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8513 or omitted means use the selected frame. */) |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8514 (spec, pixels, frame) |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8515 Lisp_Object spec, pixels, frame; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8516 { |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8517 Lisp_Object size; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8518 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8519 size = Qnil; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8520 if (valid_image_p (spec)) |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8521 { |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8522 struct frame *f = check_x_frame (frame); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8523 int id = lookup_image (f, spec); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8524 struct image *img = IMAGE_FROM_ID (f, id); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8525 int width = img->width + 2 * img->hmargin; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8526 int height = img->height + 2 * img->vmargin; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8527 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8528 if (NILP (pixels)) |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8529 size = Fcons (make_float ((double) width / CANON_X_UNIT (f)), |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8530 make_float ((double) height / CANON_Y_UNIT (f))); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8531 else |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8532 size = Fcons (make_number (width), make_number (height)); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8533 } |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8534 else |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8535 error ("Invalid image specification"); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8536 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8537 return size; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8538 } |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8539 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8540 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8541 DEFUN ("image-mask-p", Fimage_mask_p, Simage_mask_p, 1, 2, 0, |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8542 doc: /* Return t if image SPEC has a mask bitmap. |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8543 FRAME is the frame on which the image will be displayed. FRAME nil |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8544 or omitted means use the selected frame. */) |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8545 (spec, frame) |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8546 Lisp_Object spec, frame; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8547 { |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8548 Lisp_Object mask; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8549 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8550 mask = Qnil; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8551 if (valid_image_p (spec)) |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8552 { |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8553 struct frame *f = check_x_frame (frame); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8554 int id = lookup_image (f, spec); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8555 struct image *img = IMAGE_FROM_ID (f, id); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8556 if (img->mask) |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8557 mask = Qt; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8558 } |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8559 else |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8560 error ("Invalid image specification"); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8561 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8562 return mask; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8563 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8564 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8565 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8566 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8567 Image type independent image structures |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8568 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8569 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8570 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
|
8571 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
|
8572 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8573 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8574 /* 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
|
8575 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
|
8576 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8577 static struct image * |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8578 make_image (spec, hash) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8579 Lisp_Object spec; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8580 unsigned hash; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8581 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8582 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
|
8583 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8584 xassert (valid_image_p (spec)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8585 bzero (img, sizeof *img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8586 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
|
8587 xassert (img->type != NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8588 img->spec = spec; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8589 img->data.lisp_val = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8590 img->ascent = DEFAULT_IMAGE_ASCENT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8591 img->hash = hash; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8592 return img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8593 } |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8596 /* 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
|
8597 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8598 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8599 free_image (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8600 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8601 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8602 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8603 if (img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8604 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8605 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
|
8606 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8607 /* 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
|
8608 if (img->prev) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8609 img->prev->next = img->next; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8610 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8611 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
|
8612 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8613 if (img->next) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8614 img->next->prev = img->prev; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8615 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8616 c->images[img->id] = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8617 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8618 /* Free resources, then free IMG. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8619 img->type->free (f, img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8620 xfree (img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8621 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8622 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8623 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8624 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8625 /* 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
|
8626 drawing an image. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8627 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8628 void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8629 prepare_image_for_display (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8630 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8631 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8632 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8633 EMACS_TIME t; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8634 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8635 /* 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
|
8636 EMACS_GET_TIME (t); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8637 img->timestamp = EMACS_SECS (t); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8638 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8639 /* 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
|
8640 type dependent loader function. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8641 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
|
8642 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
|
8643 } |
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 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8646 /* 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
|
8647 drawn in face FACE. */ |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8648 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8649 int |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8650 image_ascent (img, face) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8651 struct image *img; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8652 struct face *face; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8653 { |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
8654 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
|
8655 int ascent; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8656 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8657 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
|
8658 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8659 if (face->font) |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8660 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
|
8661 - 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
|
8662 else |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8663 ascent = height / 2; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8664 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8665 else |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8666 ascent = (int) (height * img->ascent / 100.0); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8667 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8668 return ascent; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8669 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8670 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
8671 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8672 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8673 /* Image background colors. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8674 |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8675 /* Find the "best" corner color of a bitmap. XIMG is assumed to a device |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8676 context with the bitmap selected. */ |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8677 static COLORREF |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8678 four_corners_best (ximg, width, height) |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8679 HDC ximg; |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8680 unsigned long width, height; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8681 { |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8682 COLORREF corners[4], best; |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8683 int i, best_count; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8684 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8685 /* Get the colors at the corners of ximg. */ |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8686 corners[0] = GetPixel (ximg, 0, 0); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8687 corners[1] = GetPixel (ximg, width - 1, 0); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8688 corners[2] = GetPixel (ximg, width - 1, height - 1); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8689 corners[3] = GetPixel (ximg, 0, height - 1); |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8690 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8691 /* 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
|
8692 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
|
8693 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8694 int j, n; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8695 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8696 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
|
8697 if (corners[i] == corners[j]) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8698 ++n; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8699 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8700 if (n > best_count) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8701 best = corners[i], best_count = n; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8702 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8703 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8704 return best; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8705 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8706 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8707 /* 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
|
8708 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
|
8709 object to use for the heuristic. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8710 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8711 unsigned long |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8712 image_background (img, f, ximg) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8713 struct image *img; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8714 struct frame *f; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8715 XImage *ximg; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8716 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8717 if (! img->background_valid) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8718 /* 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
|
8719 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8720 #if 0 /* TODO: Image support. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8721 int free_ximg = !ximg; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8722 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8723 if (! ximg) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8724 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
|
8725 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
|
8726 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8727 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
|
8728 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8729 if (free_ximg) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8730 XDestroyImage (ximg); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8731 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8732 img->background_valid = 1; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8733 #endif |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8734 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8735 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8736 return img->background; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8737 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8738 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8739 /* 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
|
8740 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
|
8741 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
|
8742 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8743 int |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8744 image_background_transparent (img, f, mask) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8745 struct image *img; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8746 struct frame *f; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8747 XImage *mask; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8748 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8749 if (! img->background_transparent_valid) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8750 /* 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
|
8751 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8752 #if 0 /* TODO: Image support. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8753 if (img->mask) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8754 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8755 int free_mask = !mask; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8756 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8757 if (! mask) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8758 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
|
8759 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
|
8760 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8761 img->background_transparent |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8762 = !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
|
8763 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8764 if (free_mask) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8765 XDestroyImage (mask); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8766 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8767 else |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8768 #endif |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8769 img->background_transparent = 0; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8770 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8771 img->background_transparent_valid = 1; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8772 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8773 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8774 return img->background_transparent; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8775 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8776 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8777 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8778 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8779 Helper functions for X image types |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8780 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8781 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8782 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
|
8783 int, int)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8784 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
|
8785 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
|
8786 struct image *img, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8787 Lisp_Object color_name, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8788 unsigned long dflt)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8789 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8790 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8791 /* 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
|
8792 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
|
8793 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
|
8794 the image, if any. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8795 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8796 static void |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8797 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
|
8798 struct frame *f; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8799 struct image *img; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8800 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
|
8801 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8802 if (pixmap_p && img->pixmap) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8803 { |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8804 DeleteObject (img->pixmap); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8805 img->pixmap = NULL; |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8806 img->background_valid = 0; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8807 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8808 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8809 if (mask_p && img->mask) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8810 { |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8811 DeleteObject (img->mask); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8812 img->mask = NULL; |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8813 img->background_transparent_valid = 0; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8814 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8815 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8816 if (colors_p && img->ncolors) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8817 { |
44076
13f77e440e6e
(x_clear_image_1): Disable color table code.
Jason Rumney <jasonr@gnu.org>
parents:
44068
diff
changeset
|
8818 #if 0 /* TODO: color table support. */ |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8819 x_free_colors (f, img->colors, img->ncolors); |
44076
13f77e440e6e
(x_clear_image_1): Disable color table code.
Jason Rumney <jasonr@gnu.org>
parents:
44068
diff
changeset
|
8820 #endif |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8821 xfree (img->colors); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8822 img->colors = NULL; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8823 img->ncolors = 0; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8824 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8825 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
8826 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8827 /* 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
|
8828 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8829 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8830 x_clear_image (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8831 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8832 struct image *img; |
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 if (img->pixmap) |
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 BLOCK_INPUT; |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8837 DeleteObject (img->pixmap); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8838 img->pixmap = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8839 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8840 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8841 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8842 if (img->ncolors) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8843 { |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8844 #if 0 /* TODO: color table support */ |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8845 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8846 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
|
8847 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8848 /* 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
|
8849 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
|
8850 if (class != StaticColor |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8851 && class != StaticGray |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8852 && class != TrueColor) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8853 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8854 Colormap cmap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8855 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8856 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
|
8857 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
|
8858 img->ncolors, 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8859 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8860 } |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
8861 #endif |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8862 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8863 xfree (img->colors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8864 img->colors = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8865 img->ncolors = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8866 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8867 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8868 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8869 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8870 /* 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
|
8871 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
|
8872 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
|
8873 color. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8874 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8875 static unsigned long |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8876 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
|
8877 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8878 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8879 Lisp_Object color_name; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8880 unsigned long dflt; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8881 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8882 XColor color; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8883 unsigned long result; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8884 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8885 xassert (STRINGP (color_name)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8886 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8887 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
|
8888 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8889 /* 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
|
8890 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
|
8891 ++img->ncolors; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8892 img->colors = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8893 (unsigned long *) xrealloc (img->colors, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8894 img->ncolors * sizeof *img->colors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8895 img->colors[img->ncolors - 1] = color.pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8896 result = color.pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8897 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8898 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8899 result = dflt; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8900 return result; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8901 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8902 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8903 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8904 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8905 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8906 Image Cache |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8907 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8908 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8909 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
|
8910 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
|
8911 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8912 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8913 /* 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
|
8914 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
|
8915 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8916 struct image_cache * |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8917 make_image_cache () |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8918 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8919 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
|
8920 int size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8921 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8922 bzero (c, sizeof *c); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8923 c->size = 50; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8924 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
|
8925 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
|
8926 c->buckets = (struct image **) xmalloc (size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8927 bzero (c->buckets, size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8928 return c; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8929 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8930 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8931 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8932 /* 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
|
8933 caches. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8934 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8935 void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8936 free_image_cache (f) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8937 struct frame *f; |
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 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
|
8940 if (c) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8941 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8942 int i; |
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 /* 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
|
8945 xassert (c->refcount == 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8946 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8947 for (i = 0; i < c->used; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8948 free_image (f, c->images[i]); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8949 xfree (c->images); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8950 xfree (c); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8951 xfree (c->buckets); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8952 FRAME_X_IMAGE_CACHE (f) = NULL; |
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 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8955 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8956 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8957 /* 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
|
8958 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
|
8959 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
|
8960 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
|
8961 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
|
8962 at least that many seconds. */ |
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 void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8965 clear_image_cache (f, force_p) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8966 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8967 int force_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 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
|
8970 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8971 if (c && INTEGERP (Vimage_cache_eviction_delay)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8972 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8973 EMACS_TIME t; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8974 unsigned long old; |
44094
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
8975 int i, nfreed; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8976 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8977 EMACS_GET_TIME (t); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8978 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
|
8979 |
44094
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
8980 /* Block input so that we won't be interrupted by a SIGIO |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
8981 while being in an inconsistent state. */ |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
8982 BLOCK_INPUT; |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
8983 |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
8984 for (i = nfreed = 0; i < c->used; ++i) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8985 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8986 struct image *img = c->images[i]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8987 if (img != NULL |
44094
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
8988 && (force_p || (img->timestamp < old))) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8989 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8990 free_image (f, img); |
44094
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
8991 ++nfreed; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8992 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8993 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8994 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
8995 /* 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
|
8996 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
|
8997 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
|
8998 images freed above. So, clear these matrices. */ |
44094
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
8999 if (nfreed) |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
9000 { |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
9001 Lisp_Object tail, frame; |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
9002 |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
9003 FOR_EACH_FRAME (tail, frame) |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
9004 { |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
9005 struct frame *f = XFRAME (frame); |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
9006 if (FRAME_W32_P (f) |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
9007 && FRAME_X_IMAGE_CACHE (f) == c) |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
9008 clear_current_matrices (f); |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
9009 } |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
9010 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9011 ++windows_or_buffers_changed; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9012 } |
44094
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
9013 |
16eb7bad861d
(x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents:
44076
diff
changeset
|
9014 UNBLOCK_INPUT; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9015 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9016 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9017 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9018 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9019 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
|
9020 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
|
9021 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
|
9022 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
|
9023 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
|
9024 (frame) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9025 Lisp_Object frame; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9026 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9027 if (EQ (frame, Qt)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9028 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9029 Lisp_Object tail; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9030 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9031 FOR_EACH_FRAME (tail, frame) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9032 if (FRAME_W32_P (XFRAME (frame))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9033 clear_image_cache (XFRAME (frame), 1); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9034 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9035 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9036 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
|
9037 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9038 return Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9039 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9040 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9041 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9042 /* 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
|
9043 by the image's specification, */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9044 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9045 static void |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9046 postprocess_image (f, img) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9047 struct frame *f; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9048 struct image *img; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9049 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9050 #if 0 /* TODO: image support. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9051 /* Manipulation of the image's mask. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9052 if (img->pixmap) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9053 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9054 Lisp_Object conversion, spec; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9055 Lisp_Object mask; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9056 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9057 spec = img->spec; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9058 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9059 /* `:heuristic-mask t' |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9060 `:mask heuristic' |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9061 means build a mask heuristically. |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9062 `:heuristic-mask (R G B)' |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9063 `:mask (heuristic (R G B))' |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9064 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
|
9065 image. |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9066 `:mask nil' |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9067 means remove a mask, if any. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9068 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9069 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
|
9070 if (!NILP (mask)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9071 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
|
9072 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9073 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9074 int found_p; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9075 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9076 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
|
9077 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9078 if (EQ (mask, Qheuristic)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9079 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
|
9080 else if (CONSP (mask) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9081 && EQ (XCAR (mask), Qheuristic)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9082 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9083 if (CONSP (XCDR (mask))) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9084 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
|
9085 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9086 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
|
9087 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9088 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
|
9089 { |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9090 DeleteObject (img->mask); |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9091 img->mask = NULL; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9092 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9093 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9094 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9095 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9096 /* 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
|
9097 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
|
9098 if (EQ (conversion, Qdisabled)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9099 x_disable_image (f, img); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9100 else if (EQ (conversion, Qlaplace)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9101 x_laplace (f, img); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9102 else if (EQ (conversion, Qemboss)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9103 x_emboss (f, img); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9104 else if (CONSP (conversion) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9105 && EQ (XCAR (conversion), Qedge_detection)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9106 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9107 Lisp_Object tem; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9108 tem = XCDR (conversion); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9109 if (CONSP (tem)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9110 x_edge_detection (f, img, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9111 Fplist_get (tem, QCmatrix), |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9112 Fplist_get (tem, QCcolor_adjustment)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9113 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9114 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9115 #endif |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9116 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9117 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9118 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9119 /* 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
|
9120 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
|
9121 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9122 int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9123 lookup_image (f, spec) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9124 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9125 Lisp_Object spec; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9126 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9127 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
|
9128 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9129 int i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9130 unsigned hash; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9131 struct gcpro gcpro1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9132 EMACS_TIME now; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9133 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9134 /* 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
|
9135 specification. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9136 xassert (FRAME_WINDOW_P (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9137 xassert (valid_image_p (spec)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9138 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9139 GCPRO1 (spec); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9140 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9141 /* 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
|
9142 hash = sxhash (spec, 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9143 i = hash % IMAGE_CACHE_BUCKETS_SIZE; |
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 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
|
9146 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
|
9147 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9148 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9149 /* If 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
|
9150 if (img == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9151 { |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9152 extern Lisp_Object Qpostscript; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9153 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
9154 BLOCK_INPUT; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9155 img = make_image (spec, hash); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9156 cache_image (f, img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9157 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
|
9158 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9159 /* 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
|
9160 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
|
9161 draw a rectangle for it. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9162 if (img->load_failed_p) |
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 Lisp_Object value; |
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 value = image_spec_value (spec, QCwidth, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9167 img->width = (INTEGERP (value) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9168 ? XFASTINT (value) : DEFAULT_IMAGE_WIDTH); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9169 value = image_spec_value (spec, QCheight, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9170 img->height = (INTEGERP (value) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9171 ? XFASTINT (value) : DEFAULT_IMAGE_HEIGHT); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9172 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9173 else |
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 /* 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
|
9176 `:ascent PERCENT', `:margin MARGIN', `:relief RELIEF', |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9177 `:background COLOR'. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9178 Lisp_Object ascent, margin, relief, bg; |
27397
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 ascent = image_spec_value (spec, QCascent, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9181 if (INTEGERP (ascent)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9182 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
|
9183 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
|
9184 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
|
9185 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9186 margin = image_spec_value (spec, QCmargin, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9187 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
|
9188 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
|
9189 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
|
9190 && INTEGERP (XCDR (margin))) |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
9191 { |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
9192 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
|
9193 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
|
9194 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
|
9195 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
|
9196 } |
27397
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 relief = image_spec_value (spec, QCrelief, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9199 if (INTEGERP (relief)) |
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 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
|
9202 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
|
9203 img->vmargin += abs (img->relief); |
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 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9206 if (! img->background_valid) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9207 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9208 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
|
9209 if (!NILP (bg)) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9210 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9211 img->background |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9212 = 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
|
9213 FRAME_BACKGROUND_PIXEL (f)); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9214 img->background_valid = 1; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9215 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9216 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9217 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9218 /* 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
|
9219 don't have the image yet. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9220 if (!EQ (*img->type->type, Qpostscript)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9221 postprocess_image (f, img); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9222 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9223 |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
9224 UNBLOCK_INPUT; |
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
9225 xassert (!interrupt_input_blocked); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9226 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9227 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9228 /* 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
|
9229 EMACS_GET_TIME (now); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9230 img->timestamp = EMACS_SECS (now); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9231 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9232 UNGCPRO; |
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 /* Value is the image id. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9235 return img->id; |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9239 /* 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
|
9240 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9241 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9242 cache_image (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9243 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9244 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9245 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9246 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
|
9247 int i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9248 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9249 /* Find a free slot in c->images. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9250 for (i = 0; i < c->used; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9251 if (c->images[i] == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9252 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9253 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9254 /* 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
|
9255 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
|
9256 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9257 c->size *= 2; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9258 c->images = (struct image **) xrealloc (c->images, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9259 c->size * sizeof *c->images); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9260 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9261 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9262 /* 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
|
9263 c->images[i] = img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9264 img->id = i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9265 if (i == c->used) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9266 ++c->used; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9267 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9268 /* 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
|
9269 i = img->hash % IMAGE_CACHE_BUCKETS_SIZE; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9270 img->next = c->buckets[i]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9271 if (img->next) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9272 img->next->prev = img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9273 img->prev = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9274 c->buckets[i] = img; |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9278 /* 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
|
9279 Lisp Objects in the image cache. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9280 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9281 void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9282 forall_images_in_image_cache (f, fn) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9283 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9284 void (*fn) P_ ((struct image *img)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9285 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9286 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
|
9287 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9288 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
|
9289 if (c) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9290 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9291 int i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9292 for (i = 0; i < c->used; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9293 if (c->images[i]) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9294 fn (c->images[i]); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9295 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9296 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9297 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9298 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9299 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9300 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9301 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9302 W32 support code |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9303 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9304 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9305 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
|
9306 XImage **, Pixmap *)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9307 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
|
9308 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
|
9309 |
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 /* 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
|
9312 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
|
9313 Set (*XIMG)->data to a raster of WIDTH x HEIGHT pixels allocated |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9314 via xmalloc. DEPTH of zero signifies a 24 bit image, otherwise |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9315 DEPTH should indicate the bit depth of the image. Print error |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9316 messages via image_error if an error occurs. Value is non-zero if |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9317 successful. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9318 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9319 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9320 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
|
9321 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9322 int width, height, depth; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9323 XImage **ximg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9324 Pixmap *pixmap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9325 { |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9326 BITMAPINFOHEADER *header; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9327 HDC hdc; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9328 int scanline_width_bits; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9329 int remainder; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9330 int palette_colors = 0; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9331 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9332 if (depth == 0) |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9333 depth = 24; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9334 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9335 if (depth != 1 && depth != 4 && depth != 8 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9336 && depth != 16 && depth != 24 && depth != 32) |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9337 { |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9338 image_error ("Invalid image bit depth specified", Qnil, Qnil); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9339 return 0; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9340 } |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9341 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9342 scanline_width_bits = width * depth; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9343 remainder = scanline_width_bits % 32; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9344 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9345 if (remainder) |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9346 scanline_width_bits += 32 - remainder; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9347 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9348 /* Bitmaps with a depth less than 16 need a palette. */ |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9349 /* BITMAPINFO structure already contains the first RGBQUAD. */ |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9350 if (depth < 16) |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9351 palette_colors = 1 << depth - 1; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9352 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9353 *ximg = xmalloc (sizeof (XImage) + palette_colors * sizeof (RGBQUAD)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9354 if (*ximg == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9355 { |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9356 image_error ("Unable to allocate memory for XImage", Qnil, Qnil); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9357 return 0; |
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 |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9360 header = &((*ximg)->info.bmiHeader); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9361 bzero (&((*ximg)->info), sizeof (BITMAPINFO)); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9362 header->biSize = sizeof (*header); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9363 header->biWidth = width; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9364 header->biHeight = -height; /* negative indicates a top-down bitmap. */ |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9365 header->biPlanes = 1; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9366 header->biBitCount = depth; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9367 header->biCompression = BI_RGB; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9368 header->biClrUsed = palette_colors; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9369 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9370 hdc = get_frame_dc (f); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9371 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9372 /* Create a DIBSection and raster array for the bitmap, |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9373 and store its handle in *pixmap. */ |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9374 *pixmap = CreateDIBSection (hdc, &((*ximg)->info), DIB_RGB_COLORS, |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9375 &((*ximg)->data), NULL, 0); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9376 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9377 /* Realize display palette and garbage all frames. */ |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9378 release_frame_dc (f, hdc); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9379 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9380 if (*pixmap == NULL) |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9381 { |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9382 DWORD err = GetLastError(); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9383 Lisp_Object errcode; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9384 /* All system errors are < 10000, so the following is safe. */ |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9385 XSETINT (errcode, (int) err); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9386 image_error ("Unable to create bitmap, error code %d", errcode, Qnil); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9387 x_destroy_x_image (*ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9388 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9389 } |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9390 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9391 return 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9392 } |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9395 /* Destroy XImage XIMG. Free XIMG->data. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9396 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9397 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9398 x_destroy_x_image (ximg) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9399 XImage *ximg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9400 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9401 xassert (interrupt_input_blocked); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9402 if (ximg) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9403 { |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9404 /* Data will be freed by DestroyObject. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9405 ximg->data = NULL; |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9406 xfree (ximg); |
27397
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 } |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9411 /* 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
|
9412 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
|
9413 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9414 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9415 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
|
9416 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9417 XImage *ximg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9418 Pixmap pixmap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9419 { |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9420 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9421 #if TODO /* W32 specific image code. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9422 GC gc; |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9423 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9424 xassert (interrupt_input_blocked); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9425 gc = XCreateGC (NULL, pixmap, 0, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9426 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
|
9427 XFreeGC (NULL, gc); |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9428 #endif |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
9429 } |
27397
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9432 /*********************************************************************** |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9433 File Handling |
27397
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9436 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
|
9437 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
|
9438 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9439 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9440 /* 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
|
9441 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
|
9442 nil if not found. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9443 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9444 static Lisp_Object |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9445 x_find_image_file (file) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9446 Lisp_Object file; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9447 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9448 Lisp_Object file_found, search_path; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9449 struct gcpro gcpro1, gcpro2; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9450 int fd; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9451 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9452 file_found = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9453 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
|
9454 GCPRO2 (file_found, search_path); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9455 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9456 /* Try to find FILE in data-directory, then x-bitmap-file-path. */ |
45009
7a00556be3ce
(x_create_bitmap_from_file, x_find_image_file): Update call to openp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44642
diff
changeset
|
9457 fd = openp (search_path, file, Qnil, &file_found, Qnil); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9458 |
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
|
9459 if (fd == -1) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9460 file_found = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9461 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9462 close (fd); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9463 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9464 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9465 return file_found; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9466 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9467 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9468 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9469 /* 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
|
9470 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
|
9471 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
|
9472 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9473 static char * |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9474 slurp_file (file, size) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9475 char *file; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9476 int *size; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9477 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9478 FILE *fp = NULL; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9479 char *buf = NULL; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9480 struct stat st; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9481 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9482 if (stat (file, &st) == 0 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9483 && (fp = fopen (file, "r")) != NULL |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9484 && (buf = (char *) xmalloc (st.st_size), |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9485 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
|
9486 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9487 *size = st.st_size; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9488 fclose (fp); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9489 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9490 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9491 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9492 if (fp) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9493 fclose (fp); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9494 if (buf) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9495 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9496 xfree (buf); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9497 buf = NULL; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9498 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9499 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9500 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9501 return buf; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9502 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9503 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9504 |
27397
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 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9507 XBM images |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9508 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9509 |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9510 static int xbm_scan P_ ((char **, char *, char *, int *)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9511 static int xbm_load P_ ((struct frame *f, struct image *img)); |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9512 static int xbm_load_image P_ ((struct frame *f, struct image *img, |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9513 char *, char *)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9514 static int xbm_image_p P_ ((Lisp_Object object)); |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9515 static int xbm_read_bitmap_data P_ ((char *, char *, int *, int *, |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9516 unsigned char **)); |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9517 static int xbm_file_p P_ ((Lisp_Object)); |
27397
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9520 /* 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
|
9521 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9522 enum xbm_keyword_index |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9523 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9524 XBM_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9525 XBM_FILE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9526 XBM_WIDTH, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9527 XBM_HEIGHT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9528 XBM_DATA, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9529 XBM_FOREGROUND, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9530 XBM_BACKGROUND, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9531 XBM_ASCENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9532 XBM_MARGIN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9533 XBM_RELIEF, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9534 XBM_ALGORITHM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9535 XBM_HEURISTIC_MASK, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9536 XBM_MASK, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9537 XBM_LAST |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9538 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9539 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9540 /* 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
|
9541 of valid XBM image specifications. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9542 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9543 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
|
9544 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9545 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9546 {":file", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9547 {":width", IMAGE_POSITIVE_INTEGER_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9548 {":height", IMAGE_POSITIVE_INTEGER_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9549 {":data", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9550 {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0}, |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9551 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}, |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9552 {":ascent", IMAGE_ASCENT_VALUE, 0}, |
35288
912ea0b8e09b
(x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents:
34998
diff
changeset
|
9553 {":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
|
9554 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
9555 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9556 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9557 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0} |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9558 }; |
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 /* Structure describing the image type XBM. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9561 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9562 static struct image_type xbm_type = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9563 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9564 &Qxbm, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9565 xbm_image_p, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9566 xbm_load, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9567 x_clear_image, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9568 NULL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9569 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9570 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9571 /* Tokens returned from xbm_scan. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9572 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9573 enum xbm_token |
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 XBM_TK_IDENT = 256, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9576 XBM_TK_NUMBER |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9579 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9580 /* 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
|
9581 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
|
9582 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
|
9583 entry `:type xbm.. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9584 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9585 If 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
|
9586 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
|
9587 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9588 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
|
9589 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
|
9590 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
|
9591 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9592 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
|
9593 have a size >= (WIDTH + 7) / 8 * HEIGHT |
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 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
|
9596 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9597 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
|
9598 bitmap. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9599 |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9600 4. A string containing an in-memory XBM file. WIDTH and HEIGHT |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9601 may not be specified in this case because they are defined in the |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9602 XBM file. |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9603 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9604 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
|
9605 `: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
|
9606 foreground and background of the frame on which the image is |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9607 displayed is used. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9608 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9609 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9610 xbm_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9611 Lisp_Object object; |
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 struct image_keyword kw[XBM_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9614 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9615 bcopy (xbm_format, kw, sizeof kw); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9616 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
|
9617 return 0; |
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 xassert (EQ (kw[XBM_TYPE].value, Qxbm)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9620 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9621 if (kw[XBM_FILE].count) |
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 (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
|
9624 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9625 } |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9626 else if (kw[XBM_DATA].count && xbm_file_p (kw[XBM_DATA].value)) |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9627 { |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9628 /* In-memory XBM file. */ |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9629 if (kw[XBM_WIDTH].count || kw[XBM_HEIGHT].count || kw[XBM_FILE].count) |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9630 return 0; |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9631 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9632 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9633 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9634 Lisp_Object data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9635 int width, height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9636 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9637 /* 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
|
9638 if (!kw[XBM_WIDTH].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9639 || !kw[XBM_HEIGHT].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9640 || !kw[XBM_DATA].count) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9641 return 0; |
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 data = kw[XBM_DATA].value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9644 width = XFASTINT (kw[XBM_WIDTH].value); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9645 height = XFASTINT (kw[XBM_HEIGHT].value); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9646 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9647 /* 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
|
9648 data. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9649 if (VECTORP (data)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9650 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9651 int i; |
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 /* 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
|
9654 if (XVECTOR (data)->size < height) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9655 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9656 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9657 /* 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
|
9658 for one line of the image. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9659 for (i = 0; i < height; ++i) |
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 Lisp_Object elt = XVECTOR (data)->contents[i]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9662 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9663 if (STRINGP (elt)) |
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 (XSTRING (elt)->size |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9666 < (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
|
9667 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9668 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9669 else if (BOOL_VECTOR_P (elt)) |
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 if (XBOOL_VECTOR (elt)->size < width) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9672 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9673 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9674 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9675 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9676 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9677 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9678 else if (STRINGP (data)) |
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 (XSTRING (data)->size |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9681 < (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
|
9682 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9683 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9684 else if (BOOL_VECTOR_P (data)) |
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 if (XBOOL_VECTOR (data)->size < width * height) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9687 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9688 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9689 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9690 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9691 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9692 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9693 return 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9694 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9695 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9696 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9697 /* 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
|
9698 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
|
9699 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
|
9700 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
|
9701 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
|
9702 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9703 static int |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9704 xbm_scan (s, end, sval, ival) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9705 char **s, *end; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9706 char *sval; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9707 int *ival; |
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 int c; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9710 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9711 loop: |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9712 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9713 /* Skip white space. */ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9714 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
|
9715 ; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9716 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9717 if (*s >= end) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9718 c = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9719 else if (isdigit (c)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9720 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9721 int value = 0, digit; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9722 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9723 if (c == '0' && *s < end) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9724 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9725 c = *(*s)++; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9726 if (c == 'x' || c == 'X') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9727 { |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9728 while (*s < end) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9729 { |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9730 c = *(*s)++; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9731 if (isdigit (c)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9732 digit = c - '0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9733 else if (c >= 'a' && c <= 'f') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9734 digit = c - 'a' + 10; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9735 else if (c >= 'A' && c <= 'F') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9736 digit = c - 'A' + 10; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9737 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9738 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9739 value = 16 * value + digit; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9740 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9741 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9742 else if (isdigit (c)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9743 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9744 value = c - '0'; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9745 while (*s < end |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9746 && (c = *(*s)++, isdigit (c))) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9747 value = 8 * value + c - '0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9748 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9749 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9750 else |
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 value = c - '0'; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9753 while (*s < end |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9754 && (c = *(*s)++, isdigit (c))) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9755 value = 10 * value + c - '0'; |
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 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9758 if (*s < end) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9759 *s = *s - 1; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9760 *ival = value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9761 c = XBM_TK_NUMBER; |
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 else if (isalpha (c) || c == '_') |
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 *sval++ = c; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9766 while (*s < end |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9767 && (c = *(*s)++, (isalnum (c) || c == '_'))) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9768 *sval++ = c; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9769 *sval = 0; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9770 if (*s < end) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9771 *s = *s - 1; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9772 c = XBM_TK_IDENT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9773 } |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9774 else if (c == '/' && **s == '*') |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9775 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9776 /* C-style comment. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9777 ++*s; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9778 while (**s && (**s != '*' || *(*s + 1) != '/')) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9779 ++*s; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9780 if (**s) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9781 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9782 *s += 2; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9783 goto loop; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9784 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9785 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9786 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9787 return c; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9788 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9789 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9790 |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9791 /* XBM bits seem to be backward within bytes compared with how |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9792 Windows does things. */ |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9793 static unsigned char reflect_byte (unsigned char orig) |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9794 { |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9795 int i; |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9796 unsigned char reflected = 0x00; |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9797 for (i = 0; i < 8; i++) |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9798 { |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9799 if (orig & (0x01 << i)) |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9800 reflected |= 0x80 >> i; |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9801 } |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9802 return reflected; |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9803 } |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9804 |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9805 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9806 /* 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
|
9807 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
|
9808 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
|
9809 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
|
9810 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
|
9811 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
|
9812 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9813 static int |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9814 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
|
9815 char *contents, *end; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9816 int *width, *height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9817 unsigned char **data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9818 { |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9819 char *s = contents; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9820 char buffer[BUFSIZ]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9821 int padding_p = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9822 int v10 = 0; |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9823 int bytes_in_per_line, bytes_out_per_line, i, nbytes; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9824 unsigned char *p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9825 int value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9826 int LA1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9827 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9828 #define match() \ |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9829 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
|
9830 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9831 #define expect(TOKEN) \ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9832 if (LA1 != (TOKEN)) \ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9833 goto failure; \ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9834 else \ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9835 match () |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9836 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9837 #define expect_ident(IDENT) \ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9838 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
|
9839 match (); \ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9840 else \ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9841 goto failure |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9842 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9843 *width = *height = -1; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9844 if (data) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9845 *data = NULL; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9846 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
|
9847 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9848 /* 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
|
9849 while (LA1 == '#') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9850 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9851 match (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9852 expect_ident ("define"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9853 expect (XBM_TK_IDENT); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9854 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9855 if (LA1 == XBM_TK_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9856 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9857 char *p = strrchr (buffer, '_'); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9858 p = p ? p + 1 : buffer; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9859 if (strcmp (p, "width") == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9860 *width = value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9861 else if (strcmp (p, "height") == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9862 *height = value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9863 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9864 expect (XBM_TK_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9865 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9866 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9867 if (*width < 0 || *height < 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9868 goto failure; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9869 else if (data == NULL) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9870 goto success; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9871 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9872 /* Parse bits. Must start with `static'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9873 expect_ident ("static"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9874 if (LA1 == XBM_TK_IDENT) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9875 { |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9876 /* On Windows, all images need padding to 16 bit boundaries. */ |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9877 if (*width % 16 && *width % 16 < 9) |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9878 padding_p = 1; |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9879 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9880 if (strcmp (buffer, "unsigned") == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9881 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9882 match (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9883 expect_ident ("char"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9884 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9885 else if (strcmp (buffer, "short") == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9886 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9887 match (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9888 v10 = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9889 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9890 else if (strcmp (buffer, "char") == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9891 match (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9892 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9893 goto failure; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9894 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9895 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9896 goto failure; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9897 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9898 expect (XBM_TK_IDENT); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9899 expect ('['); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9900 expect (']'); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9901 expect ('='); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9902 expect ('{'); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9903 |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9904 /* Bytes per line on input. Only count padding for v10 XBMs. */ |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9905 bytes_in_per_line = (*width + 7) / 8 + (v10 ? padding_p : 0); |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9906 bytes_out_per_line = (*width + 7) / 8 + padding_p; |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9907 |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9908 nbytes = bytes_in_per_line * *height; |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9909 p = *data = (char *) xmalloc (bytes_out_per_line * *height); |
27397
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 if (v10) |
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 for (i = 0; i < nbytes; i += 2) |
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 int val = value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9916 expect (XBM_TK_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9917 |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9918 *p++ = reflect_byte (val); |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9919 if (!padding_p || ((i + 2) % bytes_in_per_line)) |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9920 *p++ = reflect_byte (value >> 8); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9921 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9922 if (LA1 == ',' || LA1 == '}') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9923 match (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9924 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9925 goto failure; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9926 } |
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 else |
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 for (i = 0; i < nbytes; ++i) |
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 int val = value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9933 expect (XBM_TK_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9934 |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9935 *p++ = reflect_byte (val); |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9936 if (padding_p && ((i + 1) % bytes_in_per_line) == 0) |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9937 *p++ = 0; |
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9938 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9939 if (LA1 == ',' || LA1 == '}') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9940 match (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9941 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9942 goto failure; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9943 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9944 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9945 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9946 success: |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9947 return 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9948 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9949 failure: |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9950 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9951 if (data && *data) |
27397
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 xfree (*data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9954 *data = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9955 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9956 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9957 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9958 #undef match |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9959 #undef expect |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9960 #undef expect_ident |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9961 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9962 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9963 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9964 /* 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
|
9965 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
|
9966 successful. */ |
27397
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 int |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9969 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
|
9970 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9971 struct image *img; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9972 char *contents, *end; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9973 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9974 int rc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9975 unsigned char *data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9976 int success_p = 0; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9977 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
9978 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
|
9979 if (rc) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9980 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9981 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9982 unsigned long background = FRAME_BACKGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9983 Lisp_Object value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9984 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9985 xassert (img->width > 0 && img->height > 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9986 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9987 /* 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
|
9988 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
|
9989 if (!NILP (value)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9990 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
|
9991 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
|
9992 if (!NILP (value)) |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9993 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9994 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
|
9995 img->background = background; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9996 img->background_valid = 1; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
9997 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
9998 img->pixmap |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
9999 = CreateBitmap (img->width, img->height, 1, 1, data); |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10000 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10001 xfree (data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10002 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10003 if (img->pixmap == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10004 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10005 x_clear_image (f, img); |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10006 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
|
10007 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10008 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10009 success_p = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10010 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10011 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10012 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
|
10013 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10014 return success_p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10015 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10016 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10017 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10018 /* 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
|
10019 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10020 static int |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10021 xbm_file_p (data) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10022 Lisp_Object data; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10023 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10024 int w, h; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10025 return (STRINGP (data) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10026 && 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
|
10027 (XSTRING (data)->data |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10028 + STRING_BYTES (XSTRING (data))), |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10029 &w, &h, NULL)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10030 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10031 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10032 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10033 /* 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
|
10034 non-zero if successful. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10035 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10036 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10037 xbm_load (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10038 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10039 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10040 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10041 int success_p = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10042 Lisp_Object file_name; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10043 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10044 xassert (xbm_image_p (img->spec)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10045 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10046 /* 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
|
10047 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
|
10048 if (STRINGP (file_name)) |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10049 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10050 Lisp_Object file; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10051 char *contents; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10052 int size; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10053 struct gcpro gcpro1; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10054 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10055 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
|
10056 GCPRO1 (file); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10057 if (!STRINGP (file)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10058 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10059 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
|
10060 UNGCPRO; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10061 return 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10062 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10063 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10064 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
|
10065 if (contents == NULL) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10066 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10067 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
|
10068 UNGCPRO; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10069 return 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10070 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10071 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10072 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
|
10073 UNGCPRO; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10074 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10075 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10076 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10077 struct image_keyword fmt[XBM_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10078 Lisp_Object data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10079 int depth; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10080 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10081 unsigned long background = FRAME_BACKGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10082 char *bits; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10083 int parsed_p; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10084 int in_memory_file_p = 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10085 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10086 /* 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
|
10087 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
|
10088 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
|
10089 |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
10090 /* Parse the image specification. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10091 bcopy (xbm_format, fmt, sizeof fmt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10092 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
|
10093 xassert (parsed_p); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10094 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10095 /* Get specified width, and height. */ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10096 if (!in_memory_file_p) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10097 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10098 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
|
10099 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
|
10100 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
|
10101 } |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
10102 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10103 /* 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
|
10104 if (fmt[XBM_FOREGROUND].count |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10105 && STRINGP (fmt[XBM_FOREGROUND].value)) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10106 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
|
10107 foreground); |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10108 if (fmt[XBM_BACKGROUND].count |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10109 && STRINGP (fmt[XBM_BACKGROUND].value)) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10110 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
|
10111 background); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10112 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10113 if (in_memory_file_p) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10114 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
|
10115 (XSTRING (data)->data |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10116 + STRING_BYTES (XSTRING (data)))); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10117 else |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10118 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10119 if (VECTORP (data)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10120 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10121 int i; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10122 char *p; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10123 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
|
10124 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10125 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
|
10126 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
|
10127 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10128 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
|
10129 if (STRINGP (line)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10130 bcopy (XSTRING (line)->data, p, nbytes); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10131 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10132 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
|
10133 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10134 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10135 else if (STRINGP (data)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10136 bits = XSTRING (data)->data; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10137 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10138 bits = XBOOL_VECTOR (data)->data; |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
10139 #ifdef TODO /* full image support. */ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10140 /* Create the pixmap. */ |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10141 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
|
10142 img->pixmap |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10143 = XCreatePixmapFromBitmapData (FRAME_X_DISPLAY (f), |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10144 FRAME_X_WINDOW (f), |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10145 bits, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10146 img->width, img->height, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10147 foreground, background, |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10148 depth); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10149 #endif |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10150 if (img->pixmap) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10151 success_p = 1; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10152 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10153 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10154 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
|
10155 img->spec, Qnil); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10156 x_clear_image (f, img); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10157 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10158 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10159 } |
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 return success_p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10162 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10163 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10164 |
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 XPM images |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10170 #if HAVE_XPM |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10171 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10172 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
|
10173 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
|
10174 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
|
10175 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10176 #include "X11/xpm.h" |
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 symbol `xpm' identifying XPM-format images. */ |
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 Lisp_Object Qxpm; |
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 /* 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
|
10183 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10184 enum xpm_keyword_index |
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 XPM_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10187 XPM_FILE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10188 XPM_DATA, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10189 XPM_ASCENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10190 XPM_MARGIN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10191 XPM_RELIEF, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10192 XPM_ALGORITHM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10193 XPM_HEURISTIC_MASK, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10194 XPM_MASK, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10195 XPM_COLOR_SYMBOLS, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10196 XPM_BACKGROUND, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10197 XPM_LAST |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10198 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10199 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10200 /* 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
|
10201 of valid XPM image specifications. */ |
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 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
|
10204 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10205 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10206 {":file", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10207 {":data", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10208 {":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
|
10209 {":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
|
10210 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
10211 {":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
|
10212 {":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
|
10213 {":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
|
10214 {":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
|
10215 {":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
|
10216 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10217 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10218 /* Structure describing the image type XBM. */ |
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 static struct image_type xpm_type = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10221 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10222 &Qxpm, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10223 xpm_image_p, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10224 xpm_load, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10225 x_clear_image, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10226 NULL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10227 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10228 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10229 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10230 /* 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
|
10231 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
|
10232 cdr are strings. */ |
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 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10235 xpm_valid_color_symbols_p (color_symbols) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10236 Lisp_Object color_symbols; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10237 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10238 while (CONSP (color_symbols)) |
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 Lisp_Object sym = XCAR (color_symbols); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10241 if (!CONSP (sym) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10242 || !STRINGP (XCAR (sym)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10243 || !STRINGP (XCDR (sym))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10244 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10245 color_symbols = XCDR (color_symbols); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10246 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10247 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10248 return NILP (color_symbols); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10249 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10250 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10251 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10252 /* 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
|
10253 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10254 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10255 xpm_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10256 Lisp_Object object; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10257 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10258 struct image_keyword fmt[XPM_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10259 bcopy (xpm_format, fmt, sizeof fmt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10260 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
|
10261 /* Either `:file' or `:data' must be present. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10262 && 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
|
10263 /* 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
|
10264 whose car and cdr are strings. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10265 && (fmt[XPM_COLOR_SYMBOLS].count == 0 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10266 || 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
|
10267 && (fmt[XPM_ASCENT].count == 0 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10268 || XFASTINT (fmt[XPM_ASCENT].value) < 100)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10269 } |
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 /* 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
|
10273 non-zero if successful. */ |
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 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10276 xpm_load (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10277 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10278 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10279 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10280 int rc, i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10281 XpmAttributes attrs; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10282 Lisp_Object specified_file, color_symbols; |
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 /* 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
|
10285 close colors. Return colors allocated. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10286 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
|
10287 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
|
10288 attrs.colormap = FRAME_X_COLORMAP (f); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10289 attrs.valuemask |= XpmVisual; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
10290 attrs.valuemask |= XpmColormap; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10291 attrs.valuemask |= XpmReturnAllocPixels; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
10292 #ifdef XpmAllocCloseColors |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10293 attrs.alloc_close_colors = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10294 attrs.valuemask |= XpmAllocCloseColors; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
10295 #else |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
10296 attrs.closeness = 600; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
10297 attrs.valuemask |= XpmCloseness; |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
10298 #endif |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10299 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10300 /* 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
|
10301 these to `attrs'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10302 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
|
10303 if (CONSP (color_symbols)) |
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 Lisp_Object tail; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10306 XpmColorSymbol *xpm_syms; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10307 int i, size; |
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 attrs.valuemask |= XpmColorSymbols; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10310 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10311 /* Count number of symbols. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10312 attrs.numsymbols = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10313 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
|
10314 ++attrs.numsymbols; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10315 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10316 /* Allocate an XpmColorSymbol array. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10317 size = attrs.numsymbols * sizeof *xpm_syms; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10318 xpm_syms = (XpmColorSymbol *) alloca (size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10319 bzero (xpm_syms, size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10320 attrs.colorsymbols = xpm_syms; |
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 /* Fill the color symbol array. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10323 for (tail = color_symbols, i = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10324 CONSP (tail); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10325 ++i, tail = XCDR (tail)) |
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 Lisp_Object name = XCAR (XCAR (tail)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10328 Lisp_Object color = XCDR (XCAR (tail)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10329 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
|
10330 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
|
10331 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
|
10332 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
|
10333 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10334 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10335 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10336 /* 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
|
10337 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
|
10338 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10339 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
|
10340 if (STRINGP (specified_file)) |
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 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
|
10343 if (!STRINGP (file)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10344 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10345 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
|
10346 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10347 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10348 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10349 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10350 rc = XpmReadFileToPixmap (NULL, FRAME_W32_WINDOW (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10351 XSTRING (file)->data, &img->pixmap, &img->mask, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10352 &attrs); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10353 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10354 else |
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 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
|
10357 rc = XpmCreatePixmapFromBuffer (NULL, FRAME_W32_WINDOW (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10358 XSTRING (buffer)->data, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10359 &img->pixmap, &img->mask, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10360 &attrs); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10361 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10362 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10363 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10364 if (rc == XpmSuccess) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10365 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10366 /* Remember allocated colors. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10367 img->ncolors = attrs.nalloc_pixels; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10368 img->colors = (unsigned long *) xmalloc (img->ncolors |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10369 * sizeof *img->colors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10370 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
|
10371 img->colors[i] = attrs.alloc_pixels[i]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10372 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10373 img->width = attrs.width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10374 img->height = attrs.height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10375 xassert (img->width > 0 && img->height > 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10376 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10377 /* 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
|
10378 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10379 XpmFreeAttributes (&attrs); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10380 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10381 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10382 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10383 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10384 switch (rc) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10385 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10386 case XpmOpenFailed: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10387 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
|
10388 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10389 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10390 case XpmFileInvalid: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10391 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
|
10392 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10393 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10394 case XpmNoMemory: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10395 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
|
10396 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10397 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10398 case XpmColorFailed: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10399 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
|
10400 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10401 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10402 default: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10403 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
|
10404 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10405 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10406 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10407 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10408 return rc == XpmSuccess; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10409 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10410 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10411 #endif /* HAVE_XPM != 0 */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10412 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10413 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
10414 #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
|
10415 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10416 Color table |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10417 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10418 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10419 /* 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
|
10420 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10421 struct ct_color |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10422 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10423 int r, g, b; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10424 unsigned long pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10425 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10426 /* Next in color table collision list. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10427 struct ct_color *next; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10428 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10429 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10430 /* 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
|
10431 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10432 #define CT_SIZE 101 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10433 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10434 /* 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
|
10435 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10436 #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
|
10437 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10438 /* The color hash table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10439 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10440 struct ct_color **ct_table; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10441 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10442 /* Number of entries in the color table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10443 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10444 int ct_colors_allocated; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10445 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10446 /* Function prototypes. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10447 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10448 static void init_color_table P_ ((void)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10449 static void free_color_table P_ ((void)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10450 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
|
10451 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
|
10452 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
|
10453 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10454 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10455 /* Initialize the color table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10456 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10457 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10458 init_color_table () |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10459 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10460 int size = CT_SIZE * sizeof (*ct_table); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10461 ct_table = (struct ct_color **) xmalloc (size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10462 bzero (ct_table, size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10463 ct_colors_allocated = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10464 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10465 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10466 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10467 /* Free memory associated with the color table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10468 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10469 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10470 free_color_table () |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10471 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10472 int i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10473 struct ct_color *p, *next; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10474 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10475 for (i = 0; i < CT_SIZE; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10476 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
|
10477 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10478 next = p->next; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10479 xfree (p); |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10482 xfree (ct_table); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10483 ct_table = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10484 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10485 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10486 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10487 /* 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
|
10488 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
|
10489 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
|
10490 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
|
10491 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10492 static unsigned long |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10493 lookup_rgb_color (f, r, g, b) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10494 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10495 int r, g, b; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10496 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10497 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
|
10498 int i = hash % CT_SIZE; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10499 struct ct_color *p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10500 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10501 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
|
10502 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
|
10503 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10504 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10505 if (p == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10506 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10507 COLORREF color; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10508 Colormap cmap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10509 int rc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10510 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10511 color = PALETTERGB (r, g, b); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10512 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10513 ++ct_colors_allocated; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10514 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10515 p = (struct ct_color *) xmalloc (sizeof *p); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10516 p->r = r; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10517 p->g = g; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10518 p->b = b; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10519 p->pixel = color; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10520 p->next = ct_table[i]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10521 ct_table[i] = p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10522 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10523 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10524 return p->pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10525 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10526 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10527 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10528 /* 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
|
10529 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
|
10530 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10531 static unsigned long |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10532 lookup_pixel_color (f, pixel) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10533 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10534 unsigned long pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10535 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10536 int i = pixel % CT_SIZE; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10537 struct ct_color *p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10538 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10539 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
|
10540 if (p->pixel == pixel) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10541 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10542 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10543 if (p == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10544 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10545 XColor color; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10546 Colormap cmap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10547 int rc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10548 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10549 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10550 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10551 cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10552 color.pixel = pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10553 XQueryColor (NULL, cmap, &color); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10554 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
|
10555 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10556 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10557 if (rc) |
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 ++ct_colors_allocated; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10560 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10561 p = (struct ct_color *) xmalloc (sizeof *p); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10562 p->r = color.red; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10563 p->g = color.green; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10564 p->b = color.blue; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10565 p->pixel = pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10566 p->next = ct_table[i]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10567 ct_table[i] = p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10568 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10569 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10570 return FRAME_FOREGROUND_PIXEL (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10571 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10572 return p->pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10573 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10574 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10575 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10576 /* 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
|
10577 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
|
10578 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10579 static unsigned long * |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10580 colors_in_color_table (n) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10581 int *n; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10582 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10583 int i, j; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10584 struct ct_color *p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10585 unsigned long *colors; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10586 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10587 if (ct_colors_allocated == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10588 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10589 *n = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10590 colors = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10591 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10592 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10593 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10594 colors = (unsigned long *) xmalloc (ct_colors_allocated |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10595 * sizeof *colors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10596 *n = ct_colors_allocated; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10597 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10598 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
|
10599 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
|
10600 colors[j++] = p->pixel; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10601 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10602 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10603 return colors; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10604 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10605 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
10606 #endif /* TODO */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10607 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10608 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10609 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10610 Algorithms |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10611 ***********************************************************************/ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10612 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
|
10613 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
|
10614 static void x_detect_edges P_ ((struct frame *, struct image *, int[9], int)); |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10615 static void XPutPixel (XImage *, int, int, COLORREF); |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10616 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10617 /* 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
|
10618 disabled'. */ |
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 int cross_disabled_images; |
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 /* 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
|
10623 strategies. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10624 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10625 static int emboss_matrix[9] = { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10626 /* x - 1 x x + 1 */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10627 2, -1, 0, /* y - 1 */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10628 -1, 0, 1, /* y */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10629 0, 1, -2 /* y + 1 */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10630 }; |
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 static int laplace_matrix[9] = { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10633 /* x - 1 x x + 1 */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10634 1, 0, 0, /* y - 1 */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10635 0, 0, 0, /* y */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10636 0, 0, -1 /* y + 1 */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10637 }; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10638 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10639 /* 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
|
10640 are R, G, and B. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10641 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10642 #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
|
10643 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10644 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10645 /* 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
|
10646 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
|
10647 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
|
10648 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
|
10649 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
|
10650 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10651 static XColor * |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10652 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
|
10653 struct frame *f; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10654 struct image *img; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10655 int rgb_p; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10656 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10657 int x, y; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10658 XColor *colors, *p; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10659 XImage *ximg; |
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 colors = (XColor *) xmalloc (img->width * img->height * sizeof *colors); |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10662 #if 0 /* TODO: implement image colors. */ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10663 /* Get the X image IMG->pixmap. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10664 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
|
10665 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
|
10666 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10667 /* 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
|
10668 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
|
10669 p = colors; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10670 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
|
10671 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10672 XColor *row = p; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10673 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10674 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
|
10675 p->pixel = XGetPixel (ximg, x, y); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10676 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10677 if (rgb_p) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10678 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
|
10679 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10680 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10681 XDestroyImage (ximg); |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10682 #endif |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10683 return colors; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10684 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10685 |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10686 /* Put a pixel of COLOR at position X, Y in XIMG. XIMG must have been |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10687 created with CreateDIBSection, with the pointer to the bit values |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10688 stored in ximg->data. */ |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10689 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10690 static void XPutPixel (ximg, x, y, color) |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10691 XImage * ximg; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10692 int x, y; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10693 COLORREF color; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10694 { |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10695 int width = ximg->info.bmiHeader.biWidth; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10696 int height = ximg->info.bmiHeader.biHeight; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10697 int rowbytes = width * 3; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10698 unsigned char * pixel; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10699 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10700 /* Don't support putting pixels in images with palettes. */ |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10701 xassert (ximg->info.bmiHeader.biBitCount == 24); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10702 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10703 /* Ensure scanlines are aligned on 4 byte boundaries. */ |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10704 if (rowbytes % 4) |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10705 rowbytes += 4 - (rowbytes % 4); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10706 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10707 pixel = ximg->data + y * rowbytes + x * 3; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10708 *pixel = 255 - GetRValue (color); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10709 *(pixel + 1) = 255 - GetGValue (color); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10710 *(pixel + 2) = 255 - GetBValue (color); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10711 } |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10712 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10713 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10714 /* 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
|
10715 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
|
10716 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
|
10717 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10718 static void |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10719 x_from_xcolors (f, img, colors) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10720 struct frame *f; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10721 struct image *img; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10722 XColor *colors; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10723 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10724 int x, y; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10725 XImage *oimg; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10726 Pixmap pixmap; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10727 XColor *p; |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10728 #if 0 /* TODO: color tables. */ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10729 init_color_table (); |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10730 #endif |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10731 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
|
10732 &oimg, &pixmap); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10733 p = colors; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10734 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
|
10735 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
|
10736 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10737 unsigned long pixel; |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10738 #if 0 /* TODO: color tables. */ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10739 pixel = lookup_rgb_color (f, p->red, p->green, p->blue); |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10740 #else |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10741 pixel = PALETTERGB (p->red, p->green, p->blue); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10742 #endif |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10743 XPutPixel (oimg, x, y, pixel); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10744 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10745 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10746 xfree (colors); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10747 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
|
10748 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10749 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
|
10750 x_destroy_x_image (oimg); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10751 img->pixmap = pixmap; |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10752 #if 0 /* TODO: color tables. */ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10753 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
|
10754 free_color_table (); |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10755 #endif |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10756 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10757 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10758 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10759 /* 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
|
10760 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10761 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
|
10762 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
|
10763 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10764 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
|
10765 outgoing image. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10766 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10767 static void |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10768 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
|
10769 struct frame *f; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10770 struct image *img; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10771 int matrix[9], color_adjust; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10772 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10773 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
|
10774 XColor *new, *p; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10775 int x, y, i, sum; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10776 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10777 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
|
10778 sum += abs (matrix[i]); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10779 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10780 #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
|
10781 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10782 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
|
10783 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10784 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
|
10785 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10786 p = COLOR (new, 0, y); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10787 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
|
10788 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
|
10789 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
|
10790 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10791 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10792 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
|
10793 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10794 p = COLOR (new, x, 0); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10795 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
|
10796 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
|
10797 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
|
10798 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10799 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10800 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
|
10801 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10802 p = COLOR (new, 1, y); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10803 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10804 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
|
10805 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10806 int r, g, b, y1, x1; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10807 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10808 r = g = b = i = 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10809 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
|
10810 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
|
10811 if (matrix[i]) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10812 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10813 XColor *t = COLOR (colors, x1, y1); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10814 r += matrix[i] * t->red; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10815 g += matrix[i] * t->green; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10816 b += matrix[i] * t->blue; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10817 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10818 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10819 r = (r / sum + color_adjust) & 0xffff; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10820 g = (g / sum + color_adjust) & 0xffff; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10821 b = (b / sum + color_adjust) & 0xffff; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10822 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
|
10823 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10824 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10825 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10826 xfree (colors); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10827 x_from_xcolors (f, img, new); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10828 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10829 #undef COLOR |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10830 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10831 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10832 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10833 /* 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
|
10834 on frame F. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10835 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10836 static void |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10837 x_emboss (f, img) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10838 struct frame *f; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10839 struct image *img; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10840 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10841 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
|
10842 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10843 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10844 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10845 /* 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
|
10846 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
|
10847 to draw disabled buttons, for example. */ |
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 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10850 x_laplace (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10851 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10852 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10853 { |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10854 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
|
10855 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10856 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10857 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10858 /* 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
|
10859 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
|
10860 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10861 MATRIX must be either |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10862 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10863 - 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
|
10864 - 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
|
10865 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10866 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
|
10867 number. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10868 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10869 static void |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10870 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
|
10871 struct frame *f; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10872 struct image *img; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10873 Lisp_Object matrix, color_adjust; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10874 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10875 int i = 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10876 int trans[9]; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10877 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10878 if (CONSP (matrix)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10879 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10880 for (i = 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10881 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
|
10882 ++i, matrix = XCDR (matrix)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10883 trans[i] = XFLOATINT (XCAR (matrix)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10884 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10885 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
|
10886 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10887 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
|
10888 trans[i] = XFLOATINT (AREF (matrix, i)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10889 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10890 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10891 if (NILP (color_adjust)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10892 color_adjust = make_number (0xffff / 2); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10893 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10894 if (i == 9 && NUMBERP (color_adjust)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10895 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
|
10896 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10897 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10898 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10899 /* 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
|
10900 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10901 static void |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10902 x_disable_image (f, img) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10903 struct frame *f; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10904 struct image *img; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10905 { |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10906 struct w32_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10907 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10908 if (dpyinfo->n_planes * dpyinfo->n_cbits >= 2) |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10909 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10910 /* 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
|
10911 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
|
10912 we're using this method instead. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10913 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
|
10914 XColor *p, *end; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10915 const int h = 15000; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10916 const int l = 30000; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10917 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10918 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
|
10919 p < end; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10920 ++p) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10921 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10922 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
|
10923 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
|
10924 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
|
10925 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10926 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10927 x_from_xcolors (f, img, colors); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10928 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10929 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10930 /* 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
|
10931 should. */ |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10932 if (dpyinfo->n_planes * dpyinfo->n_cbits < 2 || cross_disabled_images) |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10933 { |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10934 #if 0 /* TODO: full image support */ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10935 Display *dpy = FRAME_X_DISPLAY (f); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10936 GC gc; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10937 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10938 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
|
10939 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
|
10940 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
|
10941 img->width - 1, img->height - 1); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10942 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
|
10943 img->width - 1, 0); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10944 XFreeGC (dpy, gc); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10945 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10946 if (img->mask) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10947 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10948 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
|
10949 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
|
10950 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
|
10951 img->width - 1, img->height - 1); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10952 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
|
10953 img->width - 1, 0); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10954 XFreeGC (dpy, gc); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10955 } |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10956 #endif |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
10957 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10958 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10959 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10960 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10961 /* 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
|
10962 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
|
10963 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
|
10964 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
|
10965 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
|
10966 heuristically. Value is non-zero if successful. */ |
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 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10969 x_build_heuristic_mask (f, img, how) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10970 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10971 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10972 Lisp_Object how; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10973 { |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
10974 #if 0 /* TODO: full image support. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10975 Display *dpy = FRAME_W32_DISPLAY (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10976 XImage *ximg, *mask_img; |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10977 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
|
10978 unsigned long bg = 0; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10979 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10980 if (img->mask) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10981 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10982 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
|
10983 img->mask = None; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10984 img->background_transparent_valid = 0; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10985 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10986 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10987 /* 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
|
10988 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
|
10989 &mask_img, &img->mask); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10990 if (!rc) |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
10991 return 0; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10992 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10993 /* Get the X image of IMG->pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10994 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
|
10995 ~0, ZPixmap); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10996 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
10997 /* 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
|
10998 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
|
10999 use_img_background = 1; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11000 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11001 if (CONSP (how)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11002 { |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11003 int rgb[3], i; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11004 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11005 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
|
11006 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11007 rgb[i] = XFASTINT (XCAR (how)) & 0xffff; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11008 how = XCDR (how); |
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 (i == 3 && NILP (how)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11012 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11013 char color_name[30]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11014 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
|
11015 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
|
11016 use_img_background = 0; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11017 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11018 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11019 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11020 if (use_img_background) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11021 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
|
11022 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11023 /* 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
|
11024 from the background color bg. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11025 for (y = 0; y < img->height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11026 for (x = 0; x < img->width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11027 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
|
11028 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11029 /* 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
|
11030 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
|
11031 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11032 /* Put mask_img into img->mask. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11033 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
|
11034 x_destroy_x_image (mask_img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11035 XDestroyImage (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11036 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11037 return 1; |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11038 #else |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11039 return 0; |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11040 #endif |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11041 } |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
11042 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11043 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11044 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11045 PBM (mono, gray, color) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11046 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11047 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11048 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
|
11049 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
|
11050 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
|
11051 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11052 /* 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
|
11053 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11054 Lisp_Object Qpbm; |
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 /* 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
|
11057 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11058 enum pbm_keyword_index |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11059 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11060 PBM_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11061 PBM_FILE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11062 PBM_DATA, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11063 PBM_ASCENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11064 PBM_MARGIN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11065 PBM_RELIEF, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11066 PBM_ALGORITHM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11067 PBM_HEURISTIC_MASK, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11068 PBM_MASK, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11069 PBM_FOREGROUND, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11070 PBM_BACKGROUND, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11071 PBM_LAST |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11074 /* 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
|
11075 of valid user-defined image specifications. */ |
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 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
|
11078 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11079 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11080 {":file", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11081 {":data", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11082 {":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
|
11083 {":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
|
11084 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
11085 {":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
|
11086 {":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
|
11087 {":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
|
11088 {":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
|
11089 {":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
|
11090 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11091 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11092 /* Structure describing the image type `pbm'. */ |
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 static struct image_type pbm_type = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11095 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11096 &Qpbm, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11097 pbm_image_p, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11098 pbm_load, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11099 x_clear_image, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11100 NULL |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11104 /* 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
|
11105 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11106 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11107 pbm_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11108 Lisp_Object object; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11109 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11110 struct image_keyword fmt[PBM_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11111 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11112 bcopy (pbm_format, fmt, sizeof fmt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11113 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11114 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
|
11115 || (fmt[PBM_ASCENT].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11116 && XFASTINT (fmt[PBM_ASCENT].value) > 100)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11117 return 0; |
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 /* Must specify either :data or :file. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11120 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
|
11121 } |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11124 /* 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
|
11125 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
|
11126 end of input. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11127 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11128 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11129 pbm_scan_number (s, end) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11130 unsigned char **s, *end; |
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 int c, val = -1; |
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 while (*s < end) |
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 /* Skip white-space. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11137 while (*s < end && (c = *(*s)++, isspace (c))) |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11140 if (c == '#') |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11141 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11142 /* Skip comment to end of line. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11143 while (*s < end && (c = *(*s)++, c != '\n')) |
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 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11146 else if (isdigit (c)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11147 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11148 /* Read decimal number. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11149 val = c - '0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11150 while (*s < end && (c = *(*s)++, isdigit (c))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11151 val = 10 * val + c - '0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11152 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11153 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11154 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11155 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11156 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11157 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11158 return val; |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11161 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11162 /* 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
|
11163 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
|
11164 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
|
11165 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11166 static char * |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11167 pbm_read_file (file, size) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11168 Lisp_Object file; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11169 int *size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11170 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11171 FILE *fp = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11172 char *buf = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11173 struct stat st; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11174 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11175 if (stat (XSTRING (file)->data, &st) == 0 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11176 && (fp = fopen (XSTRING (file)->data, "r")) != NULL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11177 && (buf = (char *) xmalloc (st.st_size), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11178 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
|
11179 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11180 *size = st.st_size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11181 fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11182 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11183 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11184 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11185 if (fp) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11186 fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11187 if (buf) |
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 xfree (buf); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11190 buf = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11191 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11192 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11193 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11194 return buf; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11195 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11196 |
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 /* 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
|
11199 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11200 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11201 pbm_load (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11202 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11203 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11204 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11205 int raw_p, x, y; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11206 int width, height, max_color_idx = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11207 XImage *ximg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11208 Lisp_Object file, specified_file; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11209 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
|
11210 struct gcpro gcpro1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11211 unsigned char *contents = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11212 unsigned char *end, *p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11213 int size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11214 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11215 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
|
11216 file = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11217 GCPRO1 (file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11218 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11219 if (STRINGP (specified_file)) |
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 file = x_find_image_file (specified_file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11222 if (!STRINGP (file)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11223 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11224 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
|
11225 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11226 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11227 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11228 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11229 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
|
11230 if (contents == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11231 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11232 image_error ("Error reading `%s'", file, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11233 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11234 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11235 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11236 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11237 p = contents; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11238 end = contents + size; |
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 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11241 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11242 Lisp_Object data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11243 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
|
11244 p = XSTRING (data)->data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11245 end = p + STRING_BYTES (XSTRING (data)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11246 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11247 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11248 /* Check magic number. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11249 if (end - p < 2 || *p++ != 'P') |
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 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
|
11252 error: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11253 xfree (contents); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11254 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11255 return 0; |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11258 switch (*p++) |
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 case '1': |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11261 raw_p = 0, type = PBM_MONO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11262 break; |
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 case '2': |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11265 raw_p = 0, type = PBM_GRAY; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11266 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11267 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11268 case '3': |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11269 raw_p = 0, type = PBM_COLOR; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11270 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11271 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11272 case '4': |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11273 raw_p = 1, type = PBM_MONO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11274 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11275 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11276 case '5': |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11277 raw_p = 1, type = PBM_GRAY; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11278 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11279 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11280 case '6': |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11281 raw_p = 1, type = PBM_COLOR; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11282 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11283 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11284 default: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11285 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
|
11286 goto error; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11287 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11288 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11289 /* Read width, height, maximum color-component. Characters |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11290 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
|
11291 width = pbm_scan_number (&p, end); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11292 height = pbm_scan_number (&p, end); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11293 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11294 if (type != PBM_MONO) |
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 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
|
11297 if (raw_p && max_color_idx > 255) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11298 max_color_idx = 255; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11299 } |
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 if (width < 0 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11302 || height < 0 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11303 || (type != PBM_MONO && max_color_idx < 0)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11304 goto error; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11305 |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11306 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11307 goto error; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11308 |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11309 #if 0 /* TODO: color tables. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11310 /* Initialize the color hash table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11311 init_color_table (); |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11312 #endif |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11313 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11314 if (type == PBM_MONO) |
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 int c = 0, g; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11317 struct image_keyword fmt[PBM_LAST]; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11318 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
|
11319 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
|
11320 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11321 /* Parse the image specification. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11322 bcopy (pbm_format, fmt, sizeof fmt); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11323 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
|
11324 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11325 /* 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
|
11326 if (fmt[PBM_FOREGROUND].count |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11327 && STRINGP (fmt[PBM_FOREGROUND].value)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11328 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
|
11329 if (fmt[PBM_BACKGROUND].count |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11330 && STRINGP (fmt[PBM_BACKGROUND].value)) |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11331 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11332 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
|
11333 img->background = bg; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11334 img->background_valid = 1; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11335 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11336 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11337 for (y = 0; y < height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11338 for (x = 0; x < width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11339 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11340 if (raw_p) |
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 if ((x & 7) == 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11343 c = *p++; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11344 g = c & 0x80; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11345 c <<= 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11346 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11347 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11348 g = pbm_scan_number (&p, end); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11349 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
11350 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
|
11351 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11352 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11353 else |
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 for (y = 0; y < height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11356 for (x = 0; x < width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11357 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11358 int r, g, b; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11359 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11360 if (type == PBM_GRAY) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11361 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
|
11362 else if (raw_p) |
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 r = *p++; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11365 g = *p++; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11366 b = *p++; |
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 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11369 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11370 r = pbm_scan_number (&p, end); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11371 g = pbm_scan_number (&p, end); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11372 b = pbm_scan_number (&p, end); |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11375 if (r < 0 || g < 0 || b < 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11376 { |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11377 x_destroy_x_image (ximg); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11378 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
|
11379 img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11380 goto error; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11381 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11382 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11383 /* RGB values are now in the range 0..max_color_idx. |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11384 Scale this to the range 0..0xff supported by W32. */ |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11385 r = (int) ((double) r * 255 / max_color_idx); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11386 g = (int) ((double) g * 255 / max_color_idx); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11387 b = (int) ((double) b * 255 / max_color_idx); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11388 XPutPixel (ximg, x, y, |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11389 #if 0 /* TODO: color tables. */ |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11390 lookup_rgb_color (f, r, g, b)); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11391 #else |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11392 PALETTERGB (r, g, b)); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11393 #endif |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11394 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11395 } |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11396 |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11397 #if 0 /* TODO: color tables. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11398 /* 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
|
11399 free the color table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11400 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
|
11401 free_color_table (); |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
11402 #endif |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11403 /* 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
|
11404 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
|
11405 IMAGE_BACKGROUND (img, f, ximg); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11406 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11407 /* Put the image into a pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11408 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
|
11409 x_destroy_x_image (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11410 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11411 img->width = width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11412 img->height = height; |
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 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11415 xfree (contents); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11416 return 1; |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11419 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11420 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11421 PNG |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11424 #if HAVE_PNG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11425 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11426 #include <png.h> |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11427 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11428 /* Function prototypes. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11429 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11430 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
|
11431 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
|
11432 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11433 /* 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
|
11434 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11435 Lisp_Object Qpng; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11436 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11437 /* 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
|
11438 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11439 enum png_keyword_index |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11440 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11441 PNG_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11442 PNG_DATA, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11443 PNG_FILE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11444 PNG_ASCENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11445 PNG_MARGIN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11446 PNG_RELIEF, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11447 PNG_ALGORITHM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11448 PNG_HEURISTIC_MASK, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11449 PNG_MASK, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11450 PNG_BACKGROUND, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11451 PNG_LAST |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11452 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11453 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11454 /* 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
|
11455 of valid user-defined image specifications. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11456 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11457 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
|
11458 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11459 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11460 {":data", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11461 {":file", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11462 {":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
|
11463 {":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
|
11464 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
11465 {":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
|
11466 {":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
|
11467 {":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
|
11468 {":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
|
11469 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11470 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11471 /* Structure describing the image type `png'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11472 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11473 static struct image_type png_type = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11474 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11475 &Qpng, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11476 png_image_p, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11477 png_load, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11478 x_clear_image, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11479 NULL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11480 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11481 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11482 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11483 /* 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
|
11484 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11485 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11486 png_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11487 Lisp_Object object; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11488 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11489 struct image_keyword fmt[PNG_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11490 bcopy (png_format, fmt, sizeof fmt); |
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 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
|
11493 || (fmt[PNG_ASCENT].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11494 && XFASTINT (fmt[PNG_ASCENT].value) > 100)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11495 return 0; |
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 /* 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
|
11498 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
|
11499 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11500 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11501 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11502 /* 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
|
11503 is initialized. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11504 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11505 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11506 my_png_error (png_ptr, msg) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11507 png_struct *png_ptr; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11508 char *msg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11509 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11510 xassert (png_ptr != NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11511 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
|
11512 longjmp (png_ptr->jmpbuf, 1); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11513 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11514 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11515 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11516 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11517 my_png_warning (png_ptr, msg) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11518 png_struct *png_ptr; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11519 char *msg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11520 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11521 xassert (png_ptr != NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11522 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
|
11523 } |
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 /* Memory source for PNG decoding. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11526 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11527 struct png_memory_storage |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11528 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11529 unsigned char *bytes; /* The data */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11530 size_t len; /* How big is it? */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11531 int index; /* Where are we? */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11532 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11533 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11534 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11535 /* 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
|
11536 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
|
11537 bytes from the input to DATA. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11538 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11539 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11540 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
|
11541 png_structp png_ptr; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11542 png_bytep data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11543 png_size_t length; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11544 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11545 struct png_memory_storage *tbr |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11546 = (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
|
11547 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11548 if (length > tbr->len - tbr->index) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11549 png_error (png_ptr, "Read error"); |
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 bcopy (tbr->bytes + tbr->index, data, length); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11552 tbr->index = tbr->index + length; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11553 } |
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 /* 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
|
11556 successful. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11557 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11558 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11559 png_load (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11560 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11561 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11562 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11563 Lisp_Object file, specified_file; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11564 Lisp_Object specified_data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11565 int x, y, i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11566 XImage *ximg, *mask_img = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11567 struct gcpro gcpro1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11568 png_struct *png_ptr = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11569 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
|
11570 FILE *volatile fp = NULL; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11571 png_byte sig[8]; |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11572 png_byte *volatile pixels = NULL; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11573 png_byte **volatile rows = NULL; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11574 png_uint_32 width, height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11575 int bit_depth, color_type, interlace_type; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11576 png_byte channels; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11577 png_uint_32 row_bytes; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11578 int transparent_p; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11579 char *gamma_str; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11580 double screen_gamma, image_gamma; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11581 int intent; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11582 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
|
11583 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11584 /* Find out what file to load. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11585 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
|
11586 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
|
11587 file = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11588 GCPRO1 (file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11589 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11590 if (NILP (specified_data)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11591 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11592 file = x_find_image_file (specified_file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11593 if (!STRINGP (file)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11594 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11595 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
|
11596 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11597 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11598 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11599 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11600 /* Open the image file. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11601 fp = fopen (XSTRING (file)->data, "rb"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11602 if (!fp) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11603 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11604 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
|
11605 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11606 fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11607 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11608 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11609 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11610 /* Check PNG signature. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11611 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
|
11612 || !png_check_sig (sig, sizeof sig)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11613 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11614 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
|
11615 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11616 fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11617 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11618 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11619 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11620 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11621 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11622 /* Read from memory. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11623 tbr.bytes = XSTRING (specified_data)->data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11624 tbr.len = STRING_BYTES (XSTRING (specified_data)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11625 tbr.index = 0; |
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 /* Check PNG signature. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11628 if (tbr.len < sizeof sig |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11629 || !png_check_sig (tbr.bytes, sizeof sig)) |
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 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
|
11632 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11633 return 0; |
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 /* Need to skip past the signature. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11637 tbr.bytes += sizeof (sig); |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11640 /* 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
|
11641 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
|
11642 my_png_error, my_png_warning); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11643 if (!png_ptr) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11644 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11645 if (fp) fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11646 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11647 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11648 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11649 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11650 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
|
11651 if (!info_ptr) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11652 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11653 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
|
11654 if (fp) fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11655 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11656 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11657 } |
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 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
|
11660 if (!end_info) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11661 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11662 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
|
11663 if (fp) fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11664 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11665 return 0; |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11668 /* 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
|
11669 detects an error. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11670 if (setjmp (png_ptr->jmpbuf)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11671 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11672 error: |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11673 if (png_ptr) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11674 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
|
11675 xfree (pixels); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11676 xfree (rows); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11677 if (fp) fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11678 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11679 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11680 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11681 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11682 /* Read image info. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11683 if (!NILP (specified_data)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11684 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
|
11685 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11686 png_init_io (png_ptr, fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11687 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11688 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
|
11689 png_read_info (png_ptr, info_ptr); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11690 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
|
11691 &interlace_type, NULL, NULL); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11692 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11693 /* If 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
|
11694 construct a clipping mask. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11695 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
|
11696 transparent_p = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11697 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11698 transparent_p = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11699 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11700 /* 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
|
11701 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
|
11702 transform other formats into that format. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11703 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11704 /* Strip more than 8 bits per channel. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11705 if (bit_depth == 16) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11706 png_set_strip_16 (png_ptr); |
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 /* 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
|
11709 if available. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11710 png_set_expand (png_ptr); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11711 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11712 /* Convert grayscale images to RGB. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11713 if (color_type == PNG_COLOR_TYPE_GRAY |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11714 || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11715 png_set_gray_to_rgb (png_ptr); |
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 /* 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
|
11718 gamma_str = getenv ("SCREEN_GAMMA"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11719 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
|
11720 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11721 /* 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
|
11722 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11723 #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
|
11724 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
|
11725 /* 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
|
11726 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
|
11727 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11728 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11729 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
|
11730 /* Image contains gamma information. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11731 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
|
11732 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11733 /* 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
|
11734 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
|
11735 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11736 /* 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
|
11737 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
|
11738 simple transparency, we prefer a clipping mask. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11739 if (!transparent_p) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11740 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11741 png_color_16 *image_background; |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11742 Lisp_Object specified_bg |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11743 = 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
|
11744 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11745 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11746 if (STRINGP (specified_bg)) |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11747 /* The user specified `:background', use that. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11748 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11749 COLORREF color; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11750 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
|
11751 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11752 png_color_16 user_bg; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11753 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11754 bzero (&user_bg, sizeof user_bg); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11755 user_bg.red = color.red; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11756 user_bg.green = color.green; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11757 user_bg.blue = color.blue; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11758 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11759 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
|
11760 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
|
11761 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11762 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11763 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
|
11764 /* 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
|
11765 combine the image. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11766 png_set_background (png_ptr, image_background, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11767 PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11768 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11769 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11770 /* 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
|
11771 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
|
11772 the frame's background instead. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11773 XColor color; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11774 Colormap cmap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11775 png_color_16 frame_background; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11776 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11777 cmap = FRAME_X_COLORMAP (f); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11778 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
|
11779 x_query_color (f, &color); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11780 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11781 bzero (&frame_background, sizeof frame_background); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11782 frame_background.red = color.red; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11783 frame_background.green = color.green; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11784 frame_background.blue = color.blue; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11785 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11786 png_set_background (png_ptr, &frame_background, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11787 PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11788 } |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11791 /* Update info structure. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11792 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
|
11793 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11794 /* 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
|
11795 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
|
11796 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
|
11797 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
|
11798 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
|
11799 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
|
11800 xassert (channels == 3 || channels == 4); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11801 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11802 /* 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
|
11803 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
|
11804 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11805 /* Allocate memory for the image. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11806 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
|
11807 rows = (png_byte **) xmalloc (height * sizeof *rows); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11808 for (i = 0; i < height; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11809 rows[i] = pixels + i * row_bytes; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11810 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11811 /* Read the entire image. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11812 png_read_image (png_ptr, rows); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11813 png_read_end (png_ptr, info_ptr); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11814 if (fp) |
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 fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11817 fp = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11818 } |
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 /* Create the X image and pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11821 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
|
11822 &img->pixmap)) |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11823 goto error; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11824 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11825 /* 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
|
11826 contains an alpha channel. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11827 if (channels == 4 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11828 && !transparent_p |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11829 && !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
|
11830 &mask_img, &img->mask)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11831 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11832 x_destroy_x_image (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11833 XFreePixmap (FRAME_W32_DISPLAY (f), img->pixmap); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11834 img->pixmap = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11835 goto error; |
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 /* 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
|
11839 init_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11840 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11841 for (y = 0; y < height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11842 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11843 png_byte *p = rows[y]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11844 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11845 for (x = 0; x < width; ++x) |
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 unsigned r, g, b; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11848 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11849 r = *p++ << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11850 g = *p++ << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11851 b = *p++ << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11852 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
|
11853 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11854 /* 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
|
11855 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
|
11856 support binary transparency---fully transparent or fully |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11857 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
|
11858 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
|
11859 the image with a specified background color. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11860 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11861 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
|
11862 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
|
11863 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
|
11864 a new image for each possible background. |
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 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
|
11867 boolean transparency information. Otherwise I'm using |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11868 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
|
11869 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11870 if (channels == 4) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11871 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11872 if (mask_img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11873 XPutPixel (mask_img, x, y, *p > 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11874 ++p; |
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 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11877 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11878 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11879 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
|
11880 /* 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
|
11881 overrode it. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11882 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11883 png_color_16 *bg; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11884 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
|
11885 { |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11886 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
|
11887 img->background_valid = 1; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11888 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11889 } |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11890 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11891 /* Remember colors allocated for this image. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11892 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
|
11893 free_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11894 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11895 /* Clean up. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11896 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
|
11897 xfree (rows); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11898 xfree (pixels); |
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 img->width = width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11901 img->height = height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11902 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11903 /* 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
|
11904 IMAGE_BACKGROUND (img, f, ximg); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11905 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11906 /* 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
|
11907 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
|
11908 x_destroy_x_image (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11909 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11910 /* Same for the mask. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11911 if (mask_img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11912 { |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11913 /* 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
|
11914 handy. */ |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11915 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
|
11916 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11917 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
|
11918 x_destroy_x_image (mask_img); |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11921 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11922 return 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11923 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11924 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11925 #endif /* HAVE_PNG != 0 */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11926 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11927 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11928 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11929 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11930 JPEG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11931 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11932 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11933 #if HAVE_JPEG |
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 /* 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
|
11936 jconfig.h. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11937 #ifdef HAVE_STDLIB_H |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11938 #define HAVE_STDLIB_H_1 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11939 #undef HAVE_STDLIB_H |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11940 #endif /* HAVE_STLIB_H */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11941 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11942 #include <jpeglib.h> |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11943 #include <jerror.h> |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11944 #include <setjmp.h> |
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 #ifdef HAVE_STLIB_H_1 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11947 #define HAVE_STDLIB_H 1 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11948 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11949 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11950 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
|
11951 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
|
11952 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11953 /* 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
|
11954 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11955 Lisp_Object Qjpeg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11956 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11957 /* 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
|
11958 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11959 enum jpeg_keyword_index |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11960 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11961 JPEG_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11962 JPEG_DATA, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11963 JPEG_FILE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11964 JPEG_ASCENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11965 JPEG_MARGIN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11966 JPEG_RELIEF, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11967 JPEG_ALGORITHM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11968 JPEG_HEURISTIC_MASK, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11969 JPEG_MASK, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11970 JPEG_BACKGROUND, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11971 JPEG_LAST |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11974 /* 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
|
11975 of valid user-defined image specifications. */ |
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 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
|
11978 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11979 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11980 {":data", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11981 {":file", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11982 {":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
|
11983 {":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
|
11984 {":relief", IMAGE_INTEGER_VALUE, 0}, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11985 {":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
|
11986 {":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
|
11987 {":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
|
11988 {":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
|
11989 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11990 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11991 /* Structure describing the image type `jpeg'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11992 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11993 static struct image_type jpeg_type = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11994 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11995 &Qjpeg, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11996 jpeg_image_p, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11997 jpeg_load, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11998 x_clear_image, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
11999 NULL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12000 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12001 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12002 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12003 /* 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
|
12004 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12005 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12006 jpeg_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12007 Lisp_Object object; |
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 struct image_keyword fmt[JPEG_LAST]; |
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 bcopy (jpeg_format, fmt, sizeof fmt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12012 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12013 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
|
12014 || (fmt[JPEG_ASCENT].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12015 && XFASTINT (fmt[JPEG_ASCENT].value) > 100)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12016 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12017 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12018 /* 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
|
12019 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
|
12020 } |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12023 struct my_jpeg_error_mgr |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12024 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12025 struct jpeg_error_mgr pub; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12026 jmp_buf setjmp_buffer; |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12029 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12030 my_error_exit (cinfo) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12031 j_common_ptr cinfo; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12032 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12033 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
|
12034 longjmp (mgr->setjmp_buffer, 1); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12035 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12036 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12037 /* 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
|
12038 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
|
12039 libjpeg.doc from the JPEG lib distribution. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12040 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12041 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12042 our_init_source (cinfo) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12043 j_decompress_ptr cinfo; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12044 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12045 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12046 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12047 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12048 /* 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
|
12049 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
|
12050 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
|
12051 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12052 static boolean |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12053 our_fill_input_buffer (cinfo) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12054 j_decompress_ptr cinfo; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12055 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12056 /* Insert a fake EOI marker. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12057 struct jpeg_source_mgr *src = cinfo->src; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12058 static JOCTET buffer[2]; |
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 buffer[0] = (JOCTET) 0xFF; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12061 buffer[1] = (JOCTET) JPEG_EOI; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12062 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12063 src->next_input_byte = buffer; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12064 src->bytes_in_buffer = 2; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12065 return TRUE; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12066 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12067 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12068 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12069 /* 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
|
12070 is the JPEG data source manager. */ |
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 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12073 our_skip_input_data (cinfo, num_bytes) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12074 j_decompress_ptr cinfo; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12075 long num_bytes; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12076 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12077 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
|
12078 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12079 if (src) |
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 (num_bytes > src->bytes_in_buffer) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12082 ERREXIT (cinfo, JERR_INPUT_EOF); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12083 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12084 src->bytes_in_buffer -= num_bytes; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12085 src->next_input_byte += num_bytes; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12086 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12087 } |
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 /* Method to terminate data source. Called by |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12091 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
|
12092 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12093 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12094 our_term_source (cinfo) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12095 j_decompress_ptr cinfo; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12096 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12097 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12098 |
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 /* 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
|
12101 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
|
12102 reading the image. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12103 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12104 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12105 jpeg_memory_src (cinfo, data, len) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12106 j_decompress_ptr cinfo; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12107 JOCTET *data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12108 unsigned int len; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12109 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12110 struct jpeg_source_mgr *src; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12111 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12112 if (cinfo->src == NULL) |
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 /* First time for this JPEG object? */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12115 cinfo->src = (struct jpeg_source_mgr *) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12116 (*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
|
12117 sizeof (struct jpeg_source_mgr)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12118 src = (struct jpeg_source_mgr *) cinfo->src; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12119 src->next_input_byte = data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12120 } |
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 src = (struct jpeg_source_mgr *) cinfo->src; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12123 src->init_source = our_init_source; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12124 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
|
12125 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
|
12126 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
|
12127 src->term_source = our_term_source; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12128 src->bytes_in_buffer = len; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12129 src->next_input_byte = data; |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12133 /* 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
|
12134 from the JPEG lib. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12135 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12136 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12137 jpeg_load (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12138 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12139 struct image *img; |
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 struct jpeg_decompress_struct cinfo; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12142 struct my_jpeg_error_mgr mgr; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12143 Lisp_Object file, specified_file; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12144 Lisp_Object specified_data; |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12145 FILE * volatile fp = NULL; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12146 JSAMPARRAY buffer; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12147 int row_stride, x, y; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12148 XImage *ximg = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12149 int rc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12150 unsigned long *colors; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12151 int width, height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12152 struct gcpro gcpro1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12153 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12154 /* Open the JPEG file. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12155 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
|
12156 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
|
12157 file = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12158 GCPRO1 (file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12159 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12160 if (NILP (specified_data)) |
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 file = x_find_image_file (specified_file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12163 if (!STRINGP (file)) |
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 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
|
12166 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12167 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12168 } |
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 fp = fopen (XSTRING (file)->data, "r"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12171 if (fp == NULL) |
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 image_error ("Cannot open `%s'", file, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12174 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12175 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12176 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12177 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12178 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12179 /* 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
|
12180 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
|
12181 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
|
12182 mgr.pub.error_exit = my_error_exit; |
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 if ((rc = setjmp (mgr.setjmp_buffer)) != 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12185 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12186 if (rc == 1) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12187 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12188 /* 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
|
12189 char buffer[JMSG_LENGTH_MAX]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12190 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
|
12191 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
|
12192 build_string (buffer)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12193 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12194 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12195 /* 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
|
12196 if (fp) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12197 fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12198 jpeg_destroy_decompress (&cinfo); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12199 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12200 /* 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
|
12201 x_destroy_x_image (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12202 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12203 /* Free pixmap and colors. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12204 x_clear_image (f, img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12205 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12206 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12207 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12208 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12209 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12210 /* 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
|
12211 Read the JPEG image header. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12212 jpeg_create_decompress (&cinfo); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12213 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12214 if (NILP (specified_data)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12215 jpeg_stdio_src (&cinfo, fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12216 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12217 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
|
12218 STRING_BYTES (XSTRING (specified_data))); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12219 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12220 jpeg_read_header (&cinfo, TRUE); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12221 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12222 /* 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
|
12223 Start decompression. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12224 cinfo.quantize_colors = TRUE; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12225 jpeg_start_decompress (&cinfo); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12226 width = img->width = cinfo.output_width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12227 height = img->height = cinfo.output_height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12228 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12229 /* Create X image and pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12230 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
|
12231 &img->pixmap)) |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12232 longjmp (mgr.setjmp_buffer, 2); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12233 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12234 /* Allocate colors. When color quantization is used, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12235 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
|
12236 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
|
12237 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
|
12238 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
|
12239 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12240 int i, ir, ig, ib; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12241 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12242 if (cinfo.out_color_components > 2) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12243 ir = 0, ig = 1, ib = 2; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12244 else if (cinfo.out_color_components > 1) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12245 ir = 0, ig = 1, ib = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12246 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12247 ir = 0, ig = 0, ib = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12248 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12249 /* 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
|
12250 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
|
12251 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
|
12252 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
|
12253 init_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12254 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
|
12255 * sizeof *colors); |
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 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
|
12258 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12259 /* 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
|
12260 in the range 0..0xffff. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12261 int r = cinfo.colormap[ir][i] << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12262 int g = cinfo.colormap[ig][i] << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12263 int b = cinfo.colormap[ib][i] << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12264 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
|
12265 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12266 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12267 /* Remember those colors actually allocated. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12268 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
|
12269 free_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12270 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12271 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12272 /* Read pixels. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12273 row_stride = width * cinfo.output_components; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12274 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
|
12275 row_stride, 1); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12276 for (y = 0; y < height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12277 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12278 jpeg_read_scanlines (&cinfo, buffer, 1); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12279 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
|
12280 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
|
12281 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12282 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12283 /* Clean up. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12284 jpeg_finish_decompress (&cinfo); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12285 jpeg_destroy_decompress (&cinfo); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12286 if (fp) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12287 fclose (fp); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12288 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12289 /* 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
|
12290 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
|
12291 IMAGE_BACKGROUND (img, f, ximg); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12292 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12293 /* Put the image into the pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12294 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
|
12295 x_destroy_x_image (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12296 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12297 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12298 return 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12299 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12300 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12301 #endif /* HAVE_JPEG */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12302 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12303 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12304 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12305 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12306 TIFF |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12307 ***********************************************************************/ |
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 #if HAVE_TIFF |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12310 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12311 #include <tiffio.h> |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12312 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12313 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
|
12314 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
|
12315 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12316 /* 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
|
12317 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12318 Lisp_Object Qtiff; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12319 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12320 /* 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
|
12321 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12322 enum tiff_keyword_index |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12323 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12324 TIFF_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12325 TIFF_DATA, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12326 TIFF_FILE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12327 TIFF_ASCENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12328 TIFF_MARGIN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12329 TIFF_RELIEF, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12330 TIFF_ALGORITHM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12331 TIFF_HEURISTIC_MASK, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12332 TIFF_MASK, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12333 TIFF_BACKGROUND, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12334 TIFF_LAST |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12335 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12336 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12337 /* 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
|
12338 of valid user-defined image specifications. */ |
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 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
|
12341 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12342 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12343 {":data", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12344 {":file", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12345 {":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
|
12346 {":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
|
12347 {":relief", IMAGE_INTEGER_VALUE, 0}, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12348 {":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
|
12349 {":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
|
12350 {":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
|
12351 {":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
|
12352 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12353 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12354 /* Structure describing the image type `tiff'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12355 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12356 static struct image_type tiff_type = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12357 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12358 &Qtiff, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12359 tiff_image_p, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12360 tiff_load, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12361 x_clear_image, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12362 NULL |
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 /* 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
|
12367 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12368 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12369 tiff_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12370 Lisp_Object object; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12371 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12372 struct image_keyword fmt[TIFF_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12373 bcopy (tiff_format, fmt, sizeof fmt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12374 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12375 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
|
12376 || (fmt[TIFF_ASCENT].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12377 && XFASTINT (fmt[TIFF_ASCENT].value) > 100)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12378 return 0; |
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 /* 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
|
12381 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
|
12382 } |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12385 /* 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
|
12386 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
|
12387 Blah. |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12388 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12389 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
|
12390 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
|
12391 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
|
12392 override. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12393 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12394 typedef struct |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12395 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12396 unsigned char *bytes; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12397 size_t len; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12398 int index; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12399 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12400 tiff_memory_source; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12401 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12402 static size_t |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12403 tiff_read_from_memory (data, buf, size) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12404 thandle_t data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12405 tdata_t buf; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12406 tsize_t size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12407 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12408 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
|
12409 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12410 if (size > src->len - src->index) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12411 return (size_t) -1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12412 bcopy (src->bytes + src->index, buf, size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12413 src->index += size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12414 return size; |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12417 static size_t |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12418 tiff_write_from_memory (data, buf, size) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12419 thandle_t data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12420 tdata_t buf; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12421 tsize_t size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12422 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12423 return (size_t) -1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12424 } |
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 static toff_t |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12427 tiff_seek_in_memory (data, off, whence) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12428 thandle_t data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12429 toff_t off; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12430 int whence; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12431 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12432 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
|
12433 int idx; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12434 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12435 switch (whence) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12436 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12437 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
|
12438 idx = off; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12439 break; |
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 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
|
12442 idx = src->len + off; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12443 break; |
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 case SEEK_CUR: /* Go from current position. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12446 idx = src->index + off; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12447 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12448 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12449 default: /* Invalid `whence'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12450 return -1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12451 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12452 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12453 if (idx > src->len || idx < 0) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12454 return -1; |
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 src->index = idx; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12457 return src->index; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12458 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12459 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12460 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12461 tiff_close_memory (data) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12462 thandle_t data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12463 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12464 /* NOOP */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12465 return 0; |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12468 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12469 tiff_mmap_memory (data, pbase, psize) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12470 thandle_t data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12471 tdata_t *pbase; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12472 toff_t *psize; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12473 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12474 /* It is already _IN_ memory. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12475 return 0; |
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 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12479 tiff_unmap_memory (data, base, size) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12480 thandle_t data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12481 tdata_t base; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12482 toff_t size; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12483 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12484 /* We don't need to do this. */ |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12487 static toff_t |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12488 tiff_size_of_memory (data) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12489 thandle_t data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12490 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12491 return ((tiff_memory_source *) data)->len; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12492 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12493 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12494 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12495 static void |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12496 tiff_error_handler (title, format, ap) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12497 const char *title, *format; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12498 va_list ap; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12499 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12500 char buf[512]; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12501 int len; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12502 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12503 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
|
12504 vsprintf (buf + len, format, ap); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12505 add_to_log (buf, Qnil, Qnil); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12506 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12507 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12508 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12509 static void |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12510 tiff_warning_handler (title, format, ap) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12511 const char *title, *format; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12512 va_list ap; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12513 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12514 char buf[512]; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12515 int len; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12516 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12517 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
|
12518 vsprintf (buf + len, format, ap); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12519 add_to_log (buf, Qnil, Qnil); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12520 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12521 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12522 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12523 /* 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
|
12524 successful. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12525 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12526 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12527 tiff_load (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12528 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12529 struct image *img; |
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 Lisp_Object file, specified_file; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12532 Lisp_Object specified_data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12533 TIFF *tiff; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12534 int width, height, x, y; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12535 uint32 *buf; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12536 int rc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12537 XImage *ximg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12538 struct gcpro gcpro1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12539 tiff_memory_source memsrc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12540 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12541 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
|
12542 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
|
12543 file = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12544 GCPRO1 (file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12545 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12546 TIFFSetErrorHandler (tiff_error_handler); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12547 TIFFSetWarningHandler (tiff_warning_handler); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12548 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12549 if (NILP (specified_data)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12550 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12551 /* Read from a file */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12552 file = x_find_image_file (specified_file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12553 if (!STRINGP (file)) |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12554 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12555 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
|
12556 UNGCPRO; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12557 return 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12558 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12559 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12560 /* Try to open the image file. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12561 tiff = TIFFOpen (XSTRING (file)->data, "r"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12562 if (tiff == NULL) |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12563 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12564 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
|
12565 UNGCPRO; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12566 return 0; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12567 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12568 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12569 else |
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 /* Memory source! */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12572 memsrc.bytes = XSTRING (specified_data)->data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12573 memsrc.len = STRING_BYTES (XSTRING (specified_data)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12574 memsrc.index = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12575 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12576 tiff = TIFFClientOpen ("memory_source", "r", &memsrc, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12577 (TIFFReadWriteProc) tiff_read_from_memory, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12578 (TIFFReadWriteProc) tiff_write_from_memory, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12579 tiff_seek_in_memory, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12580 tiff_close_memory, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12581 tiff_size_of_memory, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12582 tiff_mmap_memory, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12583 tiff_unmap_memory); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12584 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12585 if (!tiff) |
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 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
|
12588 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12589 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12590 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12591 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12592 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12593 /* 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
|
12594 of width x height 32-bit values. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12595 TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12596 TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12597 buf = (uint32 *) xmalloc (width * height * sizeof *buf); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12598 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12599 rc = TIFFReadRGBAImage (tiff, width, height, buf, 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12600 TIFFClose (tiff); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12601 if (!rc) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12602 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12603 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
|
12604 xfree (buf); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12605 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12606 return 0; |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12609 /* Create the X image and pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12610 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
|
12611 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12612 xfree (buf); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12613 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12614 return 0; |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12617 /* Initialize the color table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12618 init_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12619 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12620 /* 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
|
12621 for (y = 0; y < height; ++y) |
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 uint32 *row = buf + y * width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12624 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12625 for (x = 0; x < width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12626 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12627 uint32 abgr = row[x]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12628 int r = TIFFGetR (abgr) << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12629 int g = TIFFGetG (abgr) << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12630 int b = TIFFGetB (abgr) << 8; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12631 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
|
12632 } |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12635 /* 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
|
12636 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
|
12637 free_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12638 |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12639 img->width = width; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12640 img->height = height; |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12641 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12642 /* 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
|
12643 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
|
12644 IMAGE_BACKGROUND (img, f, ximg); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12645 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12646 /* 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
|
12647 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
|
12648 x_destroy_x_image (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12649 xfree (buf); |
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 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12652 return 1; |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12655 #endif /* HAVE_TIFF != 0 */ |
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 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12660 GIF |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12661 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12662 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12663 #if HAVE_GIF |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12664 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12665 #include <gif_lib.h> |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12666 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12667 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
|
12668 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
|
12669 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12670 /* 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
|
12671 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12672 Lisp_Object Qgif; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12673 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12674 /* 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
|
12675 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12676 enum gif_keyword_index |
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 GIF_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12679 GIF_DATA, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12680 GIF_FILE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12681 GIF_ASCENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12682 GIF_MARGIN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12683 GIF_RELIEF, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12684 GIF_ALGORITHM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12685 GIF_HEURISTIC_MASK, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12686 GIF_MASK, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12687 GIF_IMAGE, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12688 GIF_BACKGROUND, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12689 GIF_LAST |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12690 }; |
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 /* 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
|
12693 of valid user-defined image specifications. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12694 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12695 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
|
12696 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12697 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12698 {":data", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12699 {":file", IMAGE_STRING_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12700 {":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
|
12701 {":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
|
12702 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
12703 {":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
|
12704 {":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
|
12705 {":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
|
12706 {":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
|
12707 {":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
|
12708 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12709 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12710 /* Structure describing the image type `gif'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12711 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12712 static struct image_type gif_type = |
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 &Qgif, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12715 gif_image_p, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12716 gif_load, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12717 x_clear_image, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12718 NULL |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12719 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12720 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12721 /* 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
|
12722 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12723 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12724 gif_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12725 Lisp_Object object; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12726 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12727 struct image_keyword fmt[GIF_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12728 bcopy (gif_format, fmt, sizeof fmt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12729 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12730 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
|
12731 || (fmt[GIF_ASCENT].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12732 && XFASTINT (fmt[GIF_ASCENT].value) > 100)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12733 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12734 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12735 /* 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
|
12736 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
|
12737 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12738 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12739 /* Reading a GIF image from memory |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12740 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
|
12741 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12742 typedef struct |
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 unsigned char *bytes; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12745 size_t len; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12746 int index; |
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 gif_memory_source; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12749 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12750 /* 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
|
12751 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
|
12752 a UserData field in the GifFileType structure. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12753 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
|
12754 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12755 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12756 gif_read_from_memory (file, buf, len) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12757 GifFileType *file; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12758 GifByteType *buf; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12759 int len; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12760 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12761 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
|
12762 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12763 if (len > src->len - src->index) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12764 return -1; |
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 bcopy (src->bytes + src->index, buf, len); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12767 src->index += len; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12768 return len; |
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 |
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 /* 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
|
12773 successful. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12774 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12775 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12776 gif_load (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12777 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12778 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12779 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12780 Lisp_Object file, specified_file; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12781 Lisp_Object specified_data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12782 int rc, width, height, x, y, i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12783 XImage *ximg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12784 ColorMapObject *gif_color_map; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12785 unsigned long pixel_colors[256]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12786 GifFileType *gif; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12787 struct gcpro gcpro1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12788 Lisp_Object image; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12789 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
|
12790 gif_memory_source memsrc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12791 unsigned char *raster; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12792 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12793 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
|
12794 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
|
12795 file = Qnil; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
12796 GCPRO1 (file); |
27397
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 if (NILP (specified_data)) |
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 file = x_find_image_file (specified_file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12801 if (!STRINGP (file)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12802 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12803 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
|
12804 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12805 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12806 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12807 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12808 /* Open the GIF file. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12809 gif = DGifOpenFileName (XSTRING (file)->data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12810 if (gif == NULL) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12811 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12812 image_error ("Cannot open `%s'", file, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12813 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12814 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12815 } |
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 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12818 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12819 /* Read from memory! */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12820 current_gif_memory_src = &memsrc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12821 memsrc.bytes = XSTRING (specified_data)->data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12822 memsrc.len = STRING_BYTES (XSTRING (specified_data)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12823 memsrc.index = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12824 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12825 gif = DGifOpen(&memsrc, gif_read_from_memory); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12826 if (!gif) |
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 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
|
12829 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12830 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12831 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12832 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12833 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12834 /* Read entire contents. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12835 rc = DGifSlurp (gif); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12836 if (rc == GIF_ERROR) |
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 ("Error reading `%s'", img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12839 DGifCloseFile (gif); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12840 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12841 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12842 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12843 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12844 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
|
12845 ino = INTEGERP (image) ? XFASTINT (image) : 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12846 if (ino >= gif->ImageCount) |
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 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
|
12849 image, img->spec); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12850 DGifCloseFile (gif); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12851 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12852 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12853 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12854 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12855 width = img->width = gif->SWidth; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12856 height = img->height = gif->SHeight; |
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 /* Create the X image and pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12859 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
|
12860 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12861 DGifCloseFile (gif); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12862 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12863 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12864 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12865 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12866 /* Allocate colors. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12867 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
|
12868 if (!gif_color_map) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12869 gif_color_map = gif->SColorMap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12870 init_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12871 bzero (pixel_colors, sizeof pixel_colors); |
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 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
|
12874 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12875 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
|
12876 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
|
12877 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
|
12878 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
|
12879 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12880 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12881 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
|
12882 free_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12883 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12884 /* 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
|
12885 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
|
12886 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
|
12887 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
|
12888 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
|
12889 image_top = gif->SavedImages[ino].ImageDesc.Top; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12890 image_left = gif->SavedImages[ino].ImageDesc.Left; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12891 image_width = gif->SavedImages[ino].ImageDesc.Width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12892 image_height = gif->SavedImages[ino].ImageDesc.Height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12893 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12894 for (y = 0; y < image_top; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12895 for (x = 0; x < width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12896 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
|
12897 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12898 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
|
12899 for (x = 0; x < width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12900 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
|
12901 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12902 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
|
12903 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12904 for (x = 0; x < image_left; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12905 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
|
12906 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
|
12907 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
|
12908 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12909 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12910 /* 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
|
12911 `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
|
12912 problems with bytes >= 0x80. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12913 raster = (unsigned char *) gif->SavedImages[ino].RasterBits; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12914 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12915 if (gif->SavedImages[ino].ImageDesc.Interlace) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12916 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12917 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
|
12918 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
|
12919 int pass; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12920 int row = interlace_start[0]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12921 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12922 pass = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12923 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12924 for (y = 0; y < image_height; y++) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12925 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12926 if (row >= image_height) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12927 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12928 row = interlace_start[++pass]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12929 while (row >= image_height) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12930 row = interlace_start[++pass]; |
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 for (x = 0; x < image_width; x++) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12934 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12935 int i = raster[(y * image_width) + x]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12936 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
|
12937 pixel_colors[i]); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12938 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12939 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12940 row += interlace_increment[pass]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12941 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12942 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12943 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12944 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12945 for (y = 0; y < image_height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12946 for (x = 0; x < image_width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12947 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12948 int i = raster[y* image_width + x]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12949 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
|
12950 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12951 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12952 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12953 DGifCloseFile (gif); |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12954 |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12955 /* 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
|
12956 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
|
12957 IMAGE_BACKGROUND (img, f, ximg); |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
12958 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12959 /* 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
|
12960 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
|
12961 x_destroy_x_image (ximg); |
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 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12964 return 1; |
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 #endif /* HAVE_GIF != 0 */ |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12971 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12972 Ghostscript |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12973 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12974 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12975 Lisp_Object Qpostscript; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
12976 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12977 #ifdef HAVE_GHOSTSCRIPT |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12978 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
|
12979 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
|
12980 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
|
12981 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12982 /* 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
|
12983 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12984 /* Keyword symbols. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12985 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12986 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
|
12987 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12988 /* 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
|
12989 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12990 enum gs_keyword_index |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12991 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12992 GS_TYPE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12993 GS_PT_WIDTH, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12994 GS_PT_HEIGHT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12995 GS_FILE, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12996 GS_LOADER, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12997 GS_BOUNDING_BOX, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12998 GS_ASCENT, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
12999 GS_MARGIN, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13000 GS_RELIEF, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13001 GS_ALGORITHM, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13002 GS_HEURISTIC_MASK, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
13003 GS_MASK, |
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
13004 GS_BACKGROUND, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13005 GS_LAST |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13006 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13007 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13008 /* 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
|
13009 of valid user-defined image specifications. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13010 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13011 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
|
13012 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13013 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13014 {":pt-width", IMAGE_POSITIVE_INTEGER_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13015 {":pt-height", IMAGE_POSITIVE_INTEGER_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13016 {":file", IMAGE_STRING_VALUE, 1}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13017 {":loader", IMAGE_FUNCTION_VALUE, 0}, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13018 {":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
|
13019 {":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
|
13020 {":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
|
13021 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
13022 {":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
|
13023 {":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
|
13024 {":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
|
13025 {":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
|
13026 }; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13027 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13028 /* Structure describing the image type `ghostscript'. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13029 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13030 static struct image_type gs_type = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13031 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13032 &Qpostscript, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13033 gs_image_p, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13034 gs_load, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13035 gs_clear_image, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13036 NULL |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13039 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13040 /* 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
|
13041 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13042 static void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13043 gs_clear_image (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13044 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13045 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13046 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13047 /* 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
|
13048 xfree (img->data.ptr_val); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13049 x_clear_image (f, img); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13050 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13051 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13052 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13053 /* 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
|
13054 specification. */ |
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 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13057 gs_image_p (object) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13058 Lisp_Object object; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13059 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13060 struct image_keyword fmt[GS_LAST]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13061 Lisp_Object tem; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13062 int i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13063 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13064 bcopy (gs_format, fmt, sizeof fmt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13065 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13066 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
|
13067 || (fmt[GS_ASCENT].count |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13068 && XFASTINT (fmt[GS_ASCENT].value) > 100)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13069 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13070 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13071 /* 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
|
13072 tem = fmt[GS_BOUNDING_BOX].value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13073 if (CONSP (tem)) |
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 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
|
13076 if (!CONSP (tem) || !INTEGERP (XCAR (tem))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13077 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13078 if (!NILP (tem)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13079 return 0; |
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 else if (VECTORP (tem)) |
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 if (XVECTOR (tem)->size != 4) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13084 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13085 for (i = 0; i < 4; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13086 if (!INTEGERP (XVECTOR (tem)->contents[i])) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13087 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13088 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13089 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13090 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13091 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13092 return 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13093 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13094 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13095 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13096 /* 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
|
13097 if successful. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13098 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13099 static int |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13100 gs_load (f, img) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13101 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13102 struct image *img; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13103 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13104 char buffer[100]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13105 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
|
13106 struct gcpro gcpro1, gcpro2; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13107 Lisp_Object frame; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13108 double in_width, in_height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13109 Lisp_Object pixel_colors = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13110 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13111 /* 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
|
13112 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
|
13113 = 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
|
13114 info. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13115 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
|
13116 in_width = XFASTINT (pt_width) / 72.0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13117 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
|
13118 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
|
13119 in_height = XFASTINT (pt_height) / 72.0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13120 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
|
13121 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13122 /* Create the pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13123 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13124 xassert (img->pixmap == 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13125 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
|
13126 img->width, img->height, |
41250
4423b32c875c
(x_set_frame_parameters): Avoid infinite recursion for
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
13127 one_w32_display_info.n_cbits); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13128 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13129 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13130 if (!img->pixmap) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13131 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13132 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
|
13133 return 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13134 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13135 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13136 /* 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
|
13137 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
|
13138 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
|
13139 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
|
13140 GCPRO2 (window_and_pixmap_id, pixel_colors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13141 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13142 sprintf (buffer, "%lu %lu", |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13143 (unsigned long) FRAME_W32_WINDOW (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13144 (unsigned long) img->pixmap); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13145 window_and_pixmap_id = build_string (buffer); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13146 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13147 sprintf (buffer, "%lu %lu", |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13148 FRAME_FOREGROUND_PIXEL (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13149 FRAME_BACKGROUND_PIXEL (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13150 pixel_colors = build_string (buffer); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13151 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13152 XSETFRAME (frame, f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13153 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
|
13154 if (NILP (loader)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13155 loader = intern ("gs-load-image"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13156 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13157 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
|
13158 make_number (img->width), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13159 make_number (img->height), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13160 window_and_pixmap_id, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13161 pixel_colors); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13162 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13163 return PROCESSP (img->data.lisp_val); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13164 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13165 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13166 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13167 /* 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
|
13168 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
|
13169 telling Emacs that Ghostscript has finished drawing. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13170 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13171 void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13172 x_kill_gs_process (pixmap, f) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13173 Pixmap pixmap; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13174 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13175 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13176 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
|
13177 int class, i; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13178 struct image *img; |
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 /* Find the image containing PIXMAP. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13181 for (i = 0; i < c->used; ++i) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13182 if (c->images[i]->pixmap == pixmap) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13183 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13184 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13185 /* 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
|
13186 instance, give up. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13187 if (i == c->used) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13188 return; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13189 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13190 /* 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
|
13191 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
|
13192 img = c->images[i]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13193 xassert (PROCESSP (img->data.lisp_val)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13194 Fkill_process (img->data.lisp_val, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13195 img->data.lisp_val = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13196 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13197 /* 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
|
13198 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
|
13199 img->pixmap. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13200 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
|
13201 if (class != StaticColor && class != StaticGray && class != TrueColor) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13202 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13203 XImage *ximg; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13204 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13205 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13206 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13207 /* 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
|
13208 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
|
13209 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
|
13210 if (ximg) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13211 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13212 int x, y; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13213 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13214 /* Initialize the color table. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13215 init_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13216 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13217 /* 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
|
13218 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
|
13219 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
|
13220 for (y = 0; y < img->height; ++y) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13221 for (x = 0; x < img->width; ++x) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13222 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13223 unsigned long pixel = XGetPixel (ximg, x, y); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13224 lookup_pixel_color (f, pixel); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13225 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13226 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13227 /* 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
|
13228 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
|
13229 free_color_table (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13230 XDestroyImage (ximg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13231 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13232 #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
|
13233 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
|
13234 freeing the colors. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13235 /* 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
|
13236 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
|
13237 reference counts right, free them once. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13238 if (img->ncolors) |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13239 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
|
13240 img->colors, img->ncolors, 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13241 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13242 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13243 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13244 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
|
13245 img->spec, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13246 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13247 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13248 } |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13249 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13250 /* 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
|
13251 image if requested. */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13252 BLOCK_INPUT; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13253 postprocess_image (f, img); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13254 UNBLOCK_INPUT; |
27397
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13257 #endif /* HAVE_GHOSTSCRIPT */ |
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 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13260 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13261 Window properties |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13262 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13263 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13264 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
|
13265 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
|
13266 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
|
13267 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
|
13268 selected frame. Value is VALUE. */) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13269 (prop, value, frame) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13270 Lisp_Object frame, prop, value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13271 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
13272 #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
|
13273 struct frame *f = check_x_frame (frame); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13274 Atom prop_atom; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13275 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
13276 CHECK_STRING (prop); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
13277 CHECK_STRING (value); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13278 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13279 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13280 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
|
13281 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
|
13282 prop_atom, XA_STRING, 8, PropModeReplace, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13283 XSTRING (value)->data, XSTRING (value)->size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13284 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13285 /* 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
|
13286 XFlush (FRAME_W32_DISPLAY (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13287 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13288 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
13289 #endif /* TODO */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13290 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13291 return value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13292 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13293 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13294 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13295 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
|
13296 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
|
13297 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
|
13298 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
|
13299 (prop, frame) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13300 Lisp_Object prop, frame; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13301 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
13302 #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
|
13303 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13304 struct frame *f = check_x_frame (frame); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13305 Atom prop_atom; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13306 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
13307 CHECK_STRING (prop); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13308 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13309 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
|
13310 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
|
13311 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13312 /* 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
|
13313 XFlush (FRAME_W32_DISPLAY (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13314 UNBLOCK_INPUT; |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
13315 #endif /* TODO */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13316 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13317 return prop; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13318 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13319 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13320 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13321 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
|
13322 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
|
13323 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
|
13324 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
|
13325 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
|
13326 value. */) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13327 (prop, frame) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13328 Lisp_Object prop, frame; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13329 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
13330 #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
|
13331 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13332 struct frame *f = check_x_frame (frame); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13333 Atom prop_atom; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13334 int rc; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13335 Lisp_Object prop_value = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13336 char *tmp_data = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13337 Atom actual_type; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13338 int actual_format; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13339 unsigned long actual_size, bytes_remaining; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13340 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
13341 CHECK_STRING (prop); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13342 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13343 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
|
13344 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
|
13345 prop_atom, 0, 0, False, XA_STRING, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13346 &actual_type, &actual_format, &actual_size, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13347 &bytes_remaining, (unsigned char **) &tmp_data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13348 if (rc == Success) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13349 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13350 int size = bytes_remaining; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13351 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13352 XFree (tmp_data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13353 tmp_data = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13354 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13355 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
|
13356 prop_atom, 0, bytes_remaining, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13357 False, XA_STRING, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13358 &actual_type, &actual_format, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13359 &actual_size, &bytes_remaining, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13360 (unsigned char **) &tmp_data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13361 if (rc == Success) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13362 prop_value = make_string (tmp_data, size); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13363 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13364 XFree (tmp_data); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13365 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13366 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13367 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13368 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13369 return prop_value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13370 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
13371 #endif /* TODO */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13372 return Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13373 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13374 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13375 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13376 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13377 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13378 Busy cursor |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13379 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13380 |
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
|
13381 /* 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
|
13382 an hourglass cursor on all frames. */ |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13383 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13384 static struct atimer *hourglass_atimer; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13385 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13386 /* 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
|
13387 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13388 static int hourglass_shown_p; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13389 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13390 /* 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
|
13391 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13392 static Lisp_Object Vhourglass_delay; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13393 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13394 /* 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
|
13395 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
|
13396 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13397 #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
|
13398 |
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
|
13399 /* 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
|
13400 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13401 static void show_hourglass P_ ((struct atimer *)); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13402 static void hide_hourglass P_ ((void)); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13403 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13404 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13405 /* 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
|
13406 |
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
|
13407 void |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13408 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
|
13409 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
13410 #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
|
13411 EMACS_TIME delay; |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
13412 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
|
13413 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13414 cancel_hourglass (); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13415 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13416 if (INTEGERP (Vhourglass_delay) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13417 && XINT (Vhourglass_delay) > 0) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13418 secs = XFASTINT (Vhourglass_delay); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13419 else if (FLOATP (Vhourglass_delay) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13420 && 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
|
13421 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
13422 Lisp_Object tem; |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13423 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
|
13424 secs = XFASTINT (tem); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13425 usecs = (XFLOAT_DATA (Vhourglass_delay) - secs) * 1000000; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13426 } |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13427 else |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13428 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
|
13429 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
13430 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
|
13431 hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13432 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
|
13433 #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
|
13434 } |
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
|
13435 |
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
|
13436 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13437 /* 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
|
13438 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
|
13439 |
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
|
13440 void |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13441 cancel_hourglass () |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13442 { |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13443 if (hourglass_atimer) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13444 { |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13445 cancel_atimer (hourglass_atimer); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13446 hourglass_atimer = NULL; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13447 } |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13448 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13449 if (hourglass_shown_p) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13450 hide_hourglass (); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13451 } |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13452 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13453 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13454 /* 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
|
13455 hourglass_atimer. |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13456 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13457 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
|
13458 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
|
13459 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
|
13460 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
|
13461 |
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
|
13462 static void |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13463 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
|
13464 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
|
13465 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
13466 #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
|
13467 /* 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
|
13468 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
|
13469 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
|
13470 hourglass_atimer = NULL; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13471 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13472 if (!hourglass_shown_p) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13473 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13474 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
|
13475 |
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
|
13476 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
|
13477 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13478 FOR_EACH_FRAME (rest, frame) |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13479 if (FRAME_W32_P (XFRAME (frame))) |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13480 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13481 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
|
13482 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13483 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
|
13484 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13485 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
|
13486 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13487 unsigned long mask = CWCursor; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13488 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
|
13489 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13490 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
|
13491 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13492 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
|
13493 = XCreateWindow (FRAME_X_DISPLAY (f), |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13494 FRAME_OUTER_WINDOW (f), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13495 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
|
13496 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
|
13497 CopyFromParent, |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13498 mask, &attrs); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13499 } |
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
|
13500 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13501 XMapRaised (FRAME_X_DISPLAY (f), |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13502 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
|
13503 XFlush (FRAME_X_DISPLAY (f)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13504 } |
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
|
13505 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13506 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
|
13507 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
|
13508 } |
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
|
13509 #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
|
13510 } |
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
|
13511 |
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
|
13512 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13513 /* 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
|
13514 |
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
|
13515 static void |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13516 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
|
13517 { |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
13518 #if 0 /* TODO: cursor shape changes. */ |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13519 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
|
13520 { |
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
|
13521 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
|
13522 |
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
|
13523 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
|
13524 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
|
13525 { |
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
|
13526 struct frame *f = XFRAME (frame); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13527 |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13528 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
|
13529 /* Watch out for newly created frames. */ |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13530 && 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
|
13531 { |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13532 XUnmapWindow (FRAME_X_DISPLAY (f), |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13533 f->output_data.x->hourglass_window); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13534 /* 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
|
13535 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
|
13536 XSync (FRAME_X_DISPLAY (f), False); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13537 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
|
13538 } |
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
|
13539 } |
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
|
13540 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
13541 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
|
13542 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
|
13543 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13544 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13545 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13546 |
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 |
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 Tool tips |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13551 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13552 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13553 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
|
13554 Lisp_Object, Lisp_Object)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13555 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
|
13556 Lisp_Object, int, int, int *, int *)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13557 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13558 /* 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
|
13559 |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13560 Lisp_Object tip_frame; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13561 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13562 /* 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
|
13563 fires. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13564 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13565 Lisp_Object tip_timer; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13566 Window tip_window; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13567 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13568 /* 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
|
13569 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
|
13570 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13571 Lisp_Object last_show_tip_args; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13572 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13573 /* 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
|
13574 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13575 Lisp_Object Vx_max_tooltip_size; |
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 |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13578 static Lisp_Object |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13579 unwind_create_tip_frame (frame) |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13580 Lisp_Object frame; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13581 { |
34638
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13582 Lisp_Object deleted; |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13583 |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13584 deleted = unwind_create_frame (frame); |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13585 if (EQ (deleted, Qt)) |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13586 { |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13587 tip_window = NULL; |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13588 tip_frame = Qnil; |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13589 } |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13590 |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34546
diff
changeset
|
13591 return deleted; |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13592 } |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13593 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13594 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13595 /* 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
|
13596 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
|
13597 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
|
13598 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13599 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
|
13600 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
|
13601 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
|
13602 when this happens. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13603 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13604 static Lisp_Object |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13605 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
|
13606 struct w32_display_info *dpyinfo; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13607 Lisp_Object parms, text; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13608 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13609 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13610 Lisp_Object frame, tem; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13611 Lisp_Object name; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13612 long window_prompting = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13613 int width, height; |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13614 int count = BINDING_STACK_SIZE (); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13615 struct gcpro gcpro1, gcpro2, gcpro3; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13616 struct kboard *kb; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13617 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
|
13618 Lisp_Object buffer; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13619 struct buffer *old_buffer; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13620 |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13621 check_w32 (); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13622 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13623 /* 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
|
13624 this frame has a specified name. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13625 Vx_resource_name = Vinvocation_name; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13626 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13627 #ifdef MULTI_KBOARD |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13628 kb = dpyinfo->kboard; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13629 #else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13630 kb = &the_only_kboard; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13631 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13632 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13633 /* 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
|
13634 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
|
13635 if (!STRINGP (name) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13636 && !EQ (name, Qunbound) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13637 && !NILP (name)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13638 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
|
13639 Vx_resource_name = name; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13640 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13641 frame = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13642 GCPRO3 (parms, name, frame); |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
13643 /* 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
|
13644 f = make_frame (0); |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
13645 f->wants_modeline = 0; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13646 XSETFRAME (frame, f); |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13647 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13648 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
|
13649 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
|
13650 old_buffer = current_buffer; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13651 set_buffer_internal_1 (XBUFFER (buffer)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13652 current_buffer->truncate_lines = Qnil; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13653 Ferase_buffer (); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13654 Finsert (1, &text); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13655 set_buffer_internal_1 (old_buffer); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13656 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13657 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
|
13658 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
|
13659 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13660 /* 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
|
13661 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
|
13662 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
|
13663 counts etc. */ |
27516
8001542eaee2
(w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents:
27407
diff
changeset
|
13664 f->output_method = output_w32; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13665 f->output_data.w32 = |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13666 (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
|
13667 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
|
13668 |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13669 FRAME_FONTSET (f) = -1; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13670 f->icon_name = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13671 |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13672 #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
|
13673 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
|
13674 dpyinfo_refcount = dpyinfo->reference_count; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
13675 #endif /* GLYPH_DEBUG */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13676 #ifdef MULTI_KBOARD |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13677 FRAME_KBOARD (f) = kb; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13678 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13679 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
|
13680 f->output_data.w32->explicit_parent = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13681 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13682 /* 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
|
13683 be set. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13684 if (EQ (name, Qunbound) || NILP (name)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13685 { |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13686 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
|
13687 f->explicit_name = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13688 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13689 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13690 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13691 f->name = name; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13692 f->explicit_name = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13693 /* 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
|
13694 specbind (Qx_resource_name, name); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13695 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13696 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13697 /* 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
|
13698 that are needed to determine window geometry. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13699 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13700 Lisp_Object font; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13701 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13702 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
|
13703 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13704 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13705 /* 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
|
13706 if (STRINGP (font)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13707 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13708 tem = Fquery_fontset (font, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13709 if (STRINGP (tem)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13710 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
|
13711 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13712 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
|
13713 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13714 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13715 /* 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
|
13716 if (!STRINGP (font)) |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13717 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
|
13718 if (! STRINGP (font)) |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13719 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
|
13720 /* 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
|
13721 if (! STRINGP (font)) |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13722 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
|
13723 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13724 if (! STRINGP (font)) |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13725 font = build_string ("Fixedsys"); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13726 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13727 x_default_parameter (f, parms, Qfont, font, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13728 "font", "Font", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13729 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13730 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13731 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
|
13732 "borderWidth", "BorderWidth", RES_TYPE_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13733 /* 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
|
13734 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
|
13735 it). */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13736 if (NILP (Fassq (Qinternal_border_width, parms))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13737 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13738 Lisp_Object value; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13739 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13740 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
|
13741 "internalBorder", "internalBorder", RES_TYPE_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13742 if (! EQ (value, Qunbound)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13743 parms = Fcons (Fcons (Qinternal_border_width, value), |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13744 parms); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13745 } |
41448
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
13746 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
|
13747 "internalBorderWidth", "internalBorderWidth", |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13748 RES_TYPE_NUMBER); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13749 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13750 /* 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
|
13751 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
|
13752 "foreground", "Foreground", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13753 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
|
13754 "background", "Background", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13755 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
|
13756 "pointerColor", "Foreground", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13757 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
|
13758 "cursorColor", "Foreground", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13759 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
|
13760 "borderColor", "BorderColor", RES_TYPE_STRING); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13761 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13762 /* 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
|
13763 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
|
13764 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
|
13765 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
|
13766 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
|
13767 happen. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13768 init_frame_faces (f); |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13769 |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13770 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
|
13771 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
|
13772 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13773 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
|
13774 |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
13775 /* No fringes on tip frame. */ |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
13776 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
|
13777 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
|
13778 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
|
13779 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
|
13780 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13781 if (window_prompting & XNegative) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13782 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13783 if (window_prompting & YNegative) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13784 f->output_data.w32->win_gravity = SouthEastGravity; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13785 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13786 f->output_data.w32->win_gravity = NorthEastGravity; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13787 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13788 else |
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 if (window_prompting & YNegative) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13791 f->output_data.w32->win_gravity = SouthWestGravity; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13792 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13793 f->output_data.w32->win_gravity = NorthWestGravity; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13794 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13795 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13796 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
|
13797 |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13798 BLOCK_INPUT; |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13799 my_create_tip_window (f); |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13800 UNBLOCK_INPUT; |
27397
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 x_make_gc (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13803 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13804 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
|
13805 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13806 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
|
13807 "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13808 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
|
13809 "cursorType", "CursorType", RES_TYPE_SYMBOL); |
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 /* 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
|
13812 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
|
13813 f->height. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13814 width = f->width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13815 height = f->height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13816 f->height = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13817 SET_FRAME_WIDTH (f, 0); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13818 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
|
13819 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13820 /* 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
|
13821 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
|
13822 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13823 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
|
13824 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
|
13825 `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
|
13826 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
|
13827 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
|
13828 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13829 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
|
13830 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13831 /* Set tip_frame here, so that */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13832 tip_frame = frame; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13833 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
|
13834 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13835 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
|
13836 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
|
13837 Qnil)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13838 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13839 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13840 f->no_split = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13841 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13842 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13843 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13844 /* 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
|
13845 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
|
13846 visible won't work. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13847 Vframe_list = Fcons (frame, Vframe_list); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13848 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13849 /* 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
|
13850 its display. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13851 FRAME_W32_DISPLAY_INFO (f)->reference_count++; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13852 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13853 /* 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
|
13854 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
|
13855 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
|
13856 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
|
13857 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
|
13858 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
|
13859 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13860 /* Discard the unwind_protect. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13861 return unbind_to (count, frame); |
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 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13864 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13865 /* 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
|
13866 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
|
13867 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
|
13868 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
|
13869 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
|
13870 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13871 static void |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13872 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
|
13873 struct frame *f; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13874 Lisp_Object parms, dx, dy; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13875 int width, height; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13876 int *root_x, *root_y; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13877 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13878 Lisp_Object left, top; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13879 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13880 /* User-specified position? */ |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13881 left = Fcdr (Fassq (Qleft, parms)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13882 top = Fcdr (Fassq (Qtop, parms)); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13883 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13884 /* 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
|
13885 show it. */ |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13886 if (!INTEGERP (left) || !INTEGERP (top)) |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13887 { |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13888 POINT pt; |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13889 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13890 BLOCK_INPUT; |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13891 GetCursorPos (&pt); |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13892 *root_x = pt.x; |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13893 *root_y = pt.y; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13894 UNBLOCK_INPUT; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13895 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13896 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13897 if (INTEGERP (top)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13898 *root_y = XINT (top); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13899 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
|
13900 *root_y -= XINT (dy); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13901 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13902 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13903 *root_y -= height; |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13904 *root_y += XINT (dy); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13905 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13906 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13907 if (INTEGERP (left)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13908 *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
|
13909 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
|
13910 /* 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
|
13911 *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
|
13912 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
|
13913 /* 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
|
13914 *root_x -= width + XINT (dx); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13915 else |
42537
f0e15bcba768
(compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents:
42007
diff
changeset
|
13916 /* 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
|
13917 *root_x = 0; |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13918 } |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13919 |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13920 |
31110 | 13921 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
|
13922 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
|
13923 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
|
13924 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13925 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
|
13926 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13927 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
|
13928 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
|
13929 |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13930 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
|
13931 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
|
13932 |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
13933 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
|
13934 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
|
13935 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
|
13936 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
|
13937 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
|
13938 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
|
13939 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
|
13940 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
13941 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
|
13942 Text larger than the specified size is clipped. */) |
31110 | 13943 (string, frame, parms, timeout, dx, dy) |
13944 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
|
13945 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13946 struct frame *f; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13947 struct window *w; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
13948 int root_x, root_y; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13949 struct buffer *old_buffer; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13950 struct text_pos pos; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13951 int i, width, height; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13952 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13953 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
|
13954 int count = BINDING_STACK_SIZE (); |
27397
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 specbind (Qinhibit_redisplay, Qt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13957 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
13958 GCPRO4 (string, parms, frame, timeout); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13959 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
13960 CHECK_STRING (string); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13961 f = check_x_frame (frame); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13962 if (NILP (timeout)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13963 timeout = make_number (5); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13964 else |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
13965 CHECK_NATNUM (timeout); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
13966 |
31110 | 13967 if (NILP (dx)) |
13968 dx = make_number (5); | |
13969 else | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
13970 CHECK_NUMBER (dx); |
31110 | 13971 |
13972 if (NILP (dy)) | |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13973 dy = make_number (-10); |
31110 | 13974 else |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
13975 CHECK_NUMBER (dy); |
31110 | 13976 |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13977 if (NILP (last_show_tip_args)) |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13978 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
|
13979 |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13980 if (!NILP (tip_frame)) |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13981 { |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13982 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
|
13983 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
|
13984 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
|
13985 |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13986 if (EQ (frame, last_frame) |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13987 && !NILP (Fequal (last_string, string)) |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13988 && !NILP (Fequal (last_parms, parms))) |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13989 { |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13990 struct frame *f = XFRAME (tip_frame); |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13991 |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13992 /* Only DX and DY have changed. */ |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13993 if (!NILP (tip_timer)) |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13994 { |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13995 Lisp_Object timer = tip_timer; |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13996 tip_timer = Qnil; |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13997 call1 (Qcancel_timer, timer); |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13998 } |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
13999 |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
14000 BLOCK_INPUT; |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
14001 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
|
14002 PIXEL_HEIGHT (f), &root_x, &root_y); |
43210
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
14003 |
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
14004 /* Put tooltip in topmost group and in position. */ |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
14005 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
|
14006 root_x, root_y, 0, 0, |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
14007 SWP_NOSIZE | SWP_NOACTIVATE); |
43210
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
14008 |
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
14009 /* Ensure tooltip is on top of other topmost windows (eg menus). */ |
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
14010 SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOP, |
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
14011 0, 0, 0, 0, |
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
14012 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); |
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
14013 |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
14014 UNBLOCK_INPUT; |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
14015 goto start_timer; |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
14016 } |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
14017 } |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
14018 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14019 /* Hide a previous tip, if any. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14020 Fx_hide_tip (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14021 |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
14022 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
|
14023 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
|
14024 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
|
14025 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14026 /* Add default values to frame parameters. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14027 if (NILP (Fassq (Qname, parms))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14028 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
|
14029 if (NILP (Fassq (Qinternal_border_width, parms))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14030 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
|
14031 if (NILP (Fassq (Qborder_width, parms))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14032 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
|
14033 if (NILP (Fassq (Qborder_color, parms))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14034 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
|
14035 if (NILP (Fassq (Qbackground_color, parms))) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14036 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
|
14037 parms); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14038 |
41480
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
14039 /* 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
|
14040 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
|
14041 BLOCK_INPUT; |
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
14042 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14043 /* 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
|
14044 variable tip_frame. */ |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
14045 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
|
14046 f = XFRAME (frame); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14047 |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14048 /* 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
|
14049 w = XWINDOW (FRAME_ROOT_WINDOW (f)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14050 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
|
14051 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14052 if (CONSP (Vx_max_tooltip_size) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14053 && INTEGERP (XCAR (Vx_max_tooltip_size)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14054 && 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
|
14055 && INTEGERP (XCDR (Vx_max_tooltip_size)) |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14056 && 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
|
14057 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14058 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
|
14059 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
|
14060 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14061 else |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14062 { |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14063 w->width = make_number (80); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14064 w->height = make_number (40); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14065 } |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14066 |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14067 f->window_width = XINT (w->width); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14068 adjust_glyphs (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14069 w->pseudo_window_p = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14070 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14071 /* 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
|
14072 old_buffer = current_buffer; |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14073 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
|
14074 current_buffer->truncate_lines = Qnil; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14075 clear_glyph_matrix (w->desired_matrix); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14076 clear_glyph_matrix (w->current_matrix); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14077 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14078 try_window (FRAME_ROOT_WINDOW (f), pos); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14079 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14080 /* Compute width and height of the tooltip. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14081 width = height = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14082 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
|
14083 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14084 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
|
14085 struct glyph *last; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14086 int row_width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14087 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14088 /* 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
|
14089 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
|
14090 break; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14091 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14092 /* 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
|
14093 row->full_width_p = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14094 |
41638
aadcf676d5de
(w32_wnd_proc) <WM_MENUSELECT>: Display help directly.
Jason Rumney <jasonr@gnu.org>
parents:
41480
diff
changeset
|
14095 #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
|
14096 calculated for some tooltips. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14097 /* 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
|
14098 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
|
14099 if (row->used[TEXT_AREA]) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14100 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14101 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
|
14102 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
|
14103 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14104 else |
41638
aadcf676d5de
(w32_wnd_proc) <WM_MENUSELECT>: Display help directly.
Jason Rumney <jasonr@gnu.org>
parents:
41480
diff
changeset
|
14105 #endif |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14106 row_width = row->pixel_width; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14107 |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
14108 /* 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
|
14109 height += row->height; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14110 width = max (width, row_width); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14111 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14112 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14113 /* 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
|
14114 window should have. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14115 height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14116 width += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14117 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14118 /* 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
|
14119 show it. */ |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14120 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
|
14121 |
41448
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
14122 { |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
14123 /* 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
|
14124 RECT rect; |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
14125 rect.left = rect.top = 0; |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
14126 rect.right = width; |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
14127 rect.bottom = height; |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
14128 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
|
14129 FRAME_EXTERNAL_MENU_BAR (f)); |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
14130 |
43210
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
14131 /* Position and size tooltip, and put it in the topmost group. */ |
41448
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
14132 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
|
14133 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
|
14134 rect.bottom - rect.top, SWP_NOACTIVATE); |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
14135 |
43210
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
14136 /* Ensure tooltip is on top of other topmost windows (eg menus). */ |
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
14137 SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOP, |
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
14138 0, 0, 0, 0, |
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
14139 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); |
3df71b933c36
(w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents:
43207
diff
changeset
|
14140 |
41448
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
14141 /* 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
|
14142 f->async_visible = 1; |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
14143 |
96beda35d0fa
(w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents:
41380
diff
changeset
|
14144 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
|
14145 } |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14146 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14147 /* Draw into the window. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14148 w->must_be_updated_p = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14149 update_single_window (w, 1); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14150 |
41480
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
14151 UNBLOCK_INPUT; |
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
14152 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14153 /* Restore original current buffer. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14154 set_buffer_internal_1 (old_buffer); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14155 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
|
14156 |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
14157 start_timer: |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14158 /* Let the tip disappear after timeout seconds. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14159 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
|
14160 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
|
14161 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14162 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14163 return unbind_to (count, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14164 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14165 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14166 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14167 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
|
14168 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
|
14169 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
|
14170 () |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14171 { |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14172 int count; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14173 Lisp_Object deleted, frame, timer; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14174 struct gcpro gcpro1, gcpro2; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14175 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14176 /* 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
|
14177 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
|
14178 return Qnil; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14179 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14180 frame = tip_frame; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14181 timer = tip_timer; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14182 GCPRO2 (frame, timer); |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14183 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
|
14184 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14185 count = BINDING_STACK_SIZE (); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14186 specbind (Qinhibit_redisplay, Qt); |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14187 specbind (Qinhibit_quit, Qt); |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14188 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14189 if (!NILP (timer)) |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
14190 call1 (Qcancel_timer, timer); |
34546
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14191 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14192 if (FRAMEP (frame)) |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14193 { |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14194 Fdelete_frame (frame, Qnil); |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14195 deleted = Qt; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14196 } |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14197 |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14198 UNGCPRO; |
51be06b616bf
(Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents:
34314
diff
changeset
|
14199 return unbind_to (count, deleted); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14200 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14201 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14202 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14203 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14204 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14205 File selection dialog |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14206 ***********************************************************************/ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14207 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14208 extern Lisp_Object Qfile_name_history; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14209 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14210 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
|
14211 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
|
14212 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
|
14213 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
|
14214 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
|
14215 (prompt, dir, default_filename, mustmatch) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14216 Lisp_Object prompt, dir, default_filename, mustmatch; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14217 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14218 struct frame *f = SELECTED_FRAME (); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14219 Lisp_Object file = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14220 int count = specpdl_ptr - specpdl; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14221 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14222 char filename[MAX_PATH + 1]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14223 char init_dir[MAX_PATH + 1]; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14224 int use_dialog_p = 1; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14225 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14226 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
|
14227 CHECK_STRING (prompt); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
14228 CHECK_STRING (dir); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14229 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14230 /* 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
|
14231 directory and using "*" as pattern. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14232 dir = Fexpand_file_name (dir, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14233 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
|
14234 init_dir[MAX_PATH] = '\0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14235 unixtodos_filename (init_dir); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14236 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14237 if (STRINGP (default_filename)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14238 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14239 char *file_name_only; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14240 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
|
14241 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14242 unixtodos_filename (full_path_name); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14243 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14244 file_name_only = strrchr (full_path_name, '\\'); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14245 if (!file_name_only) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14246 file_name_only = full_path_name; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14247 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14248 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14249 file_name_only++; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14250 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14251 /* 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
|
14252 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
|
14253 directories. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14254 if (!(*file_name_only)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14255 use_dialog_p = 0; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14256 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14257 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14258 strncpy (filename, file_name_only, MAX_PATH); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14259 filename[MAX_PATH] = '\0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14260 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14261 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14262 filename[0] = '\0'; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14263 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14264 if (use_dialog_p) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14265 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14266 OPENFILENAME file_details; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14267 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14268 /* Prevent redisplay. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14269 specbind (Qinhibit_redisplay, Qt); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14270 BLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14271 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14272 bzero (&file_details, sizeof (file_details)); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14273 file_details.lStructSize = sizeof (file_details); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14274 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
|
14275 /* Undocumented Bug in Common File Dialog: |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14276 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
|
14277 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
|
14278 file_details.lpstrFile = filename; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14279 file_details.nMaxFile = sizeof (filename); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14280 file_details.lpstrInitialDir = init_dir; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14281 file_details.lpstrTitle = XSTRING (prompt)->data; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14282 file_details.Flags = OFN_HIDEREADONLY | OFN_NOCHANGEDIR; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14283 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14284 if (!NILP (mustmatch)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14285 file_details.Flags |= OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14286 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14287 if (GetOpenFileName (&file_details)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14288 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14289 dostounix_filename (filename); |
44642
2b19f2634b3c
(Fx_file_dialog): Decode file name before using.
Jason Rumney <jasonr@gnu.org>
parents:
44123
diff
changeset
|
14290 file = DECODE_FILE(build_string (filename)); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14291 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14292 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14293 file = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14294 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14295 UNBLOCK_INPUT; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14296 file = unbind_to (count, file); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14297 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14298 /* 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
|
14299 to minibuffer completing reads for directories. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14300 else |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14301 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
|
14302 dir, mustmatch, dir, Qfile_name_history, |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14303 default_filename, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14304 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14305 UNGCPRO; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14306 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14307 /* Make "Cancel" equivalent to C-g. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14308 if (NILP (file)) |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14309 Fsignal (Qquit, Qnil); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14310 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14311 return unbind_to (count, file); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14312 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14313 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14314 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14315 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14316 /*********************************************************************** |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14317 w32 specialized functions |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14318 ***********************************************************************/ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14319 |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14320 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
|
14321 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
|
14322 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
|
14323 (frame, include_proportional) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14324 Lisp_Object frame, include_proportional; |
13434 | 14325 { |
14326 FRAME_PTR f = check_x_frame (frame); | |
14327 CHOOSEFONT cf; | |
14328 LOGFONT lf; | |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14329 TEXTMETRIC tm; |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14330 HDC hdc; |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14331 HANDLE oldobj; |
13434 | 14332 char buf[100]; |
14333 | |
14334 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
|
14335 bzero (&lf, sizeof (lf)); |
13434 | 14336 |
14337 cf.lStructSize = sizeof (cf); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14338 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
|
14339 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
|
14340 |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14341 /* 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
|
14342 monospaced fonts. */ |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14343 if (NILP (include_proportional)) |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14344 cf.Flags |= CF_FIXEDPITCHONLY; |
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14345 |
13434 | 14346 cf.lpLogFont = &lf; |
14347 | |
24497
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14348 /* 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
|
14349 default font. */ |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14350 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
|
14351 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
|
14352 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
|
14353 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
|
14354 { |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14355 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
|
14356 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
|
14357 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
|
14358 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
|
14359 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
|
14360 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
|
14361 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
|
14362 } |
b09ceba3d319
(enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents:
24481
diff
changeset
|
14363 SelectObject (hdc, oldobj); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14364 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
|
14365 |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
14366 if (!ChooseFont (&cf) || !w32_to_x_font (&lf, buf, 100, NULL)) |
14353 | 14367 return Qnil; |
13434 | 14368 |
14369 return build_string (buf); | |
14370 } | |
14371 | |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14372 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
|
14373 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
|
14374 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
|
14375 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
|
14376 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
|
14377 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
|
14378 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
|
14379 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14380 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
|
14381 (command, frame) |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14382 Lisp_Object command, frame; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14383 { |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14384 FRAME_PTR f = check_x_frame (frame); |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14385 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
14386 CHECK_NUMBER (command); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14387 |
24718
547f54dfbb94
(x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents:
24695
diff
changeset
|
14388 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
|
14389 |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14390 return Qnil; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14391 } |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14392 |
24670 | 14393 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
|
14394 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
|
14395 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
|
14396 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
|
14397 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
|
14398 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
|
14399 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
|
14400 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
|
14401 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14402 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
|
14403 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
|
14404 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14405 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
|
14406 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
|
14407 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
|
14408 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14409 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
|
14410 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
|
14411 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
|
14412 6 - start minimized */) |
24670 | 14413 (operation, document, parameters, show_flag) |
14414 Lisp_Object operation, document, parameters, show_flag; | |
14415 { | |
14416 Lisp_Object current_dir; | |
14417 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
14418 CHECK_STRING (document); |
24670 | 14419 |
14420 /* Encode filename and current directory. */ | |
14421 current_dir = ENCODE_FILE (current_buffer->directory); | |
14422 document = ENCODE_FILE (document); | |
14423 if ((int) ShellExecute (NULL, | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14424 (STRINGP (operation) ? |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14425 XSTRING (operation)->data : NULL), |
24670 | 14426 XSTRING (document)->data, |
14427 (STRINGP (parameters) ? | |
14428 XSTRING (parameters)->data : NULL), | |
14429 XSTRING (current_dir)->data, | |
14430 (INTEGERP (show_flag) ? | |
14431 XINT (show_flag) : SW_SHOWDEFAULT)) | |
14432 > 32) | |
14433 return Qt; | |
34698
cc62e2e0949d
(Fw32_shell_execute): Use it.
Andrew Innes <andrewi@gnu.org>
parents:
34643
diff
changeset
|
14434 error ("ShellExecute failed: %s", w32_strerror (0)); |
24670 | 14435 } |
14436 | |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14437 /* 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
|
14438 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
|
14439 lispy_function_keys. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14440 static int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14441 lookup_vk_code (char *key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14442 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14443 int i; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14444 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14445 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
|
14446 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
|
14447 && 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
|
14448 return i; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14449 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14450 return -1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14451 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14452 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14453 /* 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
|
14454 definition. */ |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14455 static int |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14456 w32_parse_hot_key (key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14457 Lisp_Object key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14458 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14459 /* 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
|
14460 register Lisp_Object c; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14461 int vk_code; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14462 int lisp_modifiers; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14463 int w32_modifiers; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14464 struct gcpro gcpro1; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14465 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
14466 CHECK_VECTOR (key); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14467 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14468 if (XFASTINT (Flength (key)) != 1) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14469 return Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14470 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14471 GCPRO1 (key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14472 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14473 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
|
14474 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14475 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
|
14476 c = Fevent_convert_list (c); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14477 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14478 UNGCPRO; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14479 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14480 if (! INTEGERP (c) && ! SYMBOLP (c)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14481 error ("Key definition is invalid"); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14482 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14483 /* 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
|
14484 if (SYMBOLP (c)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14485 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14486 c = parse_modifiers (c); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14487 lisp_modifiers = Fcar (Fcdr (c)); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14488 c = Fcar (c); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14489 if (!SYMBOLP (c)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14490 abort (); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14491 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
|
14492 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14493 else if (INTEGERP (c)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14494 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14495 lisp_modifiers = XINT (c) & ~CHARACTERBITS; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14496 /* 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
|
14497 vk_code = XINT (c) & CHARACTERBITS; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14498 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14499 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14500 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
|
14501 return Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14502 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14503 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
|
14504 && !NILP (Vw32_alt_is_meta)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14505 lisp_modifiers |= alt_modifier; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14506 |
31110 | 14507 /* Supply defs missing from mingw32. */ |
14508 #ifndef MOD_ALT | |
14509 #define MOD_ALT 0x0001 | |
14510 #define MOD_CONTROL 0x0002 | |
14511 #define MOD_SHIFT 0x0004 | |
14512 #define MOD_WIN 0x0008 | |
14513 #endif | |
14514 | |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14515 /* 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
|
14516 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
|
14517 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
|
14518 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
|
14519 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
|
14520 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14521 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
|
14522 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14523 |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14524 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
|
14525 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
|
14526 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
|
14527 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
|
14528 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
|
14529 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
|
14530 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
|
14531 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14532 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
|
14533 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
|
14534 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
|
14535 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
|
14536 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14537 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
|
14538 (key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14539 Lisp_Object key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14540 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14541 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
|
14542 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14543 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
|
14544 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14545 /* 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
|
14546 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
|
14547 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14548 /* 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
|
14549 if (NILP (item)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14550 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
|
14551 else |
39973
579177964efa
Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents:
39812
diff
changeset
|
14552 XSETCAR (item, key); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14553 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14554 /* 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
|
14555 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
|
14556 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
|
14557 (WPARAM) key, 0); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14558 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14559 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14560 return key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14561 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14562 |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14563 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
|
14564 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
|
14565 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
|
14566 (key) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14567 Lisp_Object key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14568 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14569 Lisp_Object item; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14570 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14571 if (!INTEGERP (key)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14572 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
|
14573 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14574 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
|
14575 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14576 if (!NILP (item)) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14577 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14578 /* 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
|
14579 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
|
14580 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
|
14581 (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
|
14582 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14583 MSG msg; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14584 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
|
14585 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14586 return Qt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14587 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14588 return Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14589 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14590 |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14591 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
|
14592 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
|
14593 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
|
14594 () |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14595 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14596 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
|
14597 } |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14598 |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14599 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
|
14600 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
|
14601 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
|
14602 (hotkeyid) |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14603 Lisp_Object hotkeyid; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14604 { |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14605 int vk_code, w32_modifiers; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14606 Lisp_Object key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14607 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
14608 CHECK_NUMBER (hotkeyid); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14609 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14610 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
|
14611 w32_modifiers = HOTKEY_MODIFIERS (hotkeyid); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14612 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14613 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
|
14614 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
|
14615 else |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14616 key = make_number (vk_code); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14617 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14618 key = Fcons (key, Qnil); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14619 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
|
14620 key = Fcons (Qshift, key); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14621 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
|
14622 key = Fcons (Qctrl, key); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14623 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
|
14624 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
|
14625 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
|
14626 key = Fcons (Qhyper, key); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14627 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14628 return key; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14629 } |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14630 |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14631 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
|
14632 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
|
14633 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
|
14634 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
|
14635 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
|
14636 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
|
14637 (key, new_state) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14638 Lisp_Object key, new_state; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14639 { |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14640 int vk_code; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14641 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14642 if (EQ (key, intern ("capslock"))) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14643 vk_code = VK_CAPITAL; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14644 else if (EQ (key, intern ("kp-numlock"))) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14645 vk_code = VK_NUMLOCK; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14646 else if (EQ (key, intern ("scroll"))) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14647 vk_code = VK_SCROLL; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14648 else |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14649 return Qnil; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14650 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14651 if (!dwWindowsThreadId) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14652 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
|
14653 |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14654 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
|
14655 (WPARAM) vk_code, (LPARAM) new_state)) |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14656 { |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14657 MSG msg; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14658 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
|
14659 return make_number (msg.wParam); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14660 } |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14661 return Qnil; |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14662 } |
13434 | 14663 |
34643
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14664 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
|
14665 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
|
14666 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
|
14667 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
|
14668 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
|
14669 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
|
14670 (filename) |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14671 Lisp_Object filename; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14672 { |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14673 Lisp_Object encoded, value; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14674 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40528
diff
changeset
|
14675 CHECK_STRING (filename); |
34643
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14676 filename = Fexpand_file_name (filename, Qnil); |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14677 encoded = ENCODE_FILE (filename); |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14678 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14679 value = Qnil; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14680 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14681 /* Determining the required information on Windows turns out, sadly, |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14682 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
|
14683 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
|
14684 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
|
14685 added rather late on. */ |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14686 { |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14687 HMODULE hKernel = GetModuleHandle ("kernel32"); |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14688 BOOL (*pfn_GetDiskFreeSpaceEx) |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14689 (char *, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER) |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14690 = (void *) GetProcAddress (hKernel, "GetDiskFreeSpaceEx"); |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14691 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14692 /* 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
|
14693 volume holding FILENAME. */ |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14694 char rootname[MAX_PATH]; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14695 char *name = XSTRING (encoded)->data; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14696 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14697 /* find the root name of the volume if given */ |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14698 if (isalpha (name[0]) && name[1] == ':') |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14699 { |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14700 rootname[0] = name[0]; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14701 rootname[1] = name[1]; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14702 rootname[2] = '\\'; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14703 rootname[3] = 0; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14704 } |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14705 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
|
14706 { |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14707 char *str = rootname; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14708 int slashes = 4; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14709 do |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14710 { |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14711 if (IS_DIRECTORY_SEP (*name) && --slashes == 0) |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14712 break; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14713 *str++ = *name++; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14714 } |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14715 while ( *name ); |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14716 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14717 *str++ = '\\'; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14718 *str = 0; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14719 } |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14720 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14721 if (pfn_GetDiskFreeSpaceEx) |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14722 { |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
14723 /* Unsigned large integers cannot be cast to double, so |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
14724 use signed ones instead. */ |
34643
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14725 LARGE_INTEGER availbytes; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14726 LARGE_INTEGER freebytes; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14727 LARGE_INTEGER totalbytes; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14728 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14729 if (pfn_GetDiskFreeSpaceEx(rootname, |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
14730 (ULARGE_INTEGER *)&availbytes, |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
14731 (ULARGE_INTEGER *)&totalbytes, |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
14732 (ULARGE_INTEGER *)&freebytes)) |
34643
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14733 value = list3 (make_float ((double) totalbytes.QuadPart), |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14734 make_float ((double) freebytes.QuadPart), |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14735 make_float ((double) availbytes.QuadPart)); |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14736 } |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14737 else |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14738 { |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14739 DWORD sectors_per_cluster; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14740 DWORD bytes_per_sector; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14741 DWORD free_clusters; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14742 DWORD total_clusters; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14743 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14744 if (GetDiskFreeSpace(rootname, |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14745 §ors_per_cluster, |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14746 &bytes_per_sector, |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14747 &free_clusters, |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14748 &total_clusters)) |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14749 value = list3 (make_float ((double) total_clusters |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14750 * sectors_per_cluster * bytes_per_sector), |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14751 make_float ((double) free_clusters |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14752 * sectors_per_cluster * bytes_per_sector), |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14753 make_float ((double) free_clusters |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14754 * sectors_per_cluster * bytes_per_sector)); |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14755 } |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14756 } |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14757 |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14758 return value; |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14759 } |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
14760 |
41480
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
14761 /*********************************************************************** |
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
14762 Initialization |
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
14763 ***********************************************************************/ |
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
14764 |
2c71c672b3c7
(x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents:
41448
diff
changeset
|
14765 void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14766 syms_of_w32fns () |
13434 | 14767 { |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
14768 HMODULE user32_lib = GetModuleHandle ("user32.dll"); |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
14769 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14770 /* 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
|
14771 w32_in_use = 0; |
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
14772 |
41732
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
14773 /* 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
|
14774 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
|
14775 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
|
14776 track_mouse_window = NULL; |
0d9b74cd27cd
(trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents:
41726
diff
changeset
|
14777 |
42918
9b06036a8c5e
(syms_of_w32fns): Initialize w32_visible_system_caret_hwnd.
Jason Rumney <jasonr@gnu.org>
parents:
42865
diff
changeset
|
14778 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
|
14779 |
13434 | 14780 Qauto_raise = intern ("auto-raise"); |
14781 staticpro (&Qauto_raise); | |
14782 Qauto_lower = intern ("auto-lower"); | |
14783 staticpro (&Qauto_lower); | |
14784 Qbar = intern ("bar"); | |
14785 staticpro (&Qbar); | |
14786 Qborder_color = intern ("border-color"); | |
14787 staticpro (&Qborder_color); | |
14788 Qborder_width = intern ("border-width"); | |
14789 staticpro (&Qborder_width); | |
14790 Qbox = intern ("box"); | |
14791 staticpro (&Qbox); | |
14792 Qcursor_color = intern ("cursor-color"); | |
14793 staticpro (&Qcursor_color); | |
14794 Qcursor_type = intern ("cursor-type"); | |
14795 staticpro (&Qcursor_type); | |
14796 Qgeometry = intern ("geometry"); | |
14797 staticpro (&Qgeometry); | |
14798 Qicon_left = intern ("icon-left"); | |
14799 staticpro (&Qicon_left); | |
14800 Qicon_top = intern ("icon-top"); | |
14801 staticpro (&Qicon_top); | |
14802 Qicon_type = intern ("icon-type"); | |
14803 staticpro (&Qicon_type); | |
14804 Qicon_name = intern ("icon-name"); | |
14805 staticpro (&Qicon_name); | |
14806 Qinternal_border_width = intern ("internal-border-width"); | |
14807 staticpro (&Qinternal_border_width); | |
14808 Qleft = intern ("left"); | |
14809 staticpro (&Qleft); | |
16259
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
14810 Qright = intern ("right"); |
f54af1701a5f
(Qright): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16106
diff
changeset
|
14811 staticpro (&Qright); |
13434 | 14812 Qmouse_color = intern ("mouse-color"); |
14813 staticpro (&Qmouse_color); | |
14814 Qnone = intern ("none"); | |
14815 staticpro (&Qnone); | |
14816 Qparent_id = intern ("parent-id"); | |
14817 staticpro (&Qparent_id); | |
14818 Qscroll_bar_width = intern ("scroll-bar-width"); | |
14819 staticpro (&Qscroll_bar_width); | |
14820 Qsuppress_icon = intern ("suppress-icon"); | |
14821 staticpro (&Qsuppress_icon); | |
14822 Qundefined_color = intern ("undefined-color"); | |
14823 staticpro (&Qundefined_color); | |
14824 Qvertical_scroll_bars = intern ("vertical-scroll-bars"); | |
14825 staticpro (&Qvertical_scroll_bars); | |
14826 Qvisibility = intern ("visibility"); | |
14827 staticpro (&Qvisibility); | |
14828 Qwindow_id = intern ("window-id"); | |
14829 staticpro (&Qwindow_id); | |
14830 Qx_frame_parameter = intern ("x-frame-parameter"); | |
14831 staticpro (&Qx_frame_parameter); | |
14832 Qx_resource_name = intern ("x-resource-name"); | |
14833 staticpro (&Qx_resource_name); | |
14834 Quser_position = intern ("user-position"); | |
14835 staticpro (&Quser_position); | |
14836 Quser_size = intern ("user-size"); | |
14837 staticpro (&Quser_size); | |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14838 Qscreen_gamma = intern ("screen-gamma"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14839 staticpro (&Qscreen_gamma); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14840 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
|
14841 staticpro (&Qline_spacing); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14842 Qcenter = intern ("center"); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
14843 staticpro (&Qcenter); |
36000
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
14844 Qcancel_timer = intern ("cancel-timer"); |
f4a0b086cc5d
(Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents:
35674
diff
changeset
|
14845 staticpro (&Qcancel_timer); |
43398 | 14846 Qfullscreen = intern ("fullscreen"); |
14847 staticpro (&Qfullscreen); | |
14848 Qfullwidth = intern ("fullwidth"); | |
14849 staticpro (&Qfullwidth); | |
14850 Qfullheight = intern ("fullheight"); | |
14851 staticpro (&Qfullheight); | |
14852 Qfullboth = intern ("fullboth"); | |
14853 staticpro (&Qfullboth); | |
13434 | 14854 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14855 Qhyper = intern ("hyper"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14856 staticpro (&Qhyper); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14857 Qsuper = intern ("super"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14858 staticpro (&Qsuper); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14859 Qmeta = intern ("meta"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14860 staticpro (&Qmeta); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14861 Qalt = intern ("alt"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14862 staticpro (&Qalt); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14863 Qctrl = intern ("ctrl"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14864 staticpro (&Qctrl); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14865 Qcontrol = intern ("control"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14866 staticpro (&Qcontrol); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14867 Qshift = intern ("shift"); |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14868 staticpro (&Qshift); |
43398 | 14869 /* This is the end of symbol initialization. */ |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14870 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14871 /* 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
|
14872 Vtext_property_default_nonsticky |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14873 = 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
|
14874 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14875 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14876 Qlaplace = intern ("laplace"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14877 staticpro (&Qlaplace); |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14878 Qemboss = intern ("emboss"); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14879 staticpro (&Qemboss); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14880 Qedge_detection = intern ("edge-detection"); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14881 staticpro (&Qedge_detection); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14882 Qheuristic = intern ("heuristic"); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14883 staticpro (&Qheuristic); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14884 QCmatrix = intern (":matrix"); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14885 staticpro (&QCmatrix); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14886 QCcolor_adjustment = intern (":color-adjustment"); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14887 staticpro (&QCcolor_adjustment); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14888 QCmask = intern (":mask"); |
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
14889 staticpro (&QCmask); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
14890 |
22625
e7bd87148368
(Fx_list_fonts): Bring arglist into sync with xfns.c.
Richard M. Stallman <rms@gnu.org>
parents:
22078
diff
changeset
|
14891 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
|
14892 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
|
14893 |
13434 | 14894 Fput (Qundefined_color, Qerror_conditions, |
14895 Fcons (Qundefined_color, Fcons (Qerror, Qnil))); | |
14896 Fput (Qundefined_color, Qerror_message, | |
14897 build_string ("Undefined color")); | |
14898 | |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14899 staticpro (&w32_grabbed_keys); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14900 w32_grabbed_keys = Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14901 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14902 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
|
14903 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
|
14904 Vw32_color_map = Qnil; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14905 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14906 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
|
14907 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
|
14908 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
|
14909 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
|
14910 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
|
14911 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14912 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
|
14913 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
|
14914 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
|
14915 Vw32_alt_is_meta = Qt; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14916 |
24339
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
14917 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
|
14918 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
|
14919 XSETINT (Vw32_quit_key, 0); |
e8b73c2ac4ec
(Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24252
diff
changeset
|
14920 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14921 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
|
14922 &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
|
14923 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
|
14924 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
|
14925 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
|
14926 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14927 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
|
14928 &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
|
14929 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
|
14930 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
|
14931 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
|
14932 |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14933 DEFVAR_INT ("w32-phantom-key-code", |
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14934 &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
|
14935 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
|
14936 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
|
14937 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
14938 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
|
14939 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
|
14940 `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
|
14941 /* 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
|
14942 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
|
14943 Vw32_phantom_key_code = 255; |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
14944 |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14945 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
|
14946 &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
|
14947 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
|
14948 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
|
14949 Vw32_enable_num_lock = Qt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14950 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14951 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
|
14952 &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
|
14953 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
|
14954 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
|
14955 Vw32_enable_caps_lock = Qt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14956 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14957 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
|
14958 &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
|
14959 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
|
14960 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
|
14961 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
|
14962 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
|
14963 Vw32_scroll_lock_modifier = Qt; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14964 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14965 DEFVAR_LISP ("w32-lwindow-modifier", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14966 &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
|
14967 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
|
14968 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
|
14969 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
|
14970 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
|
14971 Vw32_lwindow_modifier = Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14972 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14973 DEFVAR_LISP ("w32-rwindow-modifier", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14974 &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
|
14975 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
|
14976 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
|
14977 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
|
14978 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
|
14979 Vw32_rwindow_modifier = Qnil; |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14980 |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14981 DEFVAR_LISP ("w32-apps-modifier", |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
14982 &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
|
14983 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
|
14984 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
|
14985 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
|
14986 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
|
14987 Vw32_apps_modifier = Qnil; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14988 |
42845
ebb3a20bc357
(w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents:
42833
diff
changeset
|
14989 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
|
14990 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
|
14991 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
|
14992 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14993 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
|
14994 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
|
14995 Vw32_enable_palette = Qt; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14996 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
14997 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
|
14998 &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
|
14999 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
|
15000 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
|
15001 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
|
15002 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
|
15003 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
|
15004 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
|
15005 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
15006 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
|
15007 &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
|
15008 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
|
15009 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
|
15010 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
|
15011 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
|
15012 XSETINT (Vw32_mouse_move_interval, 0); |
15290
da73440fdb5f
(Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents:
15280
diff
changeset
|
15013 |
42719
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
15014 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
|
15015 &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
|
15016 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
|
15017 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
|
15018 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
|
15019 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
|
15020 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
|
15021 system to handle them. */); |
70f13c4f82c7
(w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents:
42537
diff
changeset
|
15022 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
|
15023 |
13434 | 15024 init_x_parm_symbols (); |
15025 | |
15026 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
|
15027 doc: /* List of directories to search for bitmap files for w32. */); |
13434 | 15028 Vx_bitmap_file_path = decode_env_path ((char *) 0, "PATH"); |
15029 | |
15030 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
|
15031 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
|
15032 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
|
15033 unless you set the mouse color. */); |
13434 | 15034 Vx_pointer_shape = Qnil; |
15035 | |
15036 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
|
15037 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
|
15038 `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
|
15039 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
|
15040 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
|
15041 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
|
15042 switches, if present. */); |
13434 | 15043 Vx_resource_name = Qnil; |
15044 | |
15045 Vx_nontext_pointer_shape = Qnil; | |
15046 | |
15047 Vx_mode_pointer_shape = Qnil; | |
15048 | |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
15049 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
|
15050 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
|
15051 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
|
15052 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
|
15053 Vx_hourglass_pointer_shape = Qnil; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
15054 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
15055 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
|
15056 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
|
15057 display_hourglass_p = 1; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
15058 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
15059 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
|
15060 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
|
15061 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
|
15062 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
|
15063 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15064 DEFVAR_LISP ("x-sensitive-text-pointer-shape", |
13434 | 15065 &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
|
15066 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
|
15067 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
|
15068 or when you set the mouse color. */); |
13434 | 15069 Vx_sensitive_text_pointer_shape = Qnil; |
15070 | |
34133
f1063cc498e4
(Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents:
34089
diff
changeset
|
15071 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
|
15072 &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
|
15073 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
|
15074 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
|
15075 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
|
15076 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
|
15077 |
13434 | 15078 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
|
15079 doc: /* A string indicating the foreground color of the cursor box. */); |
13434 | 15080 Vx_cursor_fore_pixel = Qnil; |
15081 | |
40120
03eb905a4d8e
(Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents:
40009
diff
changeset
|
15082 DEFVAR_LISP ("x-max-tooltip-size", &Vx_max_tooltip_size, |
41019 | 15083 doc: /* Maximum size for tooltips. |
15084 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
|
15085 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
|
15086 |
13434 | 15087 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
|
15088 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
|
15089 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
|
15090 unless you set it to something else. */); |
13434 | 15091 /* We don't have any way to find this out, so set it to nil |
15092 and maybe the user would like to set it to t. */ | |
15093 Vx_no_window_manager = Qnil; | |
15094 | |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
15095 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
|
15096 &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
|
15097 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
|
15098 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
15099 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
|
15100 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
|
15101 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
|
15102 Chinese, Japanese, and Korean. */); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
15103 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
|
15104 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15105 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
|
15106 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
|
15107 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
|
15108 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
|
15109 meaning don't clear the cache. */); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15110 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
|
15111 |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
15112 DEFVAR_LISP ("w32-bdf-filename-alist", |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
15113 &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
|
15114 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
|
15115 Vw32_bdf_filename_alist = Qnil; |
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
15116 |
24481
f65692fe7dd5
(w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24479
diff
changeset
|
15117 DEFVAR_BOOL ("w32-strict-fontnames", |
f65692fe7dd5
(w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24479
diff
changeset
|
15118 &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
|
15119 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
|
15120 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
|
15121 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
|
15122 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
|
15123 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
|
15124 fontsets are automatically created. */); |
24481
f65692fe7dd5
(w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24479
diff
changeset
|
15125 w32_strict_fontnames = 0; |
f65692fe7dd5
(w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24479
diff
changeset
|
15126 |
24695
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
15127 DEFVAR_BOOL ("w32-strict-painting", |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
15128 &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
|
15129 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
|
15130 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
|
15131 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
|
15132 w32_strict_painting = 1; |
2fe2c743ce68
(w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents:
24692
diff
changeset
|
15133 |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15134 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
|
15135 &Vw32_charset_info_alist, |
41019 | 15136 doc: /* Alist linking Emacs character sets to Windows fonts and codepages. |
15137 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
|
15138 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
15139 (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
|
15140 |
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
15141 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
|
15142 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
|
15143 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
|
15144 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
|
15145 w32-charset-chinesebig5, |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15146 #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
|
15147 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
|
15148 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
|
15149 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
|
15150 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
|
15151 #endif |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15152 #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
|
15153 w32-charset-unicode, |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15154 #endif |
40964
fb970d0c56eb
Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents:
40873
diff
changeset
|
15155 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
|
15156 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
|
15157 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
|
15158 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
|
15159 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
|
15160 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
|
15161 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15162 staticpro (&Qw32_charset_ansi); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15163 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
|
15164 staticpro (&Qw32_charset_symbol); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15165 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
|
15166 staticpro (&Qw32_charset_shiftjis); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15167 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
|
15168 staticpro (&Qw32_charset_hangeul); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
15169 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
|
15170 staticpro (&Qw32_charset_chinesebig5); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15171 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
|
15172 staticpro (&Qw32_charset_gb2312); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15173 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
|
15174 staticpro (&Qw32_charset_oem); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15175 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
|
15176 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15177 #ifdef JOHAB_CHARSET |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15178 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15179 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
|
15180 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
|
15181 doc: /* Internal variable. */); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15182 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15183 staticpro (&Qw32_charset_johab); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15184 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
|
15185 staticpro (&Qw32_charset_easteurope); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15186 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
|
15187 staticpro (&Qw32_charset_turkish); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15188 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
|
15189 staticpro (&Qw32_charset_baltic); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15190 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
|
15191 staticpro (&Qw32_charset_russian); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15192 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
|
15193 staticpro (&Qw32_charset_arabic); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15194 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
|
15195 staticpro (&Qw32_charset_greek); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15196 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
|
15197 staticpro (&Qw32_charset_hebrew); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15198 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
|
15199 staticpro (&Qw32_charset_vietnamese); |
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
15200 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
|
15201 staticpro (&Qw32_charset_thai); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15202 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
|
15203 staticpro (&Qw32_charset_mac); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15204 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
|
15205 } |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15206 #endif |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15207 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15208 #ifdef UNICODE_CHARSET |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15209 { |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15210 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
|
15211 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
|
15212 &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
|
15213 doc: /* Internal variable. */); |
29317
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15214 |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15215 staticpro (&Qw32_charset_unicode); |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15216 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
|
15217 #endif |
2d3d5bf49d4e
Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents:
29021
diff
changeset
|
15218 |
13434 | 15219 defsubr (&Sx_get_resource); |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
15220 #if 0 /* TODO: Port to W32 */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15221 defsubr (&Sx_change_window_property); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15222 defsubr (&Sx_delete_window_property); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15223 defsubr (&Sx_window_property); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15224 #endif |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
25646
diff
changeset
|
15225 defsubr (&Sxw_display_color_p); |
13434 | 15226 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
|
15227 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
|
15228 defsubr (&Sxw_color_values); |
13434 | 15229 defsubr (&Sx_server_max_request_size); |
15230 defsubr (&Sx_server_vendor); | |
15231 defsubr (&Sx_server_version); | |
15232 defsubr (&Sx_display_pixel_width); | |
15233 defsubr (&Sx_display_pixel_height); | |
15234 defsubr (&Sx_display_mm_width); | |
15235 defsubr (&Sx_display_mm_height); | |
15236 defsubr (&Sx_display_screens); | |
15237 defsubr (&Sx_display_planes); | |
15238 defsubr (&Sx_display_color_cells); | |
15239 defsubr (&Sx_display_visual_class); | |
15240 defsubr (&Sx_display_backing_store); | |
15241 defsubr (&Sx_display_save_under); | |
15242 defsubr (&Sx_parse_geometry); | |
15243 defsubr (&Sx_create_frame); | |
15244 defsubr (&Sx_open_connection); | |
15245 defsubr (&Sx_close_connection); | |
15246 defsubr (&Sx_display_list); | |
15247 defsubr (&Sx_synchronize); | |
15248 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
15249 /* W32 specific functions */ |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
15250 |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
15251 defsubr (&Sw32_focus_frame); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
15252 defsubr (&Sw32_select_font); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
15253 defsubr (&Sw32_define_rgb_color); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
15254 defsubr (&Sw32_default_color_map); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
15255 defsubr (&Sw32_load_color_file); |
19707
0181cc080316
Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18508
diff
changeset
|
15256 defsubr (&Sw32_send_sys_command); |
24670 | 15257 defsubr (&Sw32_shell_execute); |
23681
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
15258 defsubr (&Sw32_register_hot_key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
15259 defsubr (&Sw32_unregister_hot_key); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
15260 defsubr (&Sw32_registered_hot_keys); |
af0276da2059
(Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23637
diff
changeset
|
15261 defsubr (&Sw32_reconstruct_hot_key); |
23803
f112aa8f8f5d
(Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23801
diff
changeset
|
15262 defsubr (&Sw32_toggle_lock_key); |
24147
c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24130
diff
changeset
|
15263 defsubr (&Sw32_find_bdf_fonts); |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
15264 |
34643
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
15265 defsubr (&Sfile_system_info); |
7108531c744b
(Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents:
34638
diff
changeset
|
15266 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
15267 /* Setting callback functions for fontset handler. */ |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
15268 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
|
15269 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15270 #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
|
15271 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
|
15272 list_fonts_func = w32_list_fonts; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15273 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15274 |
23506
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
15275 load_font_func = w32_load_font; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
15276 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
|
15277 query_font_func = w32_query_font; |
246a14f0622f
(Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23407
diff
changeset
|
15278 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
|
15279 check_window_system_func = check_w32; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15280 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15281 /* Images. */ |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15282 Qxbm = intern ("xbm"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15283 staticpro (&Qxbm); |
35359
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
15284 QCconversion = intern (":conversion"); |
b5a2207901e0
(QCconversion): Replaces QCalgorithm. Update copyright.
Gerd Moellmann <gerd@gnu.org>
parents:
35288
diff
changeset
|
15285 staticpro (&QCconversion); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15286 QCheuristic_mask = intern (":heuristic-mask"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15287 staticpro (&QCheuristic_mask); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15288 QCcolor_symbols = intern (":color-symbols"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15289 staticpro (&QCcolor_symbols); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15290 QCascent = intern (":ascent"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15291 staticpro (&QCascent); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15292 QCmargin = intern (":margin"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15293 staticpro (&QCmargin); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15294 QCrelief = intern (":relief"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15295 staticpro (&QCrelief); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15296 Qpostscript = intern ("postscript"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15297 staticpro (&Qpostscript); |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
15298 #if 0 /* TODO: These need entries at top of file. */ |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15299 QCloader = intern (":loader"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15300 staticpro (&QCloader); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15301 QCbounding_box = intern (":bounding-box"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15302 staticpro (&QCbounding_box); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15303 QCpt_width = intern (":pt-width"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15304 staticpro (&QCpt_width); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15305 QCpt_height = intern (":pt-height"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15306 staticpro (&QCpt_height); |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
15307 #endif |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15308 QCindex = intern (":index"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15309 staticpro (&QCindex); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15310 Qpbm = intern ("pbm"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15311 staticpro (&Qpbm); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15312 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15313 #if HAVE_XPM |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15314 Qxpm = intern ("xpm"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15315 staticpro (&Qxpm); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15316 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15317 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15318 #if HAVE_JPEG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15319 Qjpeg = intern ("jpeg"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15320 staticpro (&Qjpeg); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15321 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15322 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15323 #if HAVE_TIFF |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15324 Qtiff = intern ("tiff"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15325 staticpro (&Qtiff); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15326 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15327 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15328 #if HAVE_GIF |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15329 Qgif = intern ("gif"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15330 staticpro (&Qgif); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15331 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15332 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15333 #if HAVE_PNG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15334 Qpng = intern ("png"); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15335 staticpro (&Qpng); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15336 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15337 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15338 defsubr (&Sclear_image_cache); |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
15339 defsubr (&Simage_size); |
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
15340 defsubr (&Simage_mask_p); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15341 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15342 #if GLYPH_DEBUG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15343 defsubr (&Simagep); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15344 defsubr (&Slookup_image); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15345 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15346 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
15347 hourglass_atimer = NULL; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
36080
diff
changeset
|
15348 hourglass_shown_p = 0; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15349 defsubr (&Sx_show_tip); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15350 defsubr (&Sx_hide_tip); |
34729
3dc60d80125f
(syms_of_w32fns): Initialize and staticpro tip_frame.
Jason Rumney <jasonr@gnu.org>
parents:
34698
diff
changeset
|
15351 tip_timer = Qnil; |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15352 staticpro (&tip_timer); |
34729
3dc60d80125f
(syms_of_w32fns): Initialize and staticpro tip_frame.
Jason Rumney <jasonr@gnu.org>
parents:
34698
diff
changeset
|
15353 tip_frame = Qnil; |
3dc60d80125f
(syms_of_w32fns): Initialize and staticpro tip_frame.
Jason Rumney <jasonr@gnu.org>
parents:
34698
diff
changeset
|
15354 staticpro (&tip_frame); |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15355 |
41380
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
15356 last_show_tip_args = Qnil; |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
15357 staticpro (&last_show_tip_args); |
aff1b15f295b
(x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents:
41322
diff
changeset
|
15358 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15359 defsubr (&Sx_file_dialog); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15360 } |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15361 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15362 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15363 void |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15364 init_xfns () |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15365 { |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15366 image_types = NULL; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15367 Vimage_types = Qnil; |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15368 |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
15369 define_image_type (&pbm_type); |
44123
f23c96125044
(xbm_scan, xbm_load_image, xbm_read_bitmap_data)
Jason Rumney <jasonr@gnu.org>
parents:
44109
diff
changeset
|
15370 define_image_type (&xbm_type); |
33387
01a10bc04233
(Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents:
33216
diff
changeset
|
15371 #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
|
15372 define_image_type (&gs_type); |
44047
73645cbc79a7
(x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents:
43963
diff
changeset
|
15373 #endif |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15374 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15375 #if HAVE_XPM |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15376 define_image_type (&xpm_type); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15377 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15378 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15379 #if HAVE_JPEG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15380 define_image_type (&jpeg_type); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15381 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15382 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15383 #if HAVE_TIFF |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15384 define_image_type (&tiff_type); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15385 #endif |
44109
b615e4daf825
[HAVE_IMAGES, HAVE_PBM]: Remove conditionals.
Jason Rumney <jasonr@gnu.org>
parents:
44097
diff
changeset
|
15386 |
27397
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15387 #if HAVE_GIF |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15388 define_image_type (&gif_type); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15389 #endif |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15390 |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15391 #if HAVE_PNG |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15392 define_image_type (&png_type); |
d98e84b468a2
Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents:
26729
diff
changeset
|
15393 #endif |
13434 | 15394 } |
15395 | |
15396 #undef abort | |
15397 | |
15398 void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16259
diff
changeset
|
15399 w32_abort() |
13434 | 15400 { |
15147
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15401 int button; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15402 button = MessageBox (NULL, |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15403 "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
|
15404 "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
|
15405 "Emacs Abort Dialog", |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15406 MB_ICONEXCLAMATION | MB_TASKMODAL |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15407 | MB_SETFOREGROUND | MB_ABORTRETRYIGNORE); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15408 switch (button) |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15409 { |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15410 case IDRETRY: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15411 DebugBreak (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15412 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15413 case IDIGNORE: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15414 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15415 case IDABORT: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15416 default: |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15417 abort (); |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15418 break; |
38c0ce06203f
(quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents:
15034
diff
changeset
|
15419 } |
13434 | 15420 } |
15148
220145cf7546
(continuation of previous checkin)
Geoff Voelker <voelker@cs.washington.edu>
parents:
15147
diff
changeset
|
15421 |
23801
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
15422 /* For convenience when debugging. */ |
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
15423 int |
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
15424 w32_last_error() |
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
15425 { |
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
15426 return GetLastError (); |
119fd94ae526
(w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23681
diff
changeset
|
15427 } |