annotate src/w32fns.c @ 83878:f65f55d787ec

Horizontal mouse wheel support: (w32_wnd_proc) <WM_DROPFILES>: Merge with WM_MOUSEWHEEL. <WM_MOUSEHWHEEL>: Pass new system message to lisp. MULTI_KBOARD support: (x_create_tip_frame) [MULTI_KBOARD]: Get keyboard from terminal.
author Jason Rumney <jasonr@gnu.org>
date Tue, 04 Sep 2007 21:40:59 +0000
parents 65663fcd2caa
children 4197a953442f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
1 /* Graphical user interface functions for the Microsoft W32 API.
64770
a0d1312ede66 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64662
diff changeset
2 Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
75348
3d45362f1d38 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 74661
diff changeset
3 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5 This file is part of GNU Emacs.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7 GNU Emacs is free software; you can redistribute it and/or modify
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
78260
922696f363b0 Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 78212
diff changeset
9 the Free Software Foundation; either version 3, or (at your option)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
10 any later version.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
11
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
15 GNU General Public License for more details.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
16
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
18 along with GNU Emacs; see the file COPYING. If not, write to
64084
a8fa7c632ee4 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63772
diff changeset
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
a8fa7c632ee4 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63772
diff changeset
20 Boston, MA 02110-1301, USA. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
21
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
22 /* Added by Kevin Gallo */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
23
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
24 #include <config.h>
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
25
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
26 #include <signal.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
27 #include <stdio.h>
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
28 #include <limits.h>
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
29 #include <errno.h>
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
30
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
31 #include "lisp.h"
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
32 #include "charset.h"
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
33 #include "dispextern.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
34 #include "w32term.h"
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
36 #include "frame.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
37 #include "window.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
41 #include "blockinput.h"
24412
d11ac02f9d6a Use epaths.h istead of paths.h.
Richard M. Stallman <rms@gnu.org>
parents: 24339
diff changeset
42 #include "epaths.h"
16593
4ed80eda6fac Use new names for w32 files
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
43 #include "w32heap.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
44 #include "termhooks.h"
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
45 #include "coding.h"
25069
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
46 #include "ccl.h"
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
47 #include "systime.h"
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
48
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
49 #include "bitmaps/gray.xbm"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
50
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
51 #include <commdlg.h>
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
52 #include <shellapi.h>
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
53 #include <ctype.h>
53739
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
54 #include <winspool.h>
78106
f9eb7f243bdc (w32_msg_pump) <WM_EMACS_CREATEWINDOW>: Initialize COM.
Jason Rumney <jasonr@gnu.org>
parents: 77995
diff changeset
55 #include <objbase.h>
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
56
45963
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
57 #include <dlgs.h>
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
58 #define FILE_NAME_TEXT_FIELD edt1
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
59
48888
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
60 void syms_of_w32fns ();
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
61 void globals_of_w32fns ();
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
62
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
63 extern void free_frame_menubar ();
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
64 extern double atof ();
41732
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
65 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
66 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
67 extern void w32_free_menu_strings P_ ((HWND));
59333
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
68 extern XCharStruct *w32_per_char_metric P_ ((XFontStruct *, wchar_t *, int));
41732
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
69
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
70 extern int quit_char;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
71
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
72 extern char *lispy_function_keys[];
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
73
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
74 /* The gray bitmap `bitmaps/gray'. This is done because w32term.c uses
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
75 it, and including `bitmaps/gray' more than once is a problem when
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
76 config.h defines `static' as an empty replacement string. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
77
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
78 int gray_bitmap_width = gray_width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
79 int gray_bitmap_height = gray_height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
80 unsigned char *gray_bitmap_bits = gray_bits;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
81
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
82 /* The colormap for converting color names to RGB values */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
83 Lisp_Object Vw32_color_map;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
84
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
85 /* Non nil if alt key presses are passed on to Windows. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
86 Lisp_Object Vw32_pass_alt_to_system;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
87
15459
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
88 /* Non nil if alt key is translated to meta_modifier, nil if it is translated
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
89 to alt_modifier. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
90 Lisp_Object Vw32_alt_is_meta;
15459
76ff60cd2b8d (Vwin32_alt_is_meta): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 15434
diff changeset
91
24339
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
92 /* If non-zero, the windows virtual key code for an alternative quit key. */
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
93 int w32_quit_key;
24339
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
94
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
95 /* Non nil if left window key events are passed on to Windows (this only
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
96 affects whether "tapping" the key opens the Start menu). */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
97 Lisp_Object Vw32_pass_lwindow_to_system;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
98
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
99 /* Non nil if right window key events are passed on to Windows (this
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
100 only affects whether "tapping" the key opens the Start menu). */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
101 Lisp_Object Vw32_pass_rwindow_to_system;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
102
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
103 /* Virtual key code used to generate "phantom" key presses in order
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
104 to stop system from acting on Windows key events. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
105 Lisp_Object Vw32_phantom_key_code;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
106
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
107 /* Modifier associated with the left "Windows" key, or nil to act as a
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
108 normal key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
109 Lisp_Object Vw32_lwindow_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
110
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
111 /* Modifier associated with the right "Windows" key, or nil to act as a
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
112 normal key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
113 Lisp_Object Vw32_rwindow_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
114
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
115 /* Modifier associated with the "Apps" key, or nil to act as a normal
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
116 key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
117 Lisp_Object Vw32_apps_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
118
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
119 /* Value is nil if Num Lock acts as a function key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
120 Lisp_Object Vw32_enable_num_lock;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
121
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
122 /* Value is nil if Caps Lock acts as a function key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
123 Lisp_Object Vw32_enable_caps_lock;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
124
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
125 /* Modifier associated with Scroll Lock, or nil to act as a normal key. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
126 Lisp_Object Vw32_scroll_lock_modifier;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
127
27894
6c4ff3519d09 (w32_wnd_proc) [WM_LBUTTON_DOWN, WM_RBUTTON_DOWN, WM_LBUTTON_UP,
Jason Rumney <jasonr@gnu.org>
parents: 27516
diff changeset
128 /* Switch to control whether we inhibit requests for synthesized bold
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
129 and italic versions of fonts. */
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
130 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
131
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
132 /* Enable palette management. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
133 Lisp_Object Vw32_enable_palette;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
134
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
135 /* Control how close left/right button down events must be to
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
136 be converted to a middle button down event. */
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
137 int w32_mouse_button_tolerance;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
138
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
139 /* Minimum interval between mouse movement (and scroll bar drag)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
140 events that are passed on to the event loop. */
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
141 int w32_mouse_move_interval;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
142
42719
70f13c4f82c7 (w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents: 42537
diff changeset
143 /* 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
144 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
145
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
146 /* Non nil if no window manager is in use. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
147 Lisp_Object Vx_no_window_manager;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
148
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
149 /* Non-zero means we're allowed to display a hourglass pointer. */
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
150
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
151 int display_hourglass_p;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
152
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
153 /* The background and shape of the mouse pointer, and shape when not
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
154 over text or in the modeline. */
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
155
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
156 Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape;
64487
c9a7bffa9534 (Vx_hand_shape): Variable removed.
Kim F. Storm <storm@cua.dk>
parents: 64084
diff changeset
157 Lisp_Object Vx_hourglass_pointer_shape, Vx_window_horizontal_drag_shape;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
158
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
159 /* The shape when over mouse-sensitive text. */
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
160
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
161 Lisp_Object Vx_sensitive_text_pointer_shape;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
162
49369
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
163 #ifndef IDC_HAND
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
164 #define IDC_HAND MAKEINTRESOURCE(32649)
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
165 #endif
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
166
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
167 /* 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
168
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
169 Lisp_Object Vx_cursor_fore_pixel;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
170
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
171 /* 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
172
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
173 static int w32_in_use;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
174
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
175 /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
176
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
177 Lisp_Object Vx_pixel_size_width_font_regexp;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
178
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
179 /* Alist of bdf fonts and the files that define them. */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
180 Lisp_Object Vw32_bdf_filename_alist;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
181
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
182 /* 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
183 int w32_strict_fontnames;
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
184
24695
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
185 /* 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
186 indicates there is an update region. */
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
187 int w32_strict_painting;
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
188
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
189 /* 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
190 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
191
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
192 /* 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
193 #ifndef VIETNAMESE_CHARSET
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
194 #define VIETNAMESE_CHARSET 163
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
195 #endif
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
196
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
197 Lisp_Object Qnone;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
198 Lisp_Object Qsuppress_icon;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
199 Lisp_Object Qundefined_color;
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
200 Lisp_Object Qcancel_timer;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
201 Lisp_Object Qhyper;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
202 Lisp_Object Qsuper;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
203 Lisp_Object Qmeta;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
204 Lisp_Object Qalt;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
205 Lisp_Object Qctrl;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
206 Lisp_Object Qcontrol;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
207 Lisp_Object Qshift;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
208
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
209 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
210 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
211 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
212 Lisp_Object Qw32_charset_shiftjis;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
213 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
214 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
215 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
216 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
217
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
218 #ifndef JOHAB_CHARSET
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
219 #define JOHAB_CHARSET 130
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
220 #endif
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
221 #ifdef JOHAB_CHARSET
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
222 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
223 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
224 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
225 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
226 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
227 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
228 Lisp_Object Qw32_charset_hebrew;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
229 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
230 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
231 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
232 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
233 #endif
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
234
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
235 #ifdef UNICODE_CHARSET
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
236 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
237 #endif
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
238
55468
f13a7f45ce0f (Vw32_ansi_code_page): New Lisp variable.
Jason Rumney <jasonr@gnu.org>
parents: 54336
diff changeset
239 /* The ANSI codepage. */
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
240 int w32_ansi_code_page;
55468
f13a7f45ce0f (Vw32_ansi_code_page): New Lisp variable.
Jason Rumney <jasonr@gnu.org>
parents: 54336
diff changeset
241
51474
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
242 /* Prefix for system colors. */
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
243 #define SYSTEM_COLOR_PREFIX "System"
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
244 #define SYSTEM_COLOR_PREFIX_LEN (sizeof (SYSTEM_COLOR_PREFIX) - 1)
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
245
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
246 /* 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
247 #define LMOUSE 1
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
248 #define MMOUSE 2
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
249 #define RMOUSE 4
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
250
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
251 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
252 static W32Msg saved_mouse_button_msg;
43472
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
253 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
254 static W32Msg saved_mouse_move_msg;
43472
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
255 static unsigned mouse_move_timer = 0;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
256
41732
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
257 /* Window that is tracking the mouse. */
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
258 static HWND track_mouse_window;
48375
4d7b83cc03aa Added a partial implementation of play-sound-internal for Windows. Fixed the following entry in etc/PROBLEMS: Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs built on XP crashes at startup on Windows 9x/ME.
Ben Key <bkey1@tampabay.rr.com>
parents: 48359
diff changeset
259
51776
6a03280c654a (clipboard_sequence_fn): New variable.
Jason Rumney <jasonr@gnu.org>
parents: 51763
diff changeset
260 typedef BOOL (WINAPI * TrackMouseEvent_Proc)
6a03280c654a (clipboard_sequence_fn): New variable.
Jason Rumney <jasonr@gnu.org>
parents: 51763
diff changeset
261 (IN OUT LPTRACKMOUSEEVENT lpEventTrack);
6a03280c654a (clipboard_sequence_fn): New variable.
Jason Rumney <jasonr@gnu.org>
parents: 51763
diff changeset
262
6a03280c654a (clipboard_sequence_fn): New variable.
Jason Rumney <jasonr@gnu.org>
parents: 51763
diff changeset
263 TrackMouseEvent_Proc track_mouse_event_fn = NULL;
6a03280c654a (clipboard_sequence_fn): New variable.
Jason Rumney <jasonr@gnu.org>
parents: 51763
diff changeset
264 ClipboardSequence_Proc clipboard_sequence_fn = NULL;
56971
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
265 extern AppendMenuW_Proc unicode_append_menu;
41732
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
266
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
267 /* W95 mousewheel handler */
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
268 unsigned int msh_mousewheel = 0;
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
269
43472
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
270 /* Timers */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
271 #define MOUSE_BUTTON_ID 1
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
272 #define MOUSE_MOVE_ID 2
43472
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
273 #define MENU_FREE_ID 3
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
274 /* 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
275 is received. */
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
276 #define MENU_FREE_DELAY 1000
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
277 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
278
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
279 /* 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
280
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
281 extern Lisp_Object Vwindow_system_version;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
282
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
283 #ifdef GLYPH_DEBUG
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
284 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
285 #endif
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
286
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
287
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
288 /* From w32term.c. */
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
289 extern int w32_num_mouse_buttons;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
290 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
291
40385
b3dbd98f9b97 (w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents: 40120
diff changeset
292 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
293
40385
b3dbd98f9b97 (w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents: 40120
diff changeset
294 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
295 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
296 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
297 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
298
42918
9b06036a8c5e (syms_of_w32fns): Initialize w32_visible_system_caret_hwnd.
Jason Rumney <jasonr@gnu.org>
parents: 42865
diff changeset
299 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
300
76075
25965473846d (current_popup_menu): Use from w32menu.c.
Jason Rumney <jasonr@gnu.org>
parents: 75348
diff changeset
301 /* From w32menu.c */
25965473846d (current_popup_menu): Use from w32menu.c.
Jason Rumney <jasonr@gnu.org>
parents: 75348
diff changeset
302 extern HMENU current_popup_menu;
76083
5e1d8f9b52ea * w32fns.c (menubar_in_use): New flag.
Jason Rumney <jasonr@gnu.org>
parents: 76078
diff changeset
303 static int menubar_in_use = 0;
76075
25965473846d (current_popup_menu): Use from w32menu.c.
Jason Rumney <jasonr@gnu.org>
parents: 75348
diff changeset
304
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
305
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
306 /* 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
307 void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
308 check_w32 ()
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
309 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
310 if (! w32_in_use)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
311 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
312 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
313
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
314 /* Nonzero if we can use mouse menus.
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
315 You should not call this unless HAVE_MENUS is defined. */
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
316
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
317 int
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
318 have_menus_p ()
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
319 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
320 return w32_in_use;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
321 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
322
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
323 /* 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
324 and checking validity for W32. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
325
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
326 FRAME_PTR
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
327 check_x_frame (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
328 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
329 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
330 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
331
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
332 if (NILP (frame))
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
333 frame = selected_frame;
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
334 CHECK_LIVE_FRAME (frame);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
335 f = XFRAME (frame);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
336 if (! FRAME_W32_P (f))
63704
426ba3ecedd7 (check_x_frame, check_x_display_info): Follow error conventions.
Juanma Barranquero <lekktu@gmail.com>
parents: 63348
diff changeset
337 error ("Non-W32 frame used");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
338 return f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
339 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
340
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
341 /* Let the user specify a display with a frame.
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
342 nil stands for the selected frame--or, if that is not a w32 frame,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
343 the first display on the list. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
344
50362
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
345 struct w32_display_info *
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
346 check_x_display_info (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
347 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
348 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
349 if (NILP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
350 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
351 struct frame *sf = XFRAME (selected_frame);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
352
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
353 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
354 return FRAME_W32_DISPLAY_INFO (sf);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
355 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
356 return &one_w32_display_info;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
357 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
358 else if (STRINGP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
359 return x_display_info_for_name (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
360 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
361 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
362 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
363
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
364 CHECK_LIVE_FRAME (frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
365 f = XFRAME (frame);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
366 if (! FRAME_W32_P (f))
63704
426ba3ecedd7 (check_x_frame, check_x_display_info): Follow error conventions.
Juanma Barranquero <lekktu@gmail.com>
parents: 63348
diff changeset
367 error ("Non-W32 frame used");
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
368 return FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
369 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
370 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
371
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
372 /* Return the Emacs frame-object corresponding to an w32 window.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
373 It could be the frame's main window or an icon window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
374
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
375 /* This function can be called during GC, so use GC_xxx type test macros. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
376
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
377 struct frame *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
378 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
379 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
380 HWND wdesc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
381 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
382 Lisp_Object tail, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
383 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
384
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
385 for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
386 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
387 frame = XCAR (tail);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
388 if (!GC_FRAMEP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
389 continue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
390 f = XFRAME (frame);
26729
f5dded41adcc Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents: 25646
diff changeset
391 if (!FRAME_W32_P (f) || FRAME_W32_DISPLAY_INFO (f) != dpyinfo)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
392 continue;
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
393 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
394 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
395
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
396 if (FRAME_W32_WINDOW (f) == wdesc)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
397 return f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
398 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
399 return 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
400 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
401
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
402
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
403 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
404 static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object));
64662
605f42af1c34 (my_set_window_pos, my_show_window): Don't declare.
Juanma Barranquero <lekktu@gmail.com>
parents: 64487
diff changeset
405 static void my_create_window P_ ((struct frame *));
605f42af1c34 (my_set_window_pos, my_show_window): Don't declare.
Juanma Barranquero <lekktu@gmail.com>
parents: 64487
diff changeset
406 static void my_create_tip_window P_ ((struct frame *));
50362
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
407
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
408 /* 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
409 void x_set_foreground_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
410 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
411 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
412 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
413 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
414 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
415 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
416 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
417 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
418 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
419 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
420 void x_set_tool_bar_lines 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
421 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
422 Lisp_Object));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
423
50362
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
424
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
425
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
426
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
427 /* Store the screen positions of frame F into XPTR and YPTR.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
428 These are the positions of the containing window manager window,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
429 not Emacs's own window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
430
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
431 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
432 x_real_positions (f, xptr, yptr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
433 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
434 int *xptr, *yptr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
435 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
436 POINT pt;
43398
8782b8cfed62 *** empty log message ***
Jason Rumney <jasonr@gnu.org>
parents: 43210
diff changeset
437 RECT rect;
8782b8cfed62 *** empty log message ***
Jason Rumney <jasonr@gnu.org>
parents: 43210
diff changeset
438
78212
87b807b2d9b1 (x_real_positions): Get real position from OS instead of calculating it.
Jason Rumney <jasonr@gnu.org>
parents: 78106
diff changeset
439 /* Get the bounds of the WM window. */
87b807b2d9b1 (x_real_positions): Get real position from OS instead of calculating it.
Jason Rumney <jasonr@gnu.org>
parents: 78106
diff changeset
440 GetWindowRect (FRAME_W32_WINDOW (f), &rect);
87b807b2d9b1 (x_real_positions): Get real position from OS instead of calculating it.
Jason Rumney <jasonr@gnu.org>
parents: 78106
diff changeset
441
87b807b2d9b1 (x_real_positions): Get real position from OS instead of calculating it.
Jason Rumney <jasonr@gnu.org>
parents: 78106
diff changeset
442 pt.x = 0;
87b807b2d9b1 (x_real_positions): Get real position from OS instead of calculating it.
Jason Rumney <jasonr@gnu.org>
parents: 78106
diff changeset
443 pt.y = 0;
87b807b2d9b1 (x_real_positions): Get real position from OS instead of calculating it.
Jason Rumney <jasonr@gnu.org>
parents: 78106
diff changeset
444
87b807b2d9b1 (x_real_positions): Get real position from OS instead of calculating it.
Jason Rumney <jasonr@gnu.org>
parents: 78106
diff changeset
445 /* Convert (0, 0) in the client area to screen co-ordinates. */
87b807b2d9b1 (x_real_positions): Get real position from OS instead of calculating it.
Jason Rumney <jasonr@gnu.org>
parents: 78106
diff changeset
446 ClientToScreen (FRAME_W32_WINDOW (f), &pt);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
447
43398
8782b8cfed62 *** empty log message ***
Jason Rumney <jasonr@gnu.org>
parents: 43210
diff changeset
448 /* Remember x_pixels_diff and y_pixels_diff. */
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
449 f->x_pixels_diff = pt.x - rect.left;
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
450 f->y_pixels_diff = pt.y - rect.top;
43398
8782b8cfed62 *** empty log message ***
Jason Rumney <jasonr@gnu.org>
parents: 43210
diff changeset
451
78212
87b807b2d9b1 (x_real_positions): Get real position from OS instead of calculating it.
Jason Rumney <jasonr@gnu.org>
parents: 78106
diff changeset
452 *xptr = rect.left;
87b807b2d9b1 (x_real_positions): Get real position from OS instead of calculating it.
Jason Rumney <jasonr@gnu.org>
parents: 78106
diff changeset
453 *yptr = rect.top;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
454 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
455
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
456
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
457
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
458 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
459 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
460 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
461 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
462 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
463 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
464 (red, green, blue, name)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
465 Lisp_Object red, green, blue, name;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
466 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
467 Lisp_Object rgb;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
468 Lisp_Object oldrgb = Qnil;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
469 Lisp_Object entry;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
470
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
471 CHECK_NUMBER (red);
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
472 CHECK_NUMBER (green);
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
473 CHECK_NUMBER (blue);
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
474 CHECK_STRING (name);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
475
55592
9d97dbb17b3f (Fw32_define_rgb_color): Avoid XSET.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 55492
diff changeset
476 XSETINT (rgb, RGB(XUINT (red), XUINT (green), XUINT (blue)));
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
477
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
478 BLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
479
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
480 /* 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
481 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
482 if (NILP (entry))
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
483 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
484 entry = Fcons (name, rgb);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
485 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
486 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
487 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
488 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
489 oldrgb = Fcdr (entry);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
490 Fsetcdr (entry, rgb);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
491 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
492
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
493 UNBLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
494
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
495 return (oldrgb);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
496 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
497
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
498 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
499 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
500 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
501 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
502
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
503 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
504 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
505 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
506 (filename)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
507 Lisp_Object filename;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
508 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
509 FILE *fp;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
510 Lisp_Object cmap = Qnil;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
511 Lisp_Object abspath;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
512
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
513 CHECK_STRING (filename);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
514 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
515
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
516 fp = fopen (SDATA (filename), "rt");
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
517 if (fp)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
518 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
519 char buf[512];
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
520 int red, green, blue;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
521 int num;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
522
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
523 BLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
524
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
525 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
526 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
527 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
528 char *name = buf + num;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
529 num = strlen (name) - 1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
530 if (name[num] == '\n')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
531 name[num] = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
532 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
533 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
534 cmap);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
535 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
536 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
537 fclose (fp);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
538
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
539 UNBLOCK_INPUT;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
540 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
541
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
542 return cmap;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
543 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
544
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
545 /* The default colors for the w32 color map */
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
546 typedef struct colormap_t
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
547 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
548 char *name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
549 COLORREF colorref;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
550 } colormap_t;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
551
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
552 colormap_t w32_color_map[] =
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
553 {
14983
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
554 {"snow" , PALETTERGB (255,250,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
555 {"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
556 {"GhostWhite" , PALETTERGB (248,248,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
557 {"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
558 {"WhiteSmoke" , PALETTERGB (245,245,245)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
559 {"gainsboro" , PALETTERGB (220,220,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
560 {"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
561 {"FloralWhite" , PALETTERGB (255,250,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
562 {"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
563 {"OldLace" , PALETTERGB (253,245,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
564 {"linen" , PALETTERGB (250,240,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
565 {"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
566 {"AntiqueWhite" , PALETTERGB (250,235,215)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
567 {"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
568 {"PapayaWhip" , PALETTERGB (255,239,213)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
569 {"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
570 {"BlanchedAlmond" , PALETTERGB (255,235,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
571 {"bisque" , PALETTERGB (255,228,196)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
572 {"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
573 {"PeachPuff" , PALETTERGB (255,218,185)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
574 {"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
575 {"NavajoWhite" , PALETTERGB (255,222,173)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
576 {"moccasin" , PALETTERGB (255,228,181)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
577 {"cornsilk" , PALETTERGB (255,248,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
578 {"ivory" , PALETTERGB (255,255,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
579 {"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
580 {"LemonChiffon" , PALETTERGB (255,250,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
581 {"seashell" , PALETTERGB (255,245,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
582 {"honeydew" , PALETTERGB (240,255,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
583 {"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
584 {"MintCream" , PALETTERGB (245,255,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
585 {"azure" , PALETTERGB (240,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
586 {"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
587 {"AliceBlue" , PALETTERGB (240,248,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
588 {"lavender" , PALETTERGB (230,230,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
589 {"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
590 {"LavenderBlush" , PALETTERGB (255,240,245)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
591 {"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
592 {"MistyRose" , PALETTERGB (255,228,225)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
593 {"white" , PALETTERGB (255,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
594 {"black" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
595 {"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
596 {"DarkSlateGray" , PALETTERGB ( 47, 79, 79)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
597 {"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
598 {"DarkSlateGrey" , PALETTERGB ( 47, 79, 79)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
599 {"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
600 {"DimGray" , PALETTERGB (105,105,105)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
601 {"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
602 {"DimGrey" , PALETTERGB (105,105,105)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
603 {"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
604 {"SlateGray" , PALETTERGB (112,128,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
605 {"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
606 {"SlateGrey" , PALETTERGB (112,128,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
607 {"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
608 {"LightSlateGray" , PALETTERGB (119,136,153)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
609 {"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
610 {"LightSlateGrey" , PALETTERGB (119,136,153)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
611 {"gray" , PALETTERGB (190,190,190)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
612 {"grey" , PALETTERGB (190,190,190)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
613 {"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
614 {"LightGrey" , PALETTERGB (211,211,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
615 {"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
616 {"LightGray" , PALETTERGB (211,211,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
617 {"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
618 {"MidnightBlue" , PALETTERGB ( 25, 25,112)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
619 {"navy" , PALETTERGB ( 0, 0,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
620 {"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
621 {"NavyBlue" , PALETTERGB ( 0, 0,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
622 {"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
623 {"CornflowerBlue" , PALETTERGB (100,149,237)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
624 {"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
625 {"DarkSlateBlue" , PALETTERGB ( 72, 61,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
626 {"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
627 {"SlateBlue" , PALETTERGB (106, 90,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
628 {"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
629 {"MediumSlateBlue" , PALETTERGB (123,104,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
630 {"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
631 {"LightSlateBlue" , PALETTERGB (132,112,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
632 {"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
633 {"MediumBlue" , PALETTERGB ( 0, 0,205)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
634 {"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
635 {"RoyalBlue" , PALETTERGB ( 65,105,225)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
636 {"blue" , PALETTERGB ( 0, 0,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
637 {"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
638 {"DodgerBlue" , PALETTERGB ( 30,144,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
639 {"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
640 {"DeepSkyBlue" , PALETTERGB ( 0,191,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
641 {"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
642 {"SkyBlue" , PALETTERGB (135,206,235)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
643 {"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
644 {"LightSkyBlue" , PALETTERGB (135,206,250)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
645 {"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
646 {"SteelBlue" , PALETTERGB ( 70,130,180)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
647 {"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
648 {"LightSteelBlue" , PALETTERGB (176,196,222)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
649 {"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
650 {"LightBlue" , PALETTERGB (173,216,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
651 {"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
652 {"PowderBlue" , PALETTERGB (176,224,230)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
653 {"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
654 {"PaleTurquoise" , PALETTERGB (175,238,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
655 {"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
656 {"DarkTurquoise" , PALETTERGB ( 0,206,209)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
657 {"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
658 {"MediumTurquoise" , PALETTERGB ( 72,209,204)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
659 {"turquoise" , PALETTERGB ( 64,224,208)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
660 {"cyan" , PALETTERGB ( 0,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
661 {"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
662 {"LightCyan" , PALETTERGB (224,255,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
663 {"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
664 {"CadetBlue" , PALETTERGB ( 95,158,160)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
665 {"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
666 {"MediumAquamarine" , PALETTERGB (102,205,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
667 {"aquamarine" , PALETTERGB (127,255,212)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
668 {"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
669 {"DarkGreen" , PALETTERGB ( 0,100, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
670 {"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
671 {"DarkOliveGreen" , PALETTERGB ( 85,107, 47)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
672 {"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
673 {"DarkSeaGreen" , PALETTERGB (143,188,143)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
674 {"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
675 {"SeaGreen" , PALETTERGB ( 46,139, 87)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
676 {"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
677 {"MediumSeaGreen" , PALETTERGB ( 60,179,113)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
678 {"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
679 {"LightSeaGreen" , PALETTERGB ( 32,178,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
680 {"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
681 {"PaleGreen" , PALETTERGB (152,251,152)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
682 {"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
683 {"SpringGreen" , PALETTERGB ( 0,255,127)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
684 {"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
685 {"LawnGreen" , PALETTERGB (124,252, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
686 {"green" , PALETTERGB ( 0,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
687 {"chartreuse" , PALETTERGB (127,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
688 {"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
689 {"MediumSpringGreen" , PALETTERGB ( 0,250,154)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
690 {"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
691 {"GreenYellow" , PALETTERGB (173,255, 47)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
692 {"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
693 {"LimeGreen" , PALETTERGB ( 50,205, 50)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
694 {"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
695 {"YellowGreen" , PALETTERGB (154,205, 50)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
696 {"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
697 {"ForestGreen" , PALETTERGB ( 34,139, 34)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
698 {"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
699 {"OliveDrab" , PALETTERGB (107,142, 35)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
700 {"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
701 {"DarkKhaki" , PALETTERGB (189,183,107)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
702 {"khaki" , PALETTERGB (240,230,140)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
703 {"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
704 {"PaleGoldenrod" , PALETTERGB (238,232,170)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
705 {"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
706 {"LightGoldenrodYellow" , PALETTERGB (250,250,210)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
707 {"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
708 {"LightYellow" , PALETTERGB (255,255,224)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
709 {"yellow" , PALETTERGB (255,255, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
710 {"gold" , PALETTERGB (255,215, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
711 {"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
712 {"LightGoldenrod" , PALETTERGB (238,221,130)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
713 {"goldenrod" , PALETTERGB (218,165, 32)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
714 {"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
715 {"DarkGoldenrod" , PALETTERGB (184,134, 11)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
716 {"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
717 {"RosyBrown" , PALETTERGB (188,143,143)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
718 {"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
719 {"IndianRed" , PALETTERGB (205, 92, 92)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
720 {"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
721 {"SaddleBrown" , PALETTERGB (139, 69, 19)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
722 {"sienna" , PALETTERGB (160, 82, 45)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
723 {"peru" , PALETTERGB (205,133, 63)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
724 {"burlywood" , PALETTERGB (222,184,135)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
725 {"beige" , PALETTERGB (245,245,220)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
726 {"wheat" , PALETTERGB (245,222,179)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
727 {"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
728 {"SandyBrown" , PALETTERGB (244,164, 96)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
729 {"tan" , PALETTERGB (210,180,140)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
730 {"chocolate" , PALETTERGB (210,105, 30)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
731 {"firebrick" , PALETTERGB (178,34, 34)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
732 {"brown" , PALETTERGB (165,42, 42)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
733 {"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
734 {"DarkSalmon" , PALETTERGB (233,150,122)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
735 {"salmon" , PALETTERGB (250,128,114)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
736 {"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
737 {"LightSalmon" , PALETTERGB (255,160,122)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
738 {"orange" , PALETTERGB (255,165, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
739 {"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
740 {"DarkOrange" , PALETTERGB (255,140, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
741 {"coral" , PALETTERGB (255,127, 80)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
742 {"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
743 {"LightCoral" , PALETTERGB (240,128,128)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
744 {"tomato" , PALETTERGB (255, 99, 71)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
745 {"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
746 {"OrangeRed" , PALETTERGB (255, 69, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
747 {"red" , PALETTERGB (255, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
748 {"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
749 {"HotPink" , PALETTERGB (255,105,180)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
750 {"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
751 {"DeepPink" , PALETTERGB (255, 20,147)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
752 {"pink" , PALETTERGB (255,192,203)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
753 {"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
754 {"LightPink" , PALETTERGB (255,182,193)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
755 {"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
756 {"PaleVioletRed" , PALETTERGB (219,112,147)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
757 {"maroon" , PALETTERGB (176, 48, 96)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
758 {"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
759 {"MediumVioletRed" , PALETTERGB (199, 21,133)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
760 {"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
761 {"VioletRed" , PALETTERGB (208, 32,144)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
762 {"magenta" , PALETTERGB (255, 0,255)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
763 {"violet" , PALETTERGB (238,130,238)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
764 {"plum" , PALETTERGB (221,160,221)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
765 {"orchid" , PALETTERGB (218,112,214)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
766 {"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
767 {"MediumOrchid" , PALETTERGB (186, 85,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
768 {"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
769 {"DarkOrchid" , PALETTERGB (153, 50,204)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
770 {"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
771 {"DarkViolet" , PALETTERGB (148, 0,211)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
772 {"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
773 {"BlueViolet" , PALETTERGB (138, 43,226)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
774 {"purple" , PALETTERGB (160, 32,240)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
775 {"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
776 {"MediumPurple" , PALETTERGB (147,112,219)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
777 {"thistle" , PALETTERGB (216,191,216)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
778 {"gray0" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
779 {"grey0" , PALETTERGB ( 0, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
780 {"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
781 {"DarkGrey" , PALETTERGB (169,169,169)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
782 {"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
783 {"DarkGray" , PALETTERGB (169,169,169)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
784 {"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
785 {"DarkBlue" , PALETTERGB ( 0, 0,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
786 {"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
787 {"DarkCyan" , PALETTERGB ( 0,139,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
788 {"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
789 {"DarkMagenta" , PALETTERGB (139, 0,139)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
790 {"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
791 {"DarkRed" , PALETTERGB (139, 0, 0)},
88b23d545848 (win32_color_map): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14810
diff changeset
792 {"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
793 {"LightGreen" , PALETTERGB (144,238,144)},
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
794 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
795
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
796 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
797 0, 0, 0, doc: /* Return the default color map. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
798 ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
799 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
800 int i;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
801 colormap_t *pc = w32_color_map;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
802 Lisp_Object cmap;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
803
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
804 BLOCK_INPUT;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
805
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
806 cmap = Qnil;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
807
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
808 for (i = 0; i < sizeof (w32_color_map) / sizeof (w32_color_map[0]);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
809 pc++, i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
810 cmap = Fcons (Fcons (build_string (pc->name),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
811 make_number (pc->colorref)),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
812 cmap);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
813
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
814 UNBLOCK_INPUT;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
815
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
816 return (cmap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
817 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
818
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
819 Lisp_Object
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
820 w32_to_x_color (rgb)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
821 Lisp_Object rgb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
822 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
823 Lisp_Object color;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
824
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
825 CHECK_NUMBER (rgb);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
826
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
827 BLOCK_INPUT;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
828
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
829 color = Frassq (rgb, Vw32_color_map);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
830
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
831 UNBLOCK_INPUT;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
832
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
833 if (!NILP (color))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
834 return (Fcar (color));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
835 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
836 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
837 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
838
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
839 static Lisp_Object
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
840 w32_color_map_lookup (colorname)
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
841 char *colorname;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
842 {
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
843 Lisp_Object tail, ret = Qnil;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
844
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
845 BLOCK_INPUT;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
846
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
847 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
848 {
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
849 register Lisp_Object elt, tem;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
850
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
851 elt = Fcar (tail);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
852 if (!CONSP (elt)) continue;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
853
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
854 tem = Fcar (elt);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
855
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
856 if (lstrcmpi (SDATA (tem), colorname) == 0)
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
857 {
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
858 ret = Fcdr (elt);
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
859 break;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
860 }
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
861
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
862 QUIT;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
863 }
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
864
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
865
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
866 UNBLOCK_INPUT;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
867
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
868 return ret;
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
869 }
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
870
51474
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
871
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
872 static void
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
873 add_system_logical_colors_to_map (system_colors)
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
874 Lisp_Object *system_colors;
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
875 {
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
876 HKEY colors_key;
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
877
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
878 /* Other registry operations are done with input blocked. */
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
879 BLOCK_INPUT;
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
880
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
881 /* Look for "Control Panel/Colors" under User and Machine registry
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
882 settings. */
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
883 if (RegOpenKeyEx (HKEY_CURRENT_USER, "Control Panel\\Colors", 0,
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
884 KEY_READ, &colors_key) == ERROR_SUCCESS
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
885 || RegOpenKeyEx (HKEY_LOCAL_MACHINE, "Control Panel\\Colors", 0,
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
886 KEY_READ, &colors_key) == ERROR_SUCCESS)
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
887 {
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
888 /* List all keys. */
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
889 char color_buffer[64];
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
890 char full_name_buffer[MAX_PATH + SYSTEM_COLOR_PREFIX_LEN];
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
891 int index = 0;
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
892 DWORD name_size, color_size;
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
893 char *name_buffer = full_name_buffer + SYSTEM_COLOR_PREFIX_LEN;
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
894
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
895 name_size = sizeof (full_name_buffer) - SYSTEM_COLOR_PREFIX_LEN;
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
896 color_size = sizeof (color_buffer);
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
897
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
898 strcpy (full_name_buffer, SYSTEM_COLOR_PREFIX);
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
899
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
900 while (RegEnumValueA (colors_key, index, name_buffer, &name_size,
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
901 NULL, NULL, color_buffer, &color_size)
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
902 == ERROR_SUCCESS)
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
903 {
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
904 int r, g, b;
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
905 if (sscanf (color_buffer, " %u %u %u", &r, &g, &b) == 3)
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
906 *system_colors = Fcons (Fcons (build_string (full_name_buffer),
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
907 make_number (RGB (r, g, b))),
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
908 *system_colors);
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
909
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
910 name_size = sizeof (full_name_buffer) - SYSTEM_COLOR_PREFIX_LEN;
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
911 color_size = sizeof (color_buffer);
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
912 index++;
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
913 }
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
914 RegCloseKey (colors_key);
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
915 }
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
916
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
917 UNBLOCK_INPUT;
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
918 }
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
919
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
920
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
921 static Lisp_Object
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
922 x_to_w32_color (colorname)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
923 char * colorname;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
924 {
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
925 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
926
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
927 BLOCK_INPUT;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
928
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
929 if (colorname[0] == '#')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
930 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
931 /* 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
932 char *color;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
933 int size;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
934 color = colorname + 1;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
935
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
936 size = strlen(color);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
937 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
938 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
939 UINT colorval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
940 int i, pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
941 pos = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
942 size /= 3;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
943 colorval = 0;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
944
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
945 for (i = 0; i < 3; i++)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
946 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
947 char *end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
948 char t;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
949 unsigned long value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
950
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
951 /* 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
952 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
953 our numbers, and we don't. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
954 if (!isxdigit(color[0]) || color[1] == 'x')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
955 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
956 t = color[size];
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
957 color[size] = '\0';
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
958 value = strtoul(color, &end, 16);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
959 color[size] = t;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
960 if (errno == ERANGE || end - color != size)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
961 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
962 switch (size)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
963 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
964 case 1:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
965 value = value * 0x10;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
966 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
967 case 2:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
968 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
969 case 3:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
970 value /= 0x10;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
971 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
972 case 4:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
973 value /= 0x100;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
974 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
975 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
976 colorval |= (value << pos);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
977 pos += 0x8;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
978 if (i == 2)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
979 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
980 UNBLOCK_INPUT;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
981 XSETINT (ret, colorval);
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
982 return ret;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
983 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
984 color = end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
985 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
986 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
987 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
988 else if (strnicmp(colorname, "rgb:", 4) == 0)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
989 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
990 char *color;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
991 UINT colorval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
992 int i, pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
993 pos = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
994
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
995 colorval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
996 color = colorname + 4;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
997 for (i = 0; i < 3; i++)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
998 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
999 char *end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1000 unsigned long value;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1001
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1002 /* 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
1003 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
1004 our numbers, and we don't. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1005 if (!isxdigit(color[0]) || color[1] == 'x')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1006 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1007 value = strtoul(color, &end, 16);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1008 if (errno == ERANGE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1009 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1010 switch (end - color)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1011 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1012 case 1:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1013 value = value * 0x10 + value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1014 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1015 case 2:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1016 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1017 case 3:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1018 value /= 0x10;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1019 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1020 case 4:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1021 value /= 0x100;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1022 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1023 default:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1024 value = ULONG_MAX;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1025 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1026 if (value == ULONG_MAX)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1027 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1028 colorval |= (value << pos);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1029 pos += 0x8;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1030 if (i == 2)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1031 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1032 if (*end != '\0')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1033 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1034 UNBLOCK_INPUT;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
1035 XSETINT (ret, colorval);
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
1036 return ret;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1037 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1038 if (*end != '/')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1039 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1040 color = end + 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1041 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1042 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1043 else if (strnicmp(colorname, "rgbi:", 5) == 0)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1044 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1045 /* This is an RGB Intensity specification. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1046 char *color;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1047 UINT colorval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1048 int i, pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1049 pos = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1050
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1051 colorval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1052 color = colorname + 5;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1053 for (i = 0; i < 3; i++)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1054 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1055 char *end;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1056 double value;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1057 UINT val;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1058
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1059 value = strtod(color, &end);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1060 if (errno == ERANGE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1061 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1062 if (value < 0.0 || value > 1.0)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1063 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1064 val = (UINT)(0x100 * value);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1065 /* We used 0x100 instead of 0xFF to give a continuous
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1066 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
1067 fixes the 1.0 case. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1068 if (val == 0x100)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1069 val = 0xFF;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1070 colorval |= (val << pos);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1071 pos += 0x8;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1072 if (i == 2)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1073 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1074 if (*end != '\0')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1075 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1076 UNBLOCK_INPUT;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
1077 XSETINT (ret, colorval);
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
1078 return ret;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1079 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1080 if (*end != '/')
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1081 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1082 color = end + 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1083 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1084 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1085 /* 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
1086 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
1087 RGB. */
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1088
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1089 /* If we fail to lookup the color name in w32_color_map, then check the
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1090 colorname to see if it can be crudely approximated: If the X color
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1091 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
1092 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
1093 ret = w32_color_map_lookup (colorname);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1094 if (NILP (ret))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1095 {
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1096 int len = strlen (colorname);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1097
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1098 if (isdigit (colorname[len - 1]))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1099 {
39548
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
1100 char *ptr, *approx = alloca (len + 1);
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1101
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1102 strcpy (approx, colorname);
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1103 ptr = &approx[len - 1];
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1104 while (ptr > approx && isdigit (*ptr))
23314
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1105 *ptr-- = '\0';
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1106
87acd2b6ce97 (w32_color_map_lookup): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23160
diff changeset
1107 ret = w32_color_map_lookup (approx);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1108 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1109 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1110
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1111 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1112 return ret;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1113 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1114
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1115 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1116 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
1117 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1118 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
1119 LOGPALETTE * log_palette;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1120 HPALETTE new_palette;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1121 int i;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1122
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1123 /* 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
1124 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
1125 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1126
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1127 log_palette = (LOGPALETTE *)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1128 alloca (sizeof (LOGPALETTE) +
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1129 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
1130 log_palette->palVersion = 0x300;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1131 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
1132
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1133 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
1134 for (i = 0;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1135 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
1136 i++, list = list->next)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1137 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
1138
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1139 new_palette = CreatePalette (log_palette);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1140
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1141 enter_crit ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1142
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1143 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
1144 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
1145 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
1146
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1147 /* 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
1148 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
1149
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1150 leave_crit ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1151 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1152
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1153 #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
1154 #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
1155 do \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1156 { \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1157 pe.peRed = GetRValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1158 pe.peGreen = GetGValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1159 pe.peBlue = GetBValue (color); \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1160 pe.peFlags = 0; \
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1161 } while (0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1162
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1163 #if 0
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1164 /* 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
1165 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1166 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
1167 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1168 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
1169
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1170 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
1171 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1172
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1173 /* 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
1174 while (list)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1175 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1176 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
1177 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1178 ++list->refcount;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1179 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1180 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1181 list = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1182 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1183
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1184 /* 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
1185 list = (struct w32_palette_entry *)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1186 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
1187 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
1188 list->refcount = 1;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1189 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
1190 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
1191 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
1192
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1193 /* 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
1194 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
1195 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1196
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1197 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1198 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
1199 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1200 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
1201 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
1202
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1203 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
1204 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1205
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1206 /* 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
1207 while (list)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1208 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1209 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
1210 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1211 if (--list->refcount == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1212 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1213 *prev = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1214 xfree (list);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1215 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
1216 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1217 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1218 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1219 return;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1220 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1221 prev = &list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1222 list = list->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1223 }
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 /* 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
1226 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
1227 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1228 #endif
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1229
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1230
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1231 /* Gamma-correct COLOR on frame F. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1232
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1233 void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1234 gamma_correct (f, color)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1235 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1236 COLORREF *color;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1237 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1238 if (f->gamma)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1239 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1240 *color = PALETTERGB (
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1241 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
1242 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
1243 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
1244 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1245 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1246
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1247
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1248 /* Decide if color named COLOR is valid for the display associated with
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1249 the selected frame; if so, return the rgb values in COLOR_DEF.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1250 If ALLOC is nonzero, allocate a new colormap cell. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1251
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1252 int
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1253 w32_defined_color (f, color, color_def, alloc)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1254 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1255 char *color;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1256 XColor *color_def;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1257 int alloc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1258 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1259 register Lisp_Object tem;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1260 COLORREF w32_color_ref;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1261
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1262 tem = x_to_w32_color (color);
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1263
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1264 if (!NILP (tem))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1265 {
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1266 if (f)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1267 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1268 /* Apply gamma correction. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1269 w32_color_ref = XUINT (tem);
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1270 gamma_correct (f, &w32_color_ref);
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1271 XSETINT (tem, w32_color_ref);
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1272 }
27407
7df920562cbe (w32_defined_color): Apply gamma correction before trying to map to
Jason Rumney <jasonr@gnu.org>
parents: 27397
diff changeset
1273
7df920562cbe (w32_defined_color): Apply gamma correction before trying to map to
Jason Rumney <jasonr@gnu.org>
parents: 27397
diff changeset
1274 /* 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
1275 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
1276 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1277 struct w32_palette_entry * entry =
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1278 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
1279 struct w32_palette_entry ** prev =
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1280 &one_w32_display_info.color_list;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1281
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1282 /* 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
1283 while (entry)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1284 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1285 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
1286 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1287 prev = &entry->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1288 entry = entry->next;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1289 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1290
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1291 if (entry == NULL && alloc)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1292 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1293 /* 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
1294 entry = (struct w32_palette_entry *)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1295 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
1296 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
1297 entry->next = NULL;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1298 *prev = entry;
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
1299 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
1300
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1301 /* 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
1302 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
1303 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1304 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1305 /* 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
1306 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
1307 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
1308 w32_color_ref = XUINT (tem) | 0x2000000;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1309
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1310 color_def->pixel = w32_color_ref;
48346
140fd0332d31 (w32_defined_color): Adjust RGB values for Emacs.
Jason Rumney <jasonr@gnu.org>
parents: 47983
diff changeset
1311 color_def->red = GetRValue (w32_color_ref) * 256;
140fd0332d31 (w32_defined_color): Adjust RGB values for Emacs.
Jason Rumney <jasonr@gnu.org>
parents: 47983
diff changeset
1312 color_def->green = GetGValue (w32_color_ref) * 256;
140fd0332d31 (w32_defined_color): Adjust RGB values for Emacs.
Jason Rumney <jasonr@gnu.org>
parents: 47983
diff changeset
1313 color_def->blue = GetBValue (w32_color_ref) * 256;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1314
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1315 return 1;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
1316 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1317 else
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1318 {
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1319 return 0;
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
1320 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1321 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1322
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1323 /* Given a string ARG naming a color, compute a pixel value from it
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1324 suitable for screen F.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1325 If F is not a color screen, return DEF (default) regardless of what
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1326 ARG says. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1327
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1328 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1329 x_decode_color (f, arg, def)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1330 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1331 Lisp_Object arg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1332 int def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1333 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1334 XColor cdef;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1335
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
1336 CHECK_STRING (arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1337
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
1338 if (strcmp (SDATA (arg), "black") == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1339 return BLACK_PIX_DEFAULT (f);
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
1340 else if (strcmp (SDATA (arg), "white") == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1341 return WHITE_PIX_DEFAULT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1342
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1343 if ((FRAME_W32_DISPLAY_INFO (f)->n_planes * FRAME_W32_DISPLAY_INFO (f)->n_cbits) == 1)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1344 return def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1345
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1346 /* w32_defined_color is responsible for coping with failures
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1347 by looking for a near-miss. */
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
1348 if (w32_defined_color (f, SDATA (arg), &cdef, 1))
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1349 return cdef.pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1350
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1351 /* defined_color failed; return an ultimate default. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1352 return def;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1353 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1354
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1355
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1356
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1357 /* Functions called only from `x_set_frame_param'
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1358 to set individual parameters.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1359
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1360 If FRAME_W32_WINDOW (f) is 0,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1361 the frame is being created and its window does not exist yet.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1362 In that case, just record the parameter's new value
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1363 in the standard place; do not attempt to change the window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1364
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1365 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1366 x_set_foreground_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1367 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1368 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1369 {
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
1370 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
1371 PIX_TYPE fg, old_fg;
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
1372
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
1373 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
1374 old_fg = FRAME_FOREGROUND_PIXEL (f);
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
1375 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
1376
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1377 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1378 {
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
1379 if (x->cursor_pixel == old_fg)
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
1380 x->cursor_pixel = fg;
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
1381
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1382 update_face_from_frame_parameter (f, Qforeground_color, arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1383 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1384 redraw_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1385 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1386 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1387
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1388 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1389 x_set_background_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1390 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1391 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1392 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1393 FRAME_BACKGROUND_PIXEL (f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1394 = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1395
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1396 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1397 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1398 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
1399 FRAME_BACKGROUND_PIXEL (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1400
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1401 update_face_from_frame_parameter (f, Qbackground_color, arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1402
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1403 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1404 redraw_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1405 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1406 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1407
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1408 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1409 x_set_mouse_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1410 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1411 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1412 {
50229
e3a41ffa1cba Remove setup of cross_cursor (already has hand_cursor).
Kim F. Storm <storm@cua.dk>
parents: 50164
diff changeset
1413 Cursor cursor, nontext_cursor, mode_cursor, hand_cursor;
17632
d2915156a803 (x_set_mouse_color): Update calls to x_catch_errors
Richard M. Stallman <rms@gnu.org>
parents: 16884
diff changeset
1414 int count;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1415 int mask_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1416
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1417 if (!EQ (Qnil, arg))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1418 f->output_data.w32->mouse_pixel
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1419 = 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
1420 mask_color = FRAME_BACKGROUND_PIXEL (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1421
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1422 /* 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
1423 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
1424 && mask_color == FRAME_BACKGROUND_PIXEL (f))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1425 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
1426
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
1427 #if 0 /* TODO : cursor changes */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1428 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1429
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1430 /* 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
1431 count = x_catch_errors (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1432
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1433 if (!EQ (Qnil, Vx_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1434 {
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
1435 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
1436 cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XINT (Vx_pointer_shape));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1437 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1438 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1439 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
1440 x_check_errors (FRAME_W32_DISPLAY (f), "bad text pointer cursor: %s");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1441
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1442 if (!EQ (Qnil, Vx_nontext_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1443 {
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
1444 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
1445 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1446 XINT (Vx_nontext_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1447 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1448 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1449 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
1450 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1451
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
1452 if (!EQ (Qnil, Vx_hourglass_pointer_shape))
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
1453 {
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
1454 CHECK_NUMBER (Vx_hourglass_pointer_shape);
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
1455 hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
1456 XINT (Vx_hourglass_pointer_shape));
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
1457 }
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
1458 else
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
1459 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
1460 x_check_errors (FRAME_W32_DISPLAY (f), "bad busy pointer cursor: %s");
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1461
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1462 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1463 if (!EQ (Qnil, Vx_mode_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1464 {
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
1465 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
1466 mode_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1467 XINT (Vx_mode_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1468 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1469 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1470 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
1471 x_check_errors (FRAME_W32_DISPLAY (f), "bad modeline pointer cursor: %s");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1472
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1473 if (!EQ (Qnil, Vx_sensitive_text_pointer_shape))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1474 {
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
1475 CHECK_NUMBER (Vx_sensitive_text_pointer_shape);
50229
e3a41ffa1cba Remove setup of cross_cursor (already has hand_cursor).
Kim F. Storm <storm@cua.dk>
parents: 50164
diff changeset
1476 hand_cursor
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1477 = XCreateFontCursor (FRAME_W32_DISPLAY (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1478 XINT (Vx_sensitive_text_pointer_shape));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1479 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1480 else
50229
e3a41ffa1cba Remove setup of cross_cursor (already has hand_cursor).
Kim F. Storm <storm@cua.dk>
parents: 50164
diff changeset
1481 hand_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_crosshair);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1482
34133
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
1483 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
1484 {
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
1485 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
1486 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
1487 = 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
1488 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
1489 }
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
1490 else
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
1491 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
1492 = 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
1493
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1494 /* 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
1495 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
1496 x_uncatch_errors (FRAME_W32_DISPLAY (f), count);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1497
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1498 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1499 XColor fore_color, back_color;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1500
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1501 fore_color.pixel = f->output_data.w32->mouse_pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1502 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
1503 XQueryColor (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1504 DefaultColormap (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1505 DefaultScreen (FRAME_W32_DISPLAY (f))),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1506 &fore_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1507 XQueryColor (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1508 DefaultColormap (FRAME_W32_DISPLAY (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1509 DefaultScreen (FRAME_W32_DISPLAY (f))),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1510 &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1511 XRecolorCursor (FRAME_W32_DISPLAY (f), cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1512 &fore_color, &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1513 XRecolorCursor (FRAME_W32_DISPLAY (f), nontext_cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1514 &fore_color, &back_color);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1515 XRecolorCursor (FRAME_W32_DISPLAY (f), mode_cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1516 &fore_color, &back_color);
50229
e3a41ffa1cba Remove setup of cross_cursor (already has hand_cursor).
Kim F. Storm <storm@cua.dk>
parents: 50164
diff changeset
1517 XRecolorCursor (FRAME_W32_DISPLAY (f), hand_cursor,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1518 &fore_color, &back_color);
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
1519 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
1520 &fore_color, &back_color);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1521 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1522
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1523 if (FRAME_W32_WINDOW (f) != 0)
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1524 XDefineCursor (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), cursor);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1525
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1526 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
1527 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
1528 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
1529
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1530 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
1531 && 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
1532 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
1533 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
1534
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
1535 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
1536 && f->output_data.w32->hourglass_cursor != 0)
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
1537 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
1538 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
1539
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1540 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
1541 && 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
1542 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
1543 f->output_data.w32->modeline_cursor = mode_cursor;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1544
50229
e3a41ffa1cba Remove setup of cross_cursor (already has hand_cursor).
Kim F. Storm <storm@cua.dk>
parents: 50164
diff changeset
1545 if (hand_cursor != f->output_data.w32->hand_cursor
e3a41ffa1cba Remove setup of cross_cursor (already has hand_cursor).
Kim F. Storm <storm@cua.dk>
parents: 50164
diff changeset
1546 && f->output_data.w32->hand_cursor != 0)
e3a41ffa1cba Remove setup of cross_cursor (already has hand_cursor).
Kim F. Storm <storm@cua.dk>
parents: 50164
diff changeset
1547 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->hand_cursor);
e3a41ffa1cba Remove setup of cross_cursor (already has hand_cursor).
Kim F. Storm <storm@cua.dk>
parents: 50164
diff changeset
1548 f->output_data.w32->hand_cursor = hand_cursor;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1549
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1550 XFlush (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1551 UNBLOCK_INPUT;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1552
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1553 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
1554 #endif /* TODO */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1555 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1556
34062
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
1557 /* Defined in w32term.c. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1558 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1559 x_set_cursor_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1560 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1561 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1562 {
34062
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
1563 unsigned long fore_pixel, pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1564
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1565 if (!NILP (Vx_cursor_fore_pixel))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1566 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
1567 WHITE_PIX_DEFAULT (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1568 else
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1569 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
1570
34089
445e01c537a3 Fix last change.
Jason Rumney <jasonr@gnu.org>
parents: 34062
diff changeset
1571 pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1572
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1573 /* 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
1574 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
1575 {
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
1576 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
1577 if (pixel == fore_pixel)
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1578 fore_pixel = FRAME_BACKGROUND_PIXEL (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1579 }
34062
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
1580
44047
73645cbc79a7 (x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents: 43963
diff changeset
1581 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
1582 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
1583
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1584 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1585 {
44094
16eb7bad861d (x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents: 44076
diff changeset
1586 BLOCK_INPUT;
16eb7bad861d (x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents: 44076
diff changeset
1587 /* Update frame's cursor_gc. */
16eb7bad861d (x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents: 44076
diff changeset
1588 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
1589 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
1590
16eb7bad861d (x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents: 44076
diff changeset
1591 UNBLOCK_INPUT;
16eb7bad861d (x_set_cursor_color): Set cursor_gc as well.
Jason Rumney <jasonr@gnu.org>
parents: 44076
diff changeset
1592
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1593 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1594 {
34062
0044985507c7 (x_set_cursor_color): Use x_update_cursor instead of x_display_cursor.
Jason Rumney <jasonr@gnu.org>
parents: 33929
diff changeset
1595 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
1596 x_update_cursor (f, 1);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1597 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1598 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1599
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1600 update_face_from_frame_parameter (f, Qcursor_color, arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1601 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1602
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1603 /* 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
1604 Note that this does not fully take effect if done before
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1605 F has a window. */
50362
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
1606
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1607 void
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1608 x_set_border_pixel (f, pix)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1609 struct frame *f;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1610 int pix;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1611 {
50362
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
1612
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1613 f->output_data.w32->border_pixel = pix;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1614
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
1615 if (FRAME_W32_WINDOW (f) != 0 && f->border_width > 0)
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1616 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1617 if (FRAME_VISIBLE_P (f))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1618 redraw_frame (f);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1619 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1620 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
1621
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1622 /* Set the border-color of frame F to value described by ARG.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1623 ARG can be a string naming a color.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1624 The border-color is used for the border that is drawn by the server.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1625 Note that this does not fully take effect if done before
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1626 F has a window; it must be redone when the window is created. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1627
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1628 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1629 x_set_border_color (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1630 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1631 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1632 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1633 int pix;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1634
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
1635 CHECK_STRING (arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1636 pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1637 x_set_border_pixel (f, pix);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1638 update_face_from_frame_parameter (f, Qborder_color, arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1639 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1640
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1641
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1642 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1643 x_set_cursor_type (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1644 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1645 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1646 {
47140
9ef4bf7492cb (Vblink_cursor_alist): Removed.
Kim F. Storm <storm@cua.dk>
parents: 47097
diff changeset
1647 set_frame_cursor_types (f, arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1648
49392
4e6b3d53732a (x_set_cursor_type): Set cursor_type_changed,
Jason Rumney <jasonr@gnu.org>
parents: 49369
diff changeset
1649 /* Make sure the cursor gets redrawn. */
49494
07f0ea120d7d (init_external_image_libraries): Try alternate names for the jpeg dll.
Juanma Barranquero <lekktu@gmail.com>
parents: 49455
diff changeset
1650 cursor_type_changed = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1651 }
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
1652
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1653 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1654 x_set_icon_type (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1655 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1656 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1657 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1658 int result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1659
25235
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
1660 if (NILP (arg) && NILP (oldval))
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
1661 return;
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
1662
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1663 if (STRINGP (arg) && STRINGP (oldval)
25235
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
1664 && 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
1665 return;
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
1666
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
1667 if (SYMBOLP (arg) && SYMBOLP (oldval) && EQ (arg, oldval))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1668 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1669
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1670 BLOCK_INPUT;
25235
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
1671
98c67187cd6b (x_set_icon_type): Support setting frame icons.
Geoff Voelker <voelker@cs.washington.edu>
parents: 25084
diff changeset
1672 result = x_bitmap_icon (f, arg);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1673 if (result)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1674 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1675 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1676 error ("No icon window available");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1677 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1678
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1679 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1680 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1681
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1682 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1683 x_set_icon_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1684 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1685 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1686 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1687 if (STRINGP (arg))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1688 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1689 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1690 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1691 }
71171
9fcdaa132bf3 (x_set_icon_name): Don't use arg if it's not a string and not nil.
Eli Zaretskii <eliz@gnu.org>
parents: 70233
diff changeset
1692 else if (!NILP (arg) || NILP (oldval))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1693 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1694
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1695 f->icon_name = arg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1696
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1697 #if 0
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1698 if (f->output_data.w32->icon_bitmap != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1699 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1700
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1701 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1702
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1703 result = x_text_icon (f,
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
1704 (char *) SDATA ((!NILP (f->icon_name)
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
1705 ? f->icon_name
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
1706 : !NILP (f->title)
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
1707 ? f->title
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
1708 : f->name)));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1709
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1710 if (result)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1711 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1712 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1713 error ("No icon window available");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1714 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1715
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1716 /* If the window was unmapped (and its icon was mapped),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1717 the new icon is not mapped, so map the window in its stead. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1718 if (FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1719 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1720 #ifdef USE_X_TOOLKIT
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1721 XtPopup (f->output_data.w32->widget, XtGrabNone);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1722 #endif
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1723 XMapWindow (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1724 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1725
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1726 XFlush (FRAME_W32_DISPLAY (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1727 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1728 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1729 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1730
33870
8816b5542315 (x_change_window_heights): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33865
diff changeset
1731
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1732 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1733 x_set_menu_bar_lines (f, value, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1734 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1735 Lisp_Object value, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1736 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1737 int nlines;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1738 int olines = FRAME_MENU_BAR_LINES (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1739
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1740 /* Right now, menu bars don't work properly in minibuf-only frames;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1741 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
1742 frame itself, and get an error because you can't switch buffers
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1743 in or split the minibuffer window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1744 if (FRAME_MINIBUF_ONLY_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1745 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1746
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1747 if (INTEGERP (value))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1748 nlines = XINT (value);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1749 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1750 nlines = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1751
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1752 FRAME_MENU_BAR_LINES (f) = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1753 if (nlines)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1754 FRAME_EXTERNAL_MENU_BAR (f) = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1755 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1756 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1757 if (FRAME_EXTERNAL_MENU_BAR (f) == 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1758 free_frame_menubar (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1759 FRAME_EXTERNAL_MENU_BAR (f) = 0;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1760
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1761 /* 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
1762 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
1763 set correctly. */
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
1764 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1765 do_pending_window_change (0);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1766 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1767 adjust_glyphs (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1768 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1769
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1770
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1771 /* 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
1772 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
1773 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
1774 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
1775 The frame's height doesn't change. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1776
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1777 void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1778 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
1779 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1780 Lisp_Object value, oldval;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1781 {
33865
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
1782 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
1783 Lisp_Object root_window;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1784
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
1785 /* Treat tool bars like menu bars. */
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
1786 if (FRAME_MINIBUF_ONLY_P (f))
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
1787 return;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
1788
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1789 /* Use VALUE only if an integer >= 0. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1790 if (INTEGERP (value) && XINT (value) >= 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1791 nlines = XFASTINT (value);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1792 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1793 nlines = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1794
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1795 /* 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
1796 ++windows_or_buffers_changed;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1797
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1798 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
1799
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
1800 /* 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
1801 root_window = FRAME_ROOT_WINDOW (f);
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
1802 root_height = WINDOW_TOTAL_LINES (XWINDOW (root_window));
33865
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
1803 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
1804 {
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
1805 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
1806 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
1807 }
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
1808
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1809 FRAME_TOOL_BAR_LINES (f) = nlines;
50362
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
1810 change_window_heights (root_window, delta);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1811 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
1812
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
1813 /* 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
1814 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
1815 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
1816 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
1817 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
1818 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
1819 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
1820 {
83571
ca1c27e2707e (x_set_tool_bar_lines): Don't use updating_frame.
Jason Rumney <jasonr@gnu.org>
parents: 76700
diff changeset
1821 clear_frame (f);
33865
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
1822 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
1823 }
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
1824
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
1825 /* 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
1826 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
1827 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
1828 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
1829 {
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
1830 int height = FRAME_INTERNAL_BORDER_WIDTH (f);
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
1831 int width = FRAME_PIXEL_WIDTH (f);
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
1832 int y = nlines * FRAME_LINE_HEIGHT (f);
33865
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
1833
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
1834 BLOCK_INPUT;
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
1835 {
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
1836 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
1837 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
1838 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
1839 }
f32333d8172b (x_set_tool_bar_lines): Clear internal border when making tool bar
Jason Rumney <jasonr@gnu.org>
parents: 33443
diff changeset
1840 UNBLOCK_INPUT;
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
1841
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
1842 if (WINDOWP (f->tool_bar_window))
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
1843 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
1844 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1845 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1846
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1847
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1848 /* 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
1849 w32_id_name.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1850
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1851 If EXPLICIT is non-zero, that indicates that lisp code is setting the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1852 name; if NAME is a string, set F's name to NAME and set
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1853 F->explicit_name; if NAME is Qnil, then clear F->explicit_name.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1854
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1855 If EXPLICIT is zero, that indicates that Emacs redisplay code is
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1856 suggesting a new name, which lisp code should override; if
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1857 F->explicit_name is set, ignore the new name; otherwise, set it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1858
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1859 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1860 x_set_name (f, name, explicit)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1861 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1862 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1863 int explicit;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1864 {
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1865 /* Make sure that requests from lisp code override requests from
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1866 Emacs redisplay code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1867 if (explicit)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1868 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1869 /* If we're switching from explicit to implicit, we had better
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1870 update the mode lines and thereby update the title. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1871 if (f->explicit_name && NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1872 update_mode_lines = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1873
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1874 f->explicit_name = ! NILP (name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1875 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1876 else if (f->explicit_name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1877 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1878
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1879 /* If NAME is nil, set the name to the w32_id_name. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1880 if (NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1881 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1882 /* Check for no change needed in this very common case
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1883 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
1884 if (!strcmp (FRAME_W32_DISPLAY_INFO (f)->w32_id_name,
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
1885 SDATA (f->name)))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1886 return;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1887 name = build_string (FRAME_W32_DISPLAY_INFO (f)->w32_id_name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1888 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1889 else
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
1890 CHECK_STRING (name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1891
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1892 /* Don't change the name if it's already NAME. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1893 if (! NILP (Fstring_equal (name, f->name)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1894 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1895
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1896 f->name = name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1897
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1898 /* 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
1899 the name parameter. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1900 if (! NILP (f->title))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1901 name = f->title;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1902
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
1903 if (FRAME_W32_WINDOW (f))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1904 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1905 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
1906 name = ENCODE_SYSTEM (name);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1907
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1908 BLOCK_INPUT;
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
1909 SetWindowText(FRAME_W32_WINDOW (f), SDATA (name));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1910 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1911 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1912 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1913
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1914 /* This function should be called when the user's lisp code has
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1915 specified a name for the frame; the name will override any set by the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1916 redisplay code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1917 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1918 x_explicitly_set_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1919 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1920 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1921 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1922 x_set_name (f, arg, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1923 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1924
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1925 /* This function should be called by Emacs redisplay code to set the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1926 name; names set this way will never override names set by the user's
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1927 lisp code. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1928 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1929 x_implicitly_set_name (f, arg, oldval)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1930 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1931 Lisp_Object arg, oldval;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1932 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1933 x_set_name (f, arg, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1934 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1935
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1936 /* 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
1937 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
1938
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1939 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
1940 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
1941 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
1942
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1943 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
1944 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
1945 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
1946
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1947 void
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1948 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
1949 struct frame *f;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1950 Lisp_Object name, old_name;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1951 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1952 /* 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
1953 if (EQ (name, f->title))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1954 return;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1955
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1956 update_mode_lines = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1957
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1958 f->title = name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1959
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1960 if (NILP (name))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1961 name = f->name;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1962
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1963 if (FRAME_W32_WINDOW (f))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1964 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1965 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
1966 name = ENCODE_SYSTEM (name);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
1967
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1968 BLOCK_INPUT;
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
1969 SetWindowText(FRAME_W32_WINDOW (f), SDATA (name));
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1970 UNBLOCK_INPUT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1971 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
1972 }
50362
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
1973
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
1974
50377
174f757a8504 (x_set_scroll_bar_default_width): Define return value as void.
Juanma Barranquero <lekktu@gmail.com>
parents: 50362
diff changeset
1975 void x_set_scroll_bar_default_width (f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1976 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1977 {
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
1978 int wid = FRAME_COLUMN_WIDTH (f);
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
1979
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
1980 FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = GetSystemMetrics (SM_CXVSCROLL);
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
1981 FRAME_CONFIG_SCROLL_BAR_COLS (f) = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) +
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
1982 wid - 1) / wid;
50362
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
1983 }
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
1984
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1985
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
1986 /* Subroutines of creating a frame. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1987
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1988
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1989 /* Return the value of parameter PARAM.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1990
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1991 First search ALIST, then Vdefault_frame_alist, then the X defaults
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1992 database, using ATTRIBUTE as the attribute name and CLASS as its class.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1993
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1994 Convert the resource to the type specified by desired_type.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1995
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1996 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
1997 w32_get_arg, make sure you deal with Qunbound in a reasonable way,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1998 and don't let it get stored in any Lisp-visible variables! */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1999
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2000 static Lisp_Object
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2001 w32_get_arg (alist, param, attribute, class, type)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2002 Lisp_Object alist, param;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2003 char *attribute;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2004 char *class;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2005 enum resource_types type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2006 {
50362
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
2007 return x_get_arg (check_x_display_info (Qnil),
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
2008 alist, param, attribute, class, type);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2009 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2010
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2011
49369
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
2012 Cursor
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
2013 w32_load_cursor (LPCTSTR name)
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
2014 {
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
2015 /* Try first to load cursor from application resource. */
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
2016 Cursor cursor = LoadImage ((HINSTANCE) GetModuleHandle(NULL),
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
2017 name, IMAGE_CURSOR, 0, 0,
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
2018 LR_DEFAULTCOLOR | LR_DEFAULTSIZE | LR_SHARED);
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
2019 if (!cursor)
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
2020 {
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
2021 /* Then try to load a shared predefined cursor. */
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
2022 cursor = LoadImage (NULL, name, IMAGE_CURSOR, 0, 0,
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
2023 LR_DEFAULTCOLOR | LR_DEFAULTSIZE | LR_SHARED);
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
2024 }
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
2025 return cursor;
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
2026 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2027
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2028 extern LRESULT CALLBACK w32_wnd_proc ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2029
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2030 BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2031 w32_init_class (hinst)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2032 HINSTANCE hinst;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2033 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2034 WNDCLASS wc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2035
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2036 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
2037 wc.lpfnWndProc = (WNDPROC) w32_wnd_proc;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2038 wc.cbClsExtra = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2039 wc.cbWndExtra = WND_EXTRA_BYTES;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2040 wc.hInstance = hinst;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2041 wc.hIcon = LoadIcon (hinst, EMACS_CLASS);
49369
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
2042 wc.hCursor = w32_load_cursor (IDC_ARROW);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
2043 wc.hbrBackground = NULL; /* GetStockObject (WHITE_BRUSH); */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2044 wc.lpszMenuName = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2045 wc.lpszClassName = EMACS_CLASS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2046
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2047 return (RegisterClass (&wc));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2048 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2049
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2050 HWND
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2051 w32_createscrollbar (f, bar)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2052 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2053 struct scroll_bar * bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2054 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2055 return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2056 /* Position and size of scroll bar. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2057 XINT(bar->left) + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2058 XINT(bar->top),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2059 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
2060 XINT(bar->height),
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2061 FRAME_W32_WINDOW (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2062 NULL,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2063 hinst,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2064 NULL));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2065 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2066
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2067 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2068 w32_createwindow (f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2069 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2070 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2071 HWND hwnd;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2072 RECT rect;
72269
b37e887392d9 (w32_createwindow): Handle -geometry command line option and the geometry
Eli Zaretskii <eliz@gnu.org>
parents: 72265
diff changeset
2073 Lisp_Object top = Qunbound;
b37e887392d9 (w32_createwindow): Handle -geometry command line option and the geometry
Eli Zaretskii <eliz@gnu.org>
parents: 72265
diff changeset
2074 Lisp_Object left = Qunbound;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2075
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2076 rect.left = rect.top = 0;
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
2077 rect.right = FRAME_PIXEL_WIDTH (f);
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
2078 rect.bottom = FRAME_PIXEL_HEIGHT (f);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2079
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2080 AdjustWindowRect (&rect, f->output_data.w32->dwStyle,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2081 FRAME_EXTERNAL_MENU_BAR (f));
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2082
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2083 /* Do first time app init */
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2084
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2085 if (!hprevinst)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2086 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2087 w32_init_class (hinst);
72269
b37e887392d9 (w32_createwindow): Handle -geometry command line option and the geometry
Eli Zaretskii <eliz@gnu.org>
parents: 72265
diff changeset
2088 }
b37e887392d9 (w32_createwindow): Handle -geometry command line option and the geometry
Eli Zaretskii <eliz@gnu.org>
parents: 72265
diff changeset
2089
73285
d1194b4c29b3 2006-10-07 Ralf Angeli <angeli@caeruleus.net>
Jason Rumney <jasonr@gnu.org>
parents: 73087
diff changeset
2090 if (f->size_hint_flags & USPosition || f->size_hint_flags & PPosition)
d1194b4c29b3 2006-10-07 Ralf Angeli <angeli@caeruleus.net>
Jason Rumney <jasonr@gnu.org>
parents: 73087
diff changeset
2091 {
d1194b4c29b3 2006-10-07 Ralf Angeli <angeli@caeruleus.net>
Jason Rumney <jasonr@gnu.org>
parents: 73087
diff changeset
2092 XSETINT (left, f->left_pos);
d1194b4c29b3 2006-10-07 Ralf Angeli <angeli@caeruleus.net>
Jason Rumney <jasonr@gnu.org>
parents: 73087
diff changeset
2093 XSETINT (top, f->top_pos);
d1194b4c29b3 2006-10-07 Ralf Angeli <angeli@caeruleus.net>
Jason Rumney <jasonr@gnu.org>
parents: 73087
diff changeset
2094 }
d1194b4c29b3 2006-10-07 Ralf Angeli <angeli@caeruleus.net>
Jason Rumney <jasonr@gnu.org>
parents: 73087
diff changeset
2095 else if (EQ (left, Qunbound) && EQ (top, Qunbound))
72269
b37e887392d9 (w32_createwindow): Handle -geometry command line option and the geometry
Eli Zaretskii <eliz@gnu.org>
parents: 72265
diff changeset
2096 {
b37e887392d9 (w32_createwindow): Handle -geometry command line option and the geometry
Eli Zaretskii <eliz@gnu.org>
parents: 72265
diff changeset
2097 /* When called with RES_TYPE_NUMBER, w32_get_arg will return zero
b37e887392d9 (w32_createwindow): Handle -geometry command line option and the geometry
Eli Zaretskii <eliz@gnu.org>
parents: 72265
diff changeset
2098 for anything that is not a number and is not Qunbound. */
b37e887392d9 (w32_createwindow): Handle -geometry command line option and the geometry
Eli Zaretskii <eliz@gnu.org>
parents: 72265
diff changeset
2099 left = w32_get_arg (Qnil, Qleft, "left", "Left", RES_TYPE_NUMBER);
b37e887392d9 (w32_createwindow): Handle -geometry command line option and the geometry
Eli Zaretskii <eliz@gnu.org>
parents: 72265
diff changeset
2100 top = w32_get_arg (Qnil, Qtop, "top", "Top", RES_TYPE_NUMBER);
b37e887392d9 (w32_createwindow): Handle -geometry command line option and the geometry
Eli Zaretskii <eliz@gnu.org>
parents: 72265
diff changeset
2101 }
72071
0bfda07cccbc (w32_createwindow): If `left' and/or `top' frame parameters are bound to some
Eli Zaretskii <eliz@gnu.org>
parents: 71545
diff changeset
2102
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2103 FRAME_W32_WINDOW (f) = hwnd
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2104 = CreateWindow (EMACS_CLASS,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2105 f->namebuf,
39137
2d2b989f4a4b (w32_createwindow): Undo last change.
Andrew Innes <andrewi@gnu.org>
parents: 39128
diff changeset
2106 f->output_data.w32->dwStyle | WS_CLIPCHILDREN,
72071
0bfda07cccbc (w32_createwindow): If `left' and/or `top' frame parameters are bound to some
Eli Zaretskii <eliz@gnu.org>
parents: 71545
diff changeset
2107 EQ (left, Qunbound) ? CW_USEDEFAULT : XINT (left),
0bfda07cccbc (w32_createwindow): If `left' and/or `top' frame parameters are bound to some
Eli Zaretskii <eliz@gnu.org>
parents: 71545
diff changeset
2108 EQ (top, Qunbound) ? CW_USEDEFAULT : XINT (top),
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2109 rect.right - rect.left,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2110 rect.bottom - rect.top,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2111 NULL,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2112 NULL,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2113 hinst,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2114 NULL);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2115
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2116 if (hwnd)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2117 {
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
2118 SetWindowLong (hwnd, WND_FONTWIDTH_INDEX, FRAME_COLUMN_WIDTH (f));
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
2119 SetWindowLong (hwnd, WND_LINEHEIGHT_INDEX, FRAME_LINE_HEIGHT (f));
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
2120 SetWindowLong (hwnd, WND_BORDER_INDEX, FRAME_INTERNAL_BORDER_WIDTH (f));
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
2121 SetWindowLong (hwnd, WND_SCROLLBAR_INDEX, f->scroll_bar_actual_width);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
2122 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
2123
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
2124 /* Enable drag-n-drop. */
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
2125 DragAcceptFiles (hwnd, TRUE);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2126
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2127 /* 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
2128 ShowWindow (hwnd, SW_HIDE);
71545
26164031aa5a (w32_createwindow): Use CW_USEDEFAULT instead of f->left_pos and SH_SHOW
Eli Zaretskii <eliz@gnu.org>
parents: 71171
diff changeset
2129
26164031aa5a (w32_createwindow): Use CW_USEDEFAULT instead of f->left_pos and SH_SHOW
Eli Zaretskii <eliz@gnu.org>
parents: 71171
diff changeset
2130 /* Update frame positions. */
26164031aa5a (w32_createwindow): Use CW_USEDEFAULT instead of f->left_pos and SH_SHOW
Eli Zaretskii <eliz@gnu.org>
parents: 71171
diff changeset
2131 GetWindowRect (hwnd, &rect);
26164031aa5a (w32_createwindow): Use CW_USEDEFAULT instead of f->left_pos and SH_SHOW
Eli Zaretskii <eliz@gnu.org>
parents: 71171
diff changeset
2132 f->left_pos = rect.left;
26164031aa5a (w32_createwindow): Use CW_USEDEFAULT instead of f->left_pos and SH_SHOW
Eli Zaretskii <eliz@gnu.org>
parents: 71171
diff changeset
2133 f->top_pos = rect.top;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2134 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2135 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2136
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2137 void
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2138 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
2139 W32Msg * wmsg;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2140 HWND hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2141 UINT msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2142 WPARAM wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2143 LPARAM lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2144 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2145 wmsg->msg.hwnd = hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2146 wmsg->msg.message = msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2147 wmsg->msg.wParam = wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2148 wmsg->msg.lParam = lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2149 wmsg->msg.time = GetMessageTime ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2150
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2151 post_msg (wmsg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2152 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2153
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
2154 /* 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
2155 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
2156 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
2157 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
2158 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
2159 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
2160 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
2161 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
2162 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
2163 on Swedish keyboards). */
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2164
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2165 #define EMACS_LCONTROL 0
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2166 #define EMACS_RCONTROL 1
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2167 #define EMACS_LMENU 2
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2168 #define EMACS_RMENU 3
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2169
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2170 static int modifiers[4];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2171 static int modifiers_recorded;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2172 static int modifier_key_support_tested;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2173
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2174 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2175 test_modifier_support (unsigned int wparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2176 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2177 unsigned int l, r;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2178
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2179 if (wparam != VK_CONTROL && wparam != VK_MENU)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2180 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2181 if (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2182 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2183 l = VK_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2184 r = VK_RCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2185 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2186 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2187 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2188 l = VK_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2189 r = VK_RMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2190 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2191 if (!(GetKeyState (l) & 0x8000) && !(GetKeyState (r) & 0x8000))
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2192 modifiers_recorded = 1;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2193 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2194 modifiers_recorded = 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2195 modifier_key_support_tested = 1;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2196 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2197
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2198 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2199 record_keydown (unsigned int wparam, unsigned int lparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2200 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2201 int i;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2202
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2203 if (!modifier_key_support_tested)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2204 test_modifier_support (wparam);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2205
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2206 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
2207 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2208
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2209 if (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2210 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2211 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2212 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2213
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2214 modifiers[i] = 1;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2215 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2216
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2217 static void
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2218 record_keyup (unsigned int wparam, unsigned int lparam)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2219 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2220 int i;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2221
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2222 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
2223 return;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2224
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2225 if (wparam == VK_CONTROL)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2226 i = (lparam & 0x1000000) ? EMACS_RCONTROL : EMACS_LCONTROL;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2227 else
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2228 i = (lparam & 0x1000000) ? EMACS_RMENU : EMACS_LMENU;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2229
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2230 modifiers[i] = 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2231 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2232
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2233 /* Emacs can lose focus while a modifier key has been pressed. When
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2234 it regains focus, be conservative and clear all modifiers since
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2235 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
2236 static void
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2237 reset_modifiers ()
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2238 {
15314
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
2239 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
2240
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2241 if (GetFocus () == NULL)
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2242 /* 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
2243 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
2244
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
2245 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
2246 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
2247
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
2248 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
2249 /* 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
2250 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
2251
796d825f4444 (reset_modifiers): Only clear a modifier if the modifier key has been
Richard M. Stallman <rms@gnu.org>
parents: 15290
diff changeset
2252 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
2253 /* 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
2254 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
2255
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2256 /* 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
2257 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
2258 result of a hot-key being pressed. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2259 {
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2260 BYTE keystate[256];
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2261
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2262 #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
2263
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2264 GetKeyboardState (keystate);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2265 keystate[VK_SHIFT] = CURRENT_STATE (VK_SHIFT);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2266 keystate[VK_CONTROL] = CURRENT_STATE (VK_CONTROL);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2267 keystate[VK_LCONTROL] = CURRENT_STATE (VK_LCONTROL);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2268 keystate[VK_RCONTROL] = CURRENT_STATE (VK_RCONTROL);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2269 keystate[VK_MENU] = CURRENT_STATE (VK_MENU);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2270 keystate[VK_LMENU] = CURRENT_STATE (VK_LMENU);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2271 keystate[VK_RMENU] = CURRENT_STATE (VK_RMENU);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2272 keystate[VK_LWIN] = CURRENT_STATE (VK_LWIN);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2273 keystate[VK_RWIN] = CURRENT_STATE (VK_RWIN);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2274 keystate[VK_APPS] = CURRENT_STATE (VK_APPS);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2275 SetKeyboardState (keystate);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2276 }
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2277 }
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2278
15377
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2279 /* 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
2280 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
2281 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
2282 the left or right modifier should be set. */
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2283 static void
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2284 sync_modifiers ()
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2285 {
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2286 if (!modifiers_recorded)
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2287 return;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2288
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2289 if (!(GetKeyState (VK_CONTROL) & 0x8000))
15377
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2290 modifiers[EMACS_RCONTROL] = modifiers[EMACS_LCONTROL] = 0;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2291
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2292 if (!(GetKeyState (VK_MENU) & 0x8000))
15377
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2293 modifiers[EMACS_RMENU] = modifiers[EMACS_LMENU] = 0;
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2294 }
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2295
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2296 static int
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2297 modifier_set (int vkey)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2298 {
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2299 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
2300 return (GetKeyState (vkey) & 0x1);
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2301 if (!modifiers_recorded)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2302 return (GetKeyState (vkey) & 0x8000);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2303
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2304 switch (vkey)
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2305 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2306 case VK_LCONTROL:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2307 return modifiers[EMACS_LCONTROL];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2308 case VK_RCONTROL:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2309 return modifiers[EMACS_RCONTROL];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2310 case VK_LMENU:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2311 return modifiers[EMACS_LMENU];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2312 case VK_RMENU:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2313 return modifiers[EMACS_RMENU];
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2314 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2315 return (GetKeyState (vkey) & 0x8000);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2316 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2317
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2318 /* 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
2319 Emacs uses. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2320
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2321 unsigned int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2322 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
2323 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2324 Lisp_Object key_mapping;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2325
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2326 switch (key)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2327 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2328 case VK_LWIN:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2329 key_mapping = Vw32_lwindow_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2330 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2331 case VK_RWIN:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2332 key_mapping = Vw32_rwindow_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2333 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2334 case VK_APPS:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2335 key_mapping = Vw32_apps_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2336 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2337 case VK_SCROLL:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2338 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
2339 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2340 default:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2341 key_mapping = Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2342 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2343
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2344 /* 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
2345 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
2346 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
2347 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
2348 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
2349 markbits here. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2350 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
2351 return hyper_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2352 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
2353 return super_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2354 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
2355 return meta_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2356 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
2357 return alt_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2358 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
2359 return ctrl_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2360 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
2361 return ctrl_modifier;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2362 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
2363 return shift_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2364
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2365 /* 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
2366 return 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2367 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2368
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2369 unsigned int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2370 w32_get_modifiers ()
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2371 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2372 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
2373 (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
2374 (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
2375 (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
2376 (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
2377 (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
2378 (modifier_set (VK_MENU) ?
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2379 ((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
2380 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2381
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2382 /* 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
2383 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
2384 and window input. */
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2385
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2386 static int
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2387 construct_console_modifiers ()
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2388 {
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2389 int mods;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2390
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2391 mods = 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2392 mods |= (modifier_set (VK_SHIFT)) ? SHIFT_PRESSED : 0;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2393 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
2394 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
2395 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
2396 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
2397 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
2398 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
2399 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
2400 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
2401 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
2402 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
2403
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2404 return mods;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2405 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2406
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2407 static int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2408 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
2409 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2410 int mods;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2411
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2412 /* Convert to emacs modifiers. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2413 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
2414
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2415 return mods;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2416 }
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2417
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2418 unsigned int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2419 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
2420 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2421 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
2422 return virt_key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2423
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2424 if (virt_key == VK_RETURN)
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2425 return (extended ? VK_NUMPAD_ENTER : VK_RETURN);
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
2426
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2427 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
2428 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
2429
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2430 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
2431 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
2432
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2433 if (virt_key == VK_CLEAR)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2434 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
2435
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2436 return virt_key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2437 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2438
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2439 /* 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
2440 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
2441 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
2442 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
2443 Lisp_Object w32_grabbed_keys;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2444
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2445 #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
2446 #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
2447 #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
2448 #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
2449
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
2450 #define RAW_HOTKEY_ID(k) ((k) & 0xbfff)
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
2451 #define RAW_HOTKEY_VK_CODE(k) ((k) & 255)
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
2452 #define RAW_HOTKEY_MODIFIERS(k) ((k) >> 8)
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
2453
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2454 /* 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
2455 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
2456 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
2457
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2458 static void
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2459 register_hot_keys (hwnd)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2460 HWND hwnd;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2461 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2462 Lisp_Object keylist;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2463
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2464 /* 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
2465 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
2466 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2467 Lisp_Object key = XCAR (keylist);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2468
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2469 /* 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
2470 if (!INTEGERP (key))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2471 continue;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2472
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2473 RegisterHotKey (hwnd, HOTKEY_ID (key),
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2474 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
2475 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2476 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2477
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2478 static void
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2479 unregister_hot_keys (hwnd)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2480 HWND hwnd;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2481 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2482 Lisp_Object keylist;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2483
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2484 /* 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
2485 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
2486 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2487 Lisp_Object key = XCAR (keylist);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2488
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2489 if (!INTEGERP (key))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2490 continue;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2491
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2492 UnregisterHotKey (hwnd, HOTKEY_ID (key));
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2493 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2494 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2495
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2496 /* Main message dispatch loop. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2497
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2498 static void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2499 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
2500 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2501 MSG msg;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2502 int result;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2503 HWND focus_window;
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
2504
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
2505 msh_mousewheel = RegisterWindowMessage (MSH_MOUSEWHEEL);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2506
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2507 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
2508 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2509 if (msg.hwnd == NULL)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2510 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2511 switch (msg.message)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2512 {
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2513 case WM_NULL:
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2514 /* 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
2515 break;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2516 case WM_EMACS_CREATEWINDOW:
78106
f9eb7f243bdc (w32_msg_pump) <WM_EMACS_CREATEWINDOW>: Initialize COM.
Jason Rumney <jasonr@gnu.org>
parents: 77995
diff changeset
2517 /* Initialize COM for this window. Even though we don't use it,
f9eb7f243bdc (w32_msg_pump) <WM_EMACS_CREATEWINDOW>: Initialize COM.
Jason Rumney <jasonr@gnu.org>
parents: 77995
diff changeset
2518 some third party shell extensions can cause it to be used in
f9eb7f243bdc (w32_msg_pump) <WM_EMACS_CREATEWINDOW>: Initialize COM.
Jason Rumney <jasonr@gnu.org>
parents: 77995
diff changeset
2519 system dialogs, which causes a crash if it is not initialized.
f9eb7f243bdc (w32_msg_pump) <WM_EMACS_CREATEWINDOW>: Initialize COM.
Jason Rumney <jasonr@gnu.org>
parents: 77995
diff changeset
2520 This is a known bug in Windows, which was fixed long ago, but
f9eb7f243bdc (w32_msg_pump) <WM_EMACS_CREATEWINDOW>: Initialize COM.
Jason Rumney <jasonr@gnu.org>
parents: 77995
diff changeset
2521 the patch for XP is not publically available until XP SP3,
f9eb7f243bdc (w32_msg_pump) <WM_EMACS_CREATEWINDOW>: Initialize COM.
Jason Rumney <jasonr@gnu.org>
parents: 77995
diff changeset
2522 and older versions will never be patched. */
f9eb7f243bdc (w32_msg_pump) <WM_EMACS_CREATEWINDOW>: Initialize COM.
Jason Rumney <jasonr@gnu.org>
parents: 77995
diff changeset
2523 CoInitialize (NULL);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2524 w32_createwindow ((struct frame *) msg.wParam);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2525 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
2526 abort ();
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2527 break;
21608
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
2528 case WM_EMACS_SETLOCALE:
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
2529 SetThreadLocale (msg.wParam);
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
2530 /* Reply is not expected. */
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
2531 break;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2532 case WM_EMACS_SETKEYBOARDLAYOUT:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2533 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
2534 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
2535 result, 0))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2536 abort ();
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2537 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2538 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
2539 focus_window = GetFocus ();
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2540 if (focus_window != NULL)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2541 RegisterHotKey (focus_window,
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
2542 RAW_HOTKEY_ID (msg.wParam),
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
2543 RAW_HOTKEY_MODIFIERS (msg.wParam),
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
2544 RAW_HOTKEY_VK_CODE (msg.wParam));
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2545 /* Reply is not expected. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2546 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2547 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
2548 focus_window = GetFocus ();
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2549 if (focus_window != NULL)
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
2550 UnregisterHotKey (focus_window, RAW_HOTKEY_ID (msg.wParam));
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2551 /* 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
2552 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
2553 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
2554 GC. */
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
2555 XSETCAR ((Lisp_Object) ((EMACS_INT) msg.lParam), Qnil);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2556 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
2557 abort ();
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2558 break;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2559 case WM_EMACS_TOGGLE_LOCK_KEY:
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2560 {
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2561 int vk_code = (int) msg.wParam;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2562 int cur_state = (GetKeyState (vk_code) & 1);
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
2563 Lisp_Object new_state = (Lisp_Object) ((EMACS_INT) msg.lParam);
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2564
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2565 /* 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
2566 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
2567 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
2568 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
2569 immediate values. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2570 if (NILP (new_state)
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2571 || (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
2572 && ((XUINT (new_state)) & 1) != cur_state))
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2573 {
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2574 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
2575
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2576 keybd_event ((BYTE) vk_code,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2577 (BYTE) MapVirtualKey (vk_code, 0),
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2578 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2579 keybd_event ((BYTE) vk_code,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2580 (BYTE) MapVirtualKey (vk_code, 0),
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2581 KEYEVENTF_EXTENDEDKEY | 0, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2582 keybd_event ((BYTE) vk_code,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2583 (BYTE) MapVirtualKey (vk_code, 0),
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2584 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2585 cur_state = !cur_state;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2586 }
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2587 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2588 cur_state, 0))
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2589 abort ();
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2590 }
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2591 break;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2592 default:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2593 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
2594 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2595 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2596 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2597 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2598 DispatchMessage (&msg);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2599 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2600
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2601 /* 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
2602 if (msg_buf->completed)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2603 break;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2604 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2605 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2606
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2607 deferred_msg * deferred_msg_head;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2608
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2609 static deferred_msg *
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2610 find_deferred_msg (HWND hwnd, UINT msg)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2611 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2612 deferred_msg * item;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2613
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2614 /* 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
2615 modification of single pointer is always atomic. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2616 /* enter_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2617
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2618 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
2619 if (item->w32msg.msg.hwnd == hwnd
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2620 && item->w32msg.msg.message == msg)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2621 break;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2622
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2623 /* leave_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2624
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2625 return item;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2626 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2627
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2628 static LRESULT
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2629 send_deferred_msg (deferred_msg * msg_buf,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2630 HWND hwnd,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2631 UINT msg,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2632 WPARAM wParam,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2633 LPARAM lParam)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2634 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2635 /* Only input thread can send deferred messages. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2636 if (GetCurrentThreadId () != dwWindowsThreadId)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2637 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2638
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2639 /* 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
2640 if (find_deferred_msg (hwnd, msg) != NULL)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2641 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2642
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2643 /* 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
2644 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
2645 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
2646 input thread can call us). */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2647
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2648 /* enter_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2649
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2650 msg_buf->completed = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2651 msg_buf->next = deferred_msg_head;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2652 deferred_msg_head = msg_buf;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2653 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
2654
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2655 /* leave_crit (); */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2656
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2657 /* 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
2658 this one is completed. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2659 w32_msg_pump (msg_buf);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2660
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2661 deferred_msg_head = msg_buf->next;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2662
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2663 return msg_buf->result;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2664 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2665
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2666 void
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2667 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
2668 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2669 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
2670
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2671 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
2672 /* 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
2673 return;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2674
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2675 msg_buf->result = result;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2676 msg_buf->completed = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2677
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2678 /* 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
2679 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2680 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2681
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2682 void
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2683 cancel_all_deferred_msgs ()
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2684 {
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2685 deferred_msg * item;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2686
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2687 /* 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
2688 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
2689 /* enter_crit (); */
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2690
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2691 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
2692 {
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2693 item->result = 0;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2694 item->completed = 1;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2695 }
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2696
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2697 /* leave_crit (); */
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2698
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2699 /* 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
2700 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
2701 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2702
74221
3146bd0e5646 (w32_msg_worker): Define as WINAPI and arg as void pointer.
Jason Rumney <jasonr@gnu.org>
parents: 73674
diff changeset
2703 DWORD WINAPI
3146bd0e5646 (w32_msg_worker): Define as WINAPI and arg as void pointer.
Jason Rumney <jasonr@gnu.org>
parents: 73674
diff changeset
2704 w32_msg_worker (void *arg)
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2705 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2706 MSG msg;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2707 deferred_msg dummy_buf;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2708
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2709 /* Ensure our message queue is created */
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2710
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2711 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2712
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2713 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
2714 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2715
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2716 memset (&dummy_buf, 0, sizeof (dummy_buf));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2717 dummy_buf.w32msg.msg.hwnd = NULL;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2718 dummy_buf.w32msg.msg.message = WM_NULL;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2719
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2720 /* 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
2721 application quits. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2722 w32_msg_pump (&dummy_buf);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2723
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
2724 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2725 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2726
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2727 static void
69426
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2728 signal_user_input ()
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2729 {
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2730 /* Interrupt any lisp that wants to be interrupted by input. */
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2731 if (!NILP (Vthrow_on_input))
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2732 {
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2733 Vquit_flag = Vthrow_on_input;
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2734 /* If we're inside a function that wants immediate quits,
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2735 do it now. */
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2736 if (immediate_quit && NILP (Vinhibit_quit))
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2737 {
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2738 immediate_quit = 0;
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2739 QUIT;
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2740 }
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2741 }
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2742 }
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2743
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2744
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2745 static void
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2746 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
2747 HWND hwnd;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2748 UINT msg;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2749 WPARAM wParam;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2750 LPARAM lParam;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2751 DWORD modifiers;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2752
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2753 {
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2754 W32Msg wmsg;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2755
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2756 wmsg.dwModifiers = modifiers;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2757
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2758 /* 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
2759 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
2760 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
2761 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
2762 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
2763 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
2764 {
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2765 int c = wParam;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2766 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
2767 c = make_ctrl_char (c) & 0377;
24339
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
2768 if (c == quit_char
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
2769 || (wmsg.dwModifiers == 0 &&
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
2770 w32_quit_key && wParam == w32_quit_key))
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2771 {
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2772 Vquit_flag = Qt;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2773
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2774 /* 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
2775 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
2776 msg = WM_NULL;
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2777
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2778 /* 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
2779 signal_quit ();
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2780
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2781 /* 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
2782 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
2783 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
2784 "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
2785 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
2786 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
2787 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
2788 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
2789 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
2790 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
2791 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
2792 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
2793 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
2794 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
2795
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2796 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
2797 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
2798 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
2799 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
2800 cancel_all_deferred_msgs ();
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2801 }
69426
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2802 else
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
2803 signal_user_input ();
23950
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2804 }
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2805
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2806 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
2807 }
d8f8533db4cc (w32_msg_pump): Ignore WM_NULL message posted to thread
Andrew Innes <andrewi@gnu.org>
parents: 23803
diff changeset
2808
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2809 /* Main window procedure */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2810
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2811 LRESULT CALLBACK
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2812 w32_wnd_proc (hwnd, msg, wParam, lParam)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2813 HWND hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2814 UINT msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2815 WPARAM wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2816 LPARAM lParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2817 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2818 struct frame *f;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
2819 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
2820 W32Msg wmsg;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
2821 int windows_translate;
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
2822 int key;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
2823
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2824 /* 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
2825 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
2826 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
2827 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
2828 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
2829
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2830 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
2831 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
2832 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
2833 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
2834 delete-frame has synchronized with this thread.
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2835
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2836 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
2837 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
2838 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
2839
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2840 switch (msg)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2841 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2842 case WM_ERASEBKGND:
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2843 f = x_window_to_frame (dpyinfo, hwnd);
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2844 if (f)
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2845 {
27407
7df920562cbe (w32_defined_color): Apply gamma correction before trying to map to
Jason Rumney <jasonr@gnu.org>
parents: 27397
diff changeset
2846 HDC hdc = get_frame_dc (f);
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2847 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
2848 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
2849 release_frame_dc (f, hdc);
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
2850
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
2851 #if defined (W32_DEBUG_DISPLAY)
39128
42efaa34094a (w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents: 37707
diff changeset
2852 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
2853 f,
42efaa34094a (w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents: 37707
diff changeset
2854 wmsg.rect.left, wmsg.rect.top,
42efaa34094a (w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents: 37707
diff changeset
2855 wmsg.rect.right, wmsg.rect.bottom));
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
2856 #endif /* W32_DEBUG_DISPLAY */
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2857 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2858 return 1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2859 case WM_PALETTECHANGED:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2860 /* ignore our own changes */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2861 if ((HWND)wParam != hwnd)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2862 {
15650
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2863 f = x_window_to_frame (dpyinfo, hwnd);
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2864 if (f)
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2865 /* 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
2866 frames to be redrawn if needed. */
bc9525478463 (win32_wnd_proc): Handle WM_ERASEBKGND and
Karl Heuer <kwzh@gnu.org>
parents: 15459
diff changeset
2867 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
2868 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
2869 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2870 case WM_PAINT:
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
2871 {
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2872 PAINTSTRUCT paintStruct;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2873 RECT update_rect;
42935
20a21fb23284 (w32_wnd_proc) <WM_PAINT>: Initialize update_rect.
Jason Rumney <jasonr@gnu.org>
parents: 42918
diff changeset
2874 bzero (&update_rect, sizeof (update_rect));
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2875
39128
42efaa34094a (w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents: 37707
diff changeset
2876 f = x_window_to_frame (dpyinfo, hwnd);
42efaa34094a (w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents: 37707
diff changeset
2877 if (f == 0)
42efaa34094a (w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents: 37707
diff changeset
2878 {
42efaa34094a (w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents: 37707
diff changeset
2879 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
2880 return 0;
42efaa34094a (w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents: 37707
diff changeset
2881 }
42efaa34094a (w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents: 37707
diff changeset
2882
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2883 /* MSDN Docs say not to call BeginPaint if GetUpdateRect
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2884 fails. Apparently this can happen under some
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2885 circumstances. */
42935
20a21fb23284 (w32_wnd_proc) <WM_PAINT>: Initialize update_rect.
Jason Rumney <jasonr@gnu.org>
parents: 42918
diff changeset
2886 if (GetUpdateRect (hwnd, &update_rect, FALSE) || !w32_strict_painting)
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2887 {
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2888 enter_crit ();
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2889 BeginPaint (hwnd, &paintStruct);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2890
42935
20a21fb23284 (w32_wnd_proc) <WM_PAINT>: Initialize update_rect.
Jason Rumney <jasonr@gnu.org>
parents: 42918
diff changeset
2891 /* 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
2892 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
2893 are invalid. */
20a21fb23284 (w32_wnd_proc) <WM_PAINT>: Initialize update_rect.
Jason Rumney <jasonr@gnu.org>
parents: 42918
diff changeset
2894 UnionRect (&(wmsg.rect), &update_rect, &(paintStruct.rcPaint));
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2895
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2896 #if defined (W32_DEBUG_DISPLAY)
39128
42efaa34094a (w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents: 37707
diff changeset
2897 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
2898 f,
42efaa34094a (w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents: 37707
diff changeset
2899 wmsg.rect.left, wmsg.rect.top,
42efaa34094a (w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents: 37707
diff changeset
2900 wmsg.rect.right, wmsg.rect.bottom));
42efaa34094a (w32_createwindow): Remove the WS_CLIPCHILDREN style
Andrew Innes <andrewi@gnu.org>
parents: 37707
diff changeset
2901 DebPrint ((" [update region is %d,%d-%d,%d]\n",
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2902 update_rect.left, update_rect.top,
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2903 update_rect.right, update_rect.bottom));
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2904 #endif
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2905 EndPaint (hwnd, &paintStruct);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2906 leave_crit ();
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2907
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2908 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
2909
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2910 return 0;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
2911 }
24695
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
2912
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
2913 /* If GetUpdateRect returns 0 (meaning there is no update
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
2914 region), assume the whole window needs to be repainted. */
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
2915 GetClientRect(hwnd, &wmsg.rect);
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
2916 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
2917 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2918 }
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2919
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2920 case WM_INPUTLANGCHANGE:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2921 /* 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
2922 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
2923
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2924 /* 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
2925 preserve modifier key states. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2926 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2927 int i;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2928 BYTE keystate[256];
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2929
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2930 GetKeyboardState (keystate);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2931 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
2932 if (1
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2933 && i != VK_SHIFT
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2934 && i != VK_LSHIFT
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2935 && i != VK_RSHIFT
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2936 && i != VK_CAPITAL
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2937 && i != VK_NUMLOCK
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2938 && i != VK_SCROLL
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2939 && i != VK_CONTROL
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2940 && i != VK_LCONTROL
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2941 && i != VK_RCONTROL
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2942 && i != VK_MENU
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2943 && i != VK_LMENU
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2944 && i != VK_RMENU
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2945 && i != VK_LWIN
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2946 && i != VK_RWIN)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2947 keystate[i] = 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2948 SetKeyboardState (keystate);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2949 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2950 goto dflt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2951
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2952 case WM_HOTKEY:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2953 /* 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
2954 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
2955 return (0);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2956
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2957 case WM_KEYUP:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2958 case WM_SYSKEYUP:
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2959 record_keyup (wParam, lParam);
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2960 goto dflt;
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2961
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2962 case WM_KEYDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2963 case WM_SYSKEYDOWN:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2964 /* 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
2965 if (dpyinfo->faked_key == wParam)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2966 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2967 dpyinfo->faked_key = 0;
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
2968 /* 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
2969 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
2970 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
2971 example. */
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
2972 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
2973 {
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
2974 windows_translate = 1;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
2975 goto translate;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
2976 }
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
2977 return 0;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2978 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2979
15377
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2980 /* Synchronize modifiers with current keystroke. */
65d9ff2c8602 (sync_modifiers): New function.
Richard M. Stallman <rms@gnu.org>
parents: 15314
diff changeset
2981 sync_modifiers ();
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
2982 record_keydown (wParam, lParam);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2983 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
2984
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
2985 windows_translate = 0;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2986
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2987 switch (wParam)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2988 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2989 case VK_LWIN:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2990 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
2991 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2992 /* 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
2993 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
2994 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
2995 if (GetAsyncKeyState (wParam) & 1)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
2996 {
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
2997 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
2998 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
2999 else
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3000 key = VK_SPACE;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3001 dpyinfo->faked_key = key;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3002 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
3003 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3004 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3005 if (!NILP (Vw32_lwindow_modifier))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3006 return 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3007 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3008 case VK_RWIN:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3009 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
3010 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3011 if (GetAsyncKeyState (wParam) & 1)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3012 {
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3013 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
3014 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
3015 else
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3016 key = VK_SPACE;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3017 dpyinfo->faked_key = key;
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3018 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
3019 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3020 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3021 if (!NILP (Vw32_rwindow_modifier))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3022 return 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3023 break;
24206
d3649b38bb37 (w32_wnd_proc): Fix bug introduced by previous change;
Andrew Innes <andrewi@gnu.org>
parents: 24147
diff changeset
3024 case VK_APPS:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3025 if (!NILP (Vw32_apps_modifier))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3026 return 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3027 break;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3028 case VK_MENU:
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3029 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
3030 /* 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
3031 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
3032 return 0;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3033 windows_translate = 1;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3034 break;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3035 case VK_CAPITAL:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3036 /* 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
3037 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
3038 goto disable_lock_key;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3039 windows_translate = 1;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3040 break;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3041 case VK_NUMLOCK:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3042 /* 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
3043 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
3044 goto disable_lock_key;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3045 windows_translate = 1;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3046 break;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3047 case VK_SCROLL:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3048 /* 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
3049 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
3050 goto disable_lock_key;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3051 windows_translate = 1;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3052 break;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3053 disable_lock_key:
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3054 /* 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
3055 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
3056 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
3057 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
3058 dpyinfo->faked_key = wParam;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3059 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
3060 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3061 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
3062 KEYEVENTF_EXTENDEDKEY | 0, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3063 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
3064 KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3065 /* 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
3066 (TranslateMessage apparently does this), after forwarding
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3067 input event. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3068 post_character_message (hwnd, msg, wParam, lParam,
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3069 w32_get_key_modifiers (wParam, lParam));
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3070 windows_translate = 1;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3071 break;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3072 case VK_CONTROL:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3073 case VK_SHIFT:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3074 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
3075 windows_translate = 1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3076 break;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3077 case VK_CANCEL:
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3078 /* 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
3079 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
3080 VK_CANCEL events into VK_PAUSE events. */
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3081 wParam = VK_PAUSE;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3082 break;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3083 case VK_PAUSE:
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3084 /* 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
3085 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
3086 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
3087 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
3088 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
3089 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
3090 wParam = VK_NUMLOCK;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3091 break;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3092 default:
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3093 /* 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
3094 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
3095 {
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3096 DWORD modifiers = construct_console_modifiers ();
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3097
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3098 if (!NILP (Vw32_recognize_altgr)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3099 && 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
3100 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3101 /* 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
3102 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
3103 chords correctly. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3104 windows_translate = 1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3105 }
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3106 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
3107 {
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3108 /* Handle key chords including any modifiers other
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3109 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
3110 modifier information as possible. */
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3111 if ('A' <= wParam && wParam <= 'Z')
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3112 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3113 /* 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
3114 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
3115 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
3116 the normal layout translates alphabetic
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3117 characters to non-ascii characters. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3118 if (!modifier_set (VK_SHIFT))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3119 wParam += ('a' - 'A');
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3120 msg = WM_CHAR;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3121 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3122 else
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3123 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3124 /* 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
3125 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
3126 shift modifier). */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3127 int add;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3128 int isdead = 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3129 KEY_EVENT_RECORD key;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3130
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3131 key.bKeyDown = TRUE;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3132 key.wRepeatCount = 1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3133 key.wVirtualKeyCode = wParam;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3134 key.wVirtualScanCode = (lParam & 0xFF0000) >> 16;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3135 key.uChar.AsciiChar = 0;
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3136 key.dwControlKeyState = modifiers;
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3137
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3138 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
3139 /* 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
3140 dead key. Ignore both. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3141 while (--add >= 0)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3142 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3143 /* Forward asciified character sequence. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3144 post_character_message
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3145 (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
3146 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
3147 w32_kbd_patch_key (&key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3148 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3149 return 0;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3150 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3151 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3152 else
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3153 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3154 /* Let TranslateMessage handle everything else. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3155 windows_translate = 1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3156 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3157 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3158 }
14461
4fe9540be594 (modifiers, modifier_key_support_tested,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
3159
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3160 translate:
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3161 if (windows_translate)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3162 {
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
3163 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
3164
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
3165 windows_msg.time = GetMessageTime ();
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
3166 TranslateMessage (&windows_msg);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3167 goto dflt;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3168 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3169
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3170 /* Fall through */
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3171
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3172 case WM_SYSCHAR:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3173 case WM_CHAR:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3174 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
3175 w32_get_key_modifiers (wParam, lParam));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3176 break;
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3177
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3178 /* 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
3179 are used together, but only if user has two button mouse. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3180 case WM_LBUTTONDOWN:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3181 case WM_RBUTTONDOWN:
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
3182 if (w32_num_mouse_buttons > 2)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3183 goto handle_plain_button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3184
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3185 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3186 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
3187 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
3188
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3189 if (button_state & this)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3190 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3191
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3192 if (button_state == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3193 SetCapture (hwnd);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3194
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3195 button_state |= this;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3196
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3197 if (button_state & other)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3198 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3199 if (mouse_button_timer)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3200 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3201 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3202 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3203
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3204 /* Generate middle mouse event instead. */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3205 msg = WM_MBUTTONDOWN;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3206 button_state |= MMOUSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3207 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3208 else if (button_state & MMOUSE)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3209 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3210 /* 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
3211 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
3212 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
3213 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
3214 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3215 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3216 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3217 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3218 /* Flush out saved message. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3219 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
3220 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3221 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
3222 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
70233
589489bb1924 (w32_wnd_proc) <WM_LBUTTONDOWN, WM_RBUTTONDOWN>:
Jason Rumney <jasonr@gnu.org>
parents: 69879
diff changeset
3223 signal_user_input ();
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3224
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3225 /* Clear message buffer. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3226 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
3227 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3228 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3229 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3230 /* Hold onto message for now. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3231 mouse_button_timer =
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3232 SetTimer (hwnd, MOUSE_BUTTON_ID,
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
3233 w32_mouse_button_tolerance, NULL);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3234 saved_mouse_button_msg.msg.hwnd = hwnd;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3235 saved_mouse_button_msg.msg.message = msg;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3236 saved_mouse_button_msg.msg.wParam = wParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3237 saved_mouse_button_msg.msg.lParam = lParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3238 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
3239 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
3240 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3241 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3242 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3243
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3244 case WM_LBUTTONUP:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3245 case WM_RBUTTONUP:
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
3246 if (w32_num_mouse_buttons > 2)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3247 goto handle_plain_button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3248
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3249 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3250 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
3251 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
3252
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3253 if ((button_state & this) == 0)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
3254 return 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3255
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3256 button_state &= ~this;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3257
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3258 if (button_state & MMOUSE)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3259 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3260 /* 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
3261 if ((button_state & other) == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3262 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3263 msg = WM_MBUTTONUP;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3264 button_state &= ~MMOUSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3265
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3266 if (button_state) abort ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3267 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3268 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3269 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3270 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3271 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3272 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3273 /* Flush out saved message if necessary. */
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3274 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
3275 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3276 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
3277 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3278 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3279 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
3280 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
70233
589489bb1924 (w32_wnd_proc) <WM_LBUTTONDOWN, WM_RBUTTONDOWN>:
Jason Rumney <jasonr@gnu.org>
parents: 69879
diff changeset
3281 signal_user_input ();
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3282
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3283 /* 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
3284 saved_mouse_button_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3285 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3286 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3287
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3288 if (button_state == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3289 ReleaseCapture ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3290 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3291 return 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3292
42719
70f13c4f82c7 (w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents: 42537
diff changeset
3293 case WM_XBUTTONDOWN:
70f13c4f82c7 (w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents: 42537
diff changeset
3294 case WM_XBUTTONUP:
70f13c4f82c7 (w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents: 42537
diff changeset
3295 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
3296 goto dflt;
70f13c4f82c7 (w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents: 42537
diff changeset
3297 /* else fall through and process them. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3298 case WM_MBUTTONDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3299 case WM_MBUTTONUP:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3300 handle_plain_button:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3301 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3302 BOOL up;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3303 int button;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3304
69406
8b54066613d1 (w32_wnd_proc): Ignore middle and extra button events if a menu is already
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
3305 /* Ignore middle and extra buttons as long as the menu is active. */
8b54066613d1 (w32_wnd_proc): Ignore middle and extra button events if a menu is already
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
3306 f = x_window_to_frame (dpyinfo, hwnd);
8b54066613d1 (w32_wnd_proc): Ignore middle and extra button events if a menu is already
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
3307 if (f && f->output_data.w32->menubar_active)
8b54066613d1 (w32_wnd_proc): Ignore middle and extra button events if a menu is already
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
3308 return 0;
8b54066613d1 (w32_wnd_proc): Ignore middle and extra button events if a menu is already
Eli Zaretskii <eliz@gnu.org>
parents: 68651
diff changeset
3309
42719
70f13c4f82c7 (w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents: 42537
diff changeset
3310 if (parse_button (msg, HIWORD (wParam), &button, &up))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3311 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3312 if (up) ReleaseCapture ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3313 else SetCapture (hwnd);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3314 button = (button == 0) ? LMOUSE :
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3315 ((button == 1) ? MMOUSE : RMOUSE);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3316 if (up)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3317 button_state &= ~button;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3318 else
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3319 button_state |= button;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3320 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3321 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3322
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3323 wmsg.dwModifiers = w32_get_modifiers ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3324 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
69426
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
3325 signal_user_input ();
42719
70f13c4f82c7 (w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents: 42537
diff changeset
3326
70f13c4f82c7 (w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents: 42537
diff changeset
3327 /* 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
3328 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
3329 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
3330
41732
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
3331 case WM_MOUSEMOVE:
69879
a3c24f2249c9 (w32_wnd_proc) <WM_MOUSEMOVE>: Ignore mouse movements if a menu is active
Eli Zaretskii <eliz@gnu.org>
parents: 69867
diff changeset
3332 /* Ignore mouse movements as long as the menu is active. These
a3c24f2249c9 (w32_wnd_proc) <WM_MOUSEMOVE>: Ignore mouse movements if a menu is active
Eli Zaretskii <eliz@gnu.org>
parents: 69867
diff changeset
3333 movements are processed by the window manager anyway, and
a3c24f2249c9 (w32_wnd_proc) <WM_MOUSEMOVE>: Ignore mouse movements if a menu is active
Eli Zaretskii <eliz@gnu.org>
parents: 69867
diff changeset
3334 it's wrong to handle them as if they happened on the
a3c24f2249c9 (w32_wnd_proc) <WM_MOUSEMOVE>: Ignore mouse movements if a menu is active
Eli Zaretskii <eliz@gnu.org>
parents: 69867
diff changeset
3335 underlying frame. */
a3c24f2249c9 (w32_wnd_proc) <WM_MOUSEMOVE>: Ignore mouse movements if a menu is active
Eli Zaretskii <eliz@gnu.org>
parents: 69867
diff changeset
3336 f = x_window_to_frame (dpyinfo, hwnd);
a3c24f2249c9 (w32_wnd_proc) <WM_MOUSEMOVE>: Ignore mouse movements if a menu is active
Eli Zaretskii <eliz@gnu.org>
parents: 69867
diff changeset
3337 if (f && f->output_data.w32->menubar_active)
a3c24f2249c9 (w32_wnd_proc) <WM_MOUSEMOVE>: Ignore mouse movements if a menu is active
Eli Zaretskii <eliz@gnu.org>
parents: 69867
diff changeset
3338 return 0;
a3c24f2249c9 (w32_wnd_proc) <WM_MOUSEMOVE>: Ignore mouse movements if a menu is active
Eli Zaretskii <eliz@gnu.org>
parents: 69867
diff changeset
3339
41732
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
3340 /* 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
3341 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
3342 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
3343 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
3344 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
3345 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
3346 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
3347 {
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
3348 TRACKMOUSEEVENT tme;
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
3349 tme.cbSize = sizeof (tme);
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
3350 tme.dwFlags = TME_LEAVE;
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
3351 tme.hwndTrack = hwnd;
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
3352
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
3353 track_mouse_event_fn (&tme);
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
3354 track_mouse_window = hwnd;
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
3355 }
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3356 case WM_VSCROLL:
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
3357 if (w32_mouse_move_interval <= 0
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3358 || (msg == WM_MOUSEMOVE && button_state == 0))
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3359 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3360 wmsg.dwModifiers = w32_get_modifiers ();
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3361 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
3362 return 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3363 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3364
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3365 /* 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
3366 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
3367 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
3368 expires, we just replace the first message. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3369
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3370 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
3371 mouse_move_timer =
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3372 SetTimer (hwnd, MOUSE_MOVE_ID,
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
3373 w32_mouse_move_interval, NULL);
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3374
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3375 /* Hold onto message for now. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3376 saved_mouse_move_msg.msg.hwnd = hwnd;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3377 saved_mouse_move_msg.msg.message = msg;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3378 saved_mouse_move_msg.msg.wParam = wParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3379 saved_mouse_move_msg.msg.lParam = lParam;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3380 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
3381 saved_mouse_move_msg.dwModifiers = w32_get_modifiers ();
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3382
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3383 return 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3384
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3385 case WM_MOUSEWHEEL:
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3386 case WM_DROPFILES:
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3387 wmsg.dwModifiers = w32_get_modifiers ();
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3388 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
69426
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
3389 signal_user_input ();
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3390 return 0;
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3391
83878
f65f55d787ec Horizontal mouse wheel support:
Jason Rumney <jasonr@gnu.org>
parents: 83648
diff changeset
3392 case WM_MOUSEHWHEEL:
f65f55d787ec Horizontal mouse wheel support:
Jason Rumney <jasonr@gnu.org>
parents: 83648
diff changeset
3393 wmsg.dwModifiers = w32_get_modifiers ();
f65f55d787ec Horizontal mouse wheel support:
Jason Rumney <jasonr@gnu.org>
parents: 83648
diff changeset
3394 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
f65f55d787ec Horizontal mouse wheel support:
Jason Rumney <jasonr@gnu.org>
parents: 83648
diff changeset
3395 signal_user_input ();
f65f55d787ec Horizontal mouse wheel support:
Jason Rumney <jasonr@gnu.org>
parents: 83648
diff changeset
3396 /* Non-zero must be returned when WM_MOUSEHWHEEL messages are
f65f55d787ec Horizontal mouse wheel support:
Jason Rumney <jasonr@gnu.org>
parents: 83648
diff changeset
3397 handled, to prevent the system trying to handle it by faking
f65f55d787ec Horizontal mouse wheel support:
Jason Rumney <jasonr@gnu.org>
parents: 83648
diff changeset
3398 scroll bar events. */
f65f55d787ec Horizontal mouse wheel support:
Jason Rumney <jasonr@gnu.org>
parents: 83648
diff changeset
3399 return 1;
f65f55d787ec Horizontal mouse wheel support:
Jason Rumney <jasonr@gnu.org>
parents: 83648
diff changeset
3400
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3401 case WM_TIMER:
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3402 /* Flush out saved messages if necessary. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3403 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
3404 {
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3405 if (saved_mouse_button_msg.msg.hwnd)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3406 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3407 post_msg (&saved_mouse_button_msg);
69426
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
3408 signal_user_input ();
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3409 saved_mouse_button_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3410 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3411 KillTimer (hwnd, mouse_button_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3412 mouse_button_timer = 0;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3413 }
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3414 else if (wParam == mouse_move_timer)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3415 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3416 if (saved_mouse_move_msg.msg.hwnd)
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3417 {
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3418 post_msg (&saved_mouse_move_msg);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3419 saved_mouse_move_msg.msg.hwnd = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3420 }
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3421 KillTimer (hwnd, mouse_move_timer);
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3422 mouse_move_timer = 0;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3423 }
43472
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3424 else if (wParam == menu_free_timer)
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3425 {
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3426 KillTimer (hwnd, menu_free_timer);
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3427 menu_free_timer = 0;
43484
a3cecd273126 (w32_wnd_proc) <WM_TIMER>: Fix last change.
Jason Rumney <jasonr@gnu.org>
parents: 43472
diff changeset
3428 f = x_window_to_frame (dpyinfo, hwnd);
76075
25965473846d (current_popup_menu): Use from w32menu.c.
Jason Rumney <jasonr@gnu.org>
parents: 75348
diff changeset
3429 /* If a popup menu is active, don't wipe its strings. */
76083
5e1d8f9b52ea * w32fns.c (menubar_in_use): New flag.
Jason Rumney <jasonr@gnu.org>
parents: 76078
diff changeset
3430 if (menubar_in_use
76075
25965473846d (current_popup_menu): Use from w32menu.c.
Jason Rumney <jasonr@gnu.org>
parents: 75348
diff changeset
3431 && current_popup_menu == NULL)
43472
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3432 {
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3433 /* 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
3434 w32_free_menu_strings (hwnd);
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3435 f->output_data.w32->menubar_active = 0;
76083
5e1d8f9b52ea * w32fns.c (menubar_in_use): New flag.
Jason Rumney <jasonr@gnu.org>
parents: 76078
diff changeset
3436 menubar_in_use = 0;
43472
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3437 }
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3438 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3439 return 0;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3440
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3441 case WM_NCACTIVATE:
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3442 /* 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
3443 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
3444 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
3445 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
3446 keyboard modifiers' state. */
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3447 reset_modifiers ();
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3448 goto dflt;
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
3449
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3450 case WM_INITMENU:
24751
e0eaca5025bc (w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents: 24718
diff changeset
3451 button_state = 0;
e0eaca5025bc (w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents: 24718
diff changeset
3452 ReleaseCapture ();
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3453 /* 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
3454 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
3455 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
3456 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
3457 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
3458
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3459 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
3460 loop that can process all other messages.
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3461
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3462 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
3463 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
3464 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
3465 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
3466 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
3467 being active). */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3468
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3469 f = x_window_to_frame (dpyinfo, hwnd);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3470 if (f
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3471 && (f->output_data.w32->menubar_active
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3472 /* 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
3473 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
3474 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
3475 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
3476 had requested it to be turned off! */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3477 || f->output_data.w32->menubar_widget == NULL))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3478 return 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3479
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3480 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3481 deferred_msg msg_buf;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3482
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3483 /* 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
3484 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
3485 if (find_deferred_msg (hwnd, msg) != NULL)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3486 abort ();
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3487
76083
5e1d8f9b52ea * w32fns.c (menubar_in_use): New flag.
Jason Rumney <jasonr@gnu.org>
parents: 76078
diff changeset
3488 menubar_in_use = 1;
76078
3479e5ecb040 * w32fns.c (w32_wnd_proc) [WM_INITMENU]: Set menubar_active frame parameter.
Jason Rumney <jasonr@gnu.org>
parents: 76075
diff changeset
3489
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3490 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
3491 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3492
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3493 case WM_EXITMENULOOP:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3494 f = x_window_to_frame (dpyinfo, hwnd);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3495
76075
25965473846d (current_popup_menu): Use from w32menu.c.
Jason Rumney <jasonr@gnu.org>
parents: 75348
diff changeset
3496 /* If a menu is still active, check again after a short delay,
25965473846d (current_popup_menu): Use from w32menu.c.
Jason Rumney <jasonr@gnu.org>
parents: 75348
diff changeset
3497 since Windows often (always?) sends the WM_EXITMENULOOP
25965473846d (current_popup_menu): Use from w32menu.c.
Jason Rumney <jasonr@gnu.org>
parents: 75348
diff changeset
3498 before the corresponding WM_COMMAND message.
25965473846d (current_popup_menu): Use from w32menu.c.
Jason Rumney <jasonr@gnu.org>
parents: 75348
diff changeset
3499 Don't do this if a popup menu is active, since it is only
25965473846d (current_popup_menu): Use from w32menu.c.
Jason Rumney <jasonr@gnu.org>
parents: 75348
diff changeset
3500 menubar menus that require cleaning up in this way.
25965473846d (current_popup_menu): Use from w32menu.c.
Jason Rumney <jasonr@gnu.org>
parents: 75348
diff changeset
3501 */
76083
5e1d8f9b52ea * w32fns.c (menubar_in_use): New flag.
Jason Rumney <jasonr@gnu.org>
parents: 76078
diff changeset
3502 if (f && menubar_in_use && current_popup_menu == NULL)
43472
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3503 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
3504 goto dflt;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3505
28272
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
3506 case WM_MENUSELECT:
41638
aadcf676d5de (w32_wnd_proc) <WM_MENUSELECT>: Display help directly.
Jason Rumney <jasonr@gnu.org>
parents: 41480
diff changeset
3507 /* 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
3508 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
3509 keyboard buffer. */
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3510 {
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3511 HMENU menu = (HMENU) lParam;
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3512 UINT menu_item = (UINT) LOWORD (wParam);
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3513 UINT flags = (UINT) HIWORD (wParam);
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3514
41638
aadcf676d5de (w32_wnd_proc) <WM_MENUSELECT>: Display help directly.
Jason Rumney <jasonr@gnu.org>
parents: 41480
diff changeset
3515 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
3516 }
28272
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
3517 return 0;
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
3518
21735
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3519 case WM_MEASUREITEM:
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3520 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
3521 if (f)
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3522 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3523 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
3524
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3525 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
3526 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3527 /* 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
3528 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
3529 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
3530 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
3531 LOGFONT menu_logfont;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3532 HFONT old_font;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3533 SIZE size;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3534
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3535 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
3536 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
3537 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
3538 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
3539
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
3540 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
3541 if (title)
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
3542 {
56971
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3543 if (unicode_append_menu)
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3544 GetTextExtentPoint32W (hdc, (WCHAR *) title,
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3545 wcslen ((WCHAR *) title),
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3546 &size);
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3547 else
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3548 GetTextExtentPoint32 (hdc, title, strlen (title), &size);
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3549
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
3550 pMis->itemWidth = size.cx;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
3551 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
3552 pMis->itemHeight = size.cy;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
3553 }
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
3554 else
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
3555 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
3556
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3557 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
3558 DeleteObject (menu_font);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3559 ReleaseDC (hwnd, hdc);
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3560 return TRUE;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3561 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3562 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3563 return 0;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3564
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3565 case WM_DRAWITEM:
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3566 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
3567 if (f)
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3568 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3569 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
3570
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3571 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
3572 {
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3573 /* 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
3574 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
3575 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
3576 {
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
3577 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
3578 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
3579 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
3580 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
3581
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
3582 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
3583 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
3584 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
3585 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
3586
56971
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3587 /* Always draw title as if not selected. */
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3588 if (unicode_append_menu)
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3589 ExtTextOutW (hdc,
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3590 pDis->rcItem.left
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3591 + GetSystemMetrics (SM_CXMENUCHECK),
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3592 pDis->rcItem.top,
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3593 ETO_OPAQUE, &pDis->rcItem,
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3594 (WCHAR *) title,
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3595 wcslen ((WCHAR *) title), NULL);
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3596 else
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3597 ExtTextOut (hdc,
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3598 pDis->rcItem.left
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3599 + GetSystemMetrics (SM_CXMENUCHECK),
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3600 pDis->rcItem.top,
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3601 ETO_OPAQUE, &pDis->rcItem,
a35b92556545 (w32_wnd_proc) [WM_MEASUREITEM, WM_DRAWITEM]: Handle
Jason Rumney <jasonr@gnu.org>
parents: 56856
diff changeset
3602 title, strlen (title), NULL);
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
3603
6a55bd8a85f8 (w32_wnd_proc) [WM_DRAW_ITEM]: Do not try to draw a null title.
Jason Rumney <jasonr@gnu.org>
parents: 29317
diff changeset
3604 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
3605 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
3606 }
21735
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3607 return TRUE;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3608 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3609 }
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3610 return 0;
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3611
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3612 #if 0
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3613 /* 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
3614 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
3615 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
3616 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
3617 case WM_MOUSEACTIVATE:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3618 /* 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
3619 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
3620 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
3621 if (LOWORD (lParam) == HTCLIENT )
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3622 return MA_ACTIVATEANDEAT;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3623 goto dflt;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3624 #endif
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3625
41732
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
3626 case WM_MOUSELEAVE:
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
3627 /* No longer tracking mouse. */
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
3628 track_mouse_window = NULL;
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
3629
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3630 case WM_ACTIVATEAPP:
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3631 case WM_ACTIVATE:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3632 case WM_WINDOWPOSCHANGED:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3633 case WM_SHOWWINDOW:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3634 /* 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
3635 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
3636 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
3637 goto dflt;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3638
14810
4dd6867765b9 (Vwin32_pass_alt_to_system,
Geoff Voelker <voelker@cs.washington.edu>
parents: 14461
diff changeset
3639 case WM_SETFOCUS:
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3640 dpyinfo->faked_key = 0;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
3641 reset_modifiers ();
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3642 register_hot_keys (hwnd);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3643 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
3644 case WM_KILLFOCUS:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3645 unregister_hot_keys (hwnd);
24751
e0eaca5025bc (w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents: 24718
diff changeset
3646 button_state = 0;
e0eaca5025bc (w32_wnd_proc): Ensure mouse capture is released if
Andrew Innes <andrewi@gnu.org>
parents: 24718
diff changeset
3647 ReleaseCapture ();
40385
b3dbd98f9b97 (w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents: 40120
diff changeset
3648 /* Relinquish the system caret. */
b3dbd98f9b97 (w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents: 40120
diff changeset
3649 if (w32_system_caret_hwnd)
b3dbd98f9b97 (w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents: 40120
diff changeset
3650 {
42918
9b06036a8c5e (syms_of_w32fns): Initialize w32_visible_system_caret_hwnd.
Jason Rumney <jasonr@gnu.org>
parents: 42865
diff changeset
3651 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
3652 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
3653 DestroyCaret ();
40385
b3dbd98f9b97 (w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents: 40120
diff changeset
3654 }
43472
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3655 goto command;
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3656 case WM_COMMAND:
76083
5e1d8f9b52ea * w32fns.c (menubar_in_use): New flag.
Jason Rumney <jasonr@gnu.org>
parents: 76078
diff changeset
3657 menubar_in_use = 0;
43472
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3658 f = x_window_to_frame (dpyinfo, hwnd);
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3659 if (f && HIWORD (wParam) == 0)
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3660 {
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3661 if (menu_free_timer)
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3662 {
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3663 KillTimer (hwnd, menu_free_timer);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3664 menu_free_timer = 0;
43472
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3665 }
7faac536665f (mouse_move_timer, mouse_button_timer): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 43398
diff changeset
3666 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3667 case WM_MOVE:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3668 case WM_SIZE:
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
3669 command:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3670 wmsg.dwModifiers = w32_get_modifiers ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3671 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3672 goto dflt;
15034
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
3673
78106
f9eb7f243bdc (w32_msg_pump) <WM_EMACS_CREATEWINDOW>: Initialize COM.
Jason Rumney <jasonr@gnu.org>
parents: 77995
diff changeset
3674 case WM_DESTROY:
f9eb7f243bdc (w32_msg_pump) <WM_EMACS_CREATEWINDOW>: Initialize COM.
Jason Rumney <jasonr@gnu.org>
parents: 77995
diff changeset
3675 CoUninitialize ();
f9eb7f243bdc (w32_msg_pump) <WM_EMACS_CREATEWINDOW>: Initialize COM.
Jason Rumney <jasonr@gnu.org>
parents: 77995
diff changeset
3676 return 0;
f9eb7f243bdc (w32_msg_pump) <WM_EMACS_CREATEWINDOW>: Initialize COM.
Jason Rumney <jasonr@gnu.org>
parents: 77995
diff changeset
3677
15034
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
3678 case WM_CLOSE:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3679 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
3680 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
3681 return 0;
fb947ec168a8 (defined_color): Map color to nearest in default palette.
Richard M. Stallman <rms@gnu.org>
parents: 14983
diff changeset
3682
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3683 case WM_WINDOWPOSCHANGING:
41448
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
3684 /* 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
3685 if (hwnd == tip_window)
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
3686 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3687 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3688 WINDOWPLACEMENT wp;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3689 LPWINDOWPOS lppos = (WINDOWPOS *) lParam;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3690
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3691 wp.length = sizeof (WINDOWPLACEMENT);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3692 GetWindowPlacement (hwnd, &wp);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3693
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3694 if (wp.showCmd != SW_SHOWMINIMIZED && (lppos->flags & SWP_NOSIZE) == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3695 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3696 RECT rect;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3697 int wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3698 int hdiff;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3699 DWORD font_width;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3700 DWORD line_height;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3701 DWORD internal_border;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3702 DWORD scrollbar_extra;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3703 RECT wr;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3704
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3705 wp.length = sizeof(wp);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3706 GetWindowRect (hwnd, &wr);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3707
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3708 enter_crit ();
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3709
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3710 font_width = GetWindowLong (hwnd, WND_FONTWIDTH_INDEX);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3711 line_height = GetWindowLong (hwnd, WND_LINEHEIGHT_INDEX);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3712 internal_border = GetWindowLong (hwnd, WND_BORDER_INDEX);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3713 scrollbar_extra = GetWindowLong (hwnd, WND_SCROLLBAR_INDEX);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3714
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
3715 leave_crit ();
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3716
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3717 memset (&rect, 0, sizeof (rect));
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3718 AdjustWindowRect (&rect, GetWindowLong (hwnd, GWL_STYLE),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3719 GetMenu (hwnd) != NULL);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3720
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3721 /* 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
3722 multiples of the character cell dimensions. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3723 wdiff = (lppos->cx - (rect.right - rect.left)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3724 - 2 * internal_border - scrollbar_extra)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3725 % font_width;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3726 hdiff = (lppos->cy - (rect.bottom - rect.top)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3727 - 2 * internal_border)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3728 % line_height;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3729
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3730 if (wdiff || hdiff)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3731 {
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3732 /* For right/bottom sizing we can just fix the sizes.
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3733 However for top/left sizing we will need to fix the X
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3734 and Y positions as well. */
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3735
74618
69b307896f8b (w32_wnd_proc): Force non-tooltip frames to respect the minimum tracking size.
Juanma Barranquero <lekktu@gmail.com>
parents: 74350
diff changeset
3736 int cx_mintrack = GetSystemMetrics (SM_CXMINTRACK);
69b307896f8b (w32_wnd_proc): Force non-tooltip frames to respect the minimum tracking size.
Juanma Barranquero <lekktu@gmail.com>
parents: 74350
diff changeset
3737 int cy_mintrack = GetSystemMetrics (SM_CYMINTRACK);
69b307896f8b (w32_wnd_proc): Force non-tooltip frames to respect the minimum tracking size.
Juanma Barranquero <lekktu@gmail.com>
parents: 74350
diff changeset
3738
69b307896f8b (w32_wnd_proc): Force non-tooltip frames to respect the minimum tracking size.
Juanma Barranquero <lekktu@gmail.com>
parents: 74350
diff changeset
3739 lppos->cx = max (lppos->cx - wdiff, cx_mintrack);
69b307896f8b (w32_wnd_proc): Force non-tooltip frames to respect the minimum tracking size.
Juanma Barranquero <lekktu@gmail.com>
parents: 74350
diff changeset
3740 lppos->cy = max (lppos->cy - hdiff, cy_mintrack);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3741
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3742 if (wp.showCmd != SW_SHOWMAXIMIZED
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3743 && (lppos->flags & SWP_NOMOVE) == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3744 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3745 if (lppos->x != wr.left || lppos->y != wr.top)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3746 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3747 lppos->x += wdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3748 lppos->y += hdiff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3749 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3750 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3751 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3752 lppos->flags |= SWP_NOMOVE;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3753 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3754 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3755
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3756 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3757 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3758 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3759 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3760
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3761 goto dflt;
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3762
24479
3b2c3636bf0e (w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24412
diff changeset
3763 case WM_GETMINMAXINFO:
36080
743534626f73 (w32_wnd_proc) <WM_GETMINMAXINFO>: Allow resizing the
Andrew Innes <andrewi@gnu.org>
parents: 36000
diff changeset
3764 /* 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
3765 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
3766 ((LPMINMAXINFO) lParam)->ptMaxTrackSize.x = 32767;
743534626f73 (w32_wnd_proc) <WM_GETMINMAXINFO>: Allow resizing the
Andrew Innes <andrewi@gnu.org>
parents: 36000
diff changeset
3767 ((LPMINMAXINFO) lParam)->ptMaxTrackSize.y = 32767;
24479
3b2c3636bf0e (w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24412
diff changeset
3768 return 0;
3b2c3636bf0e (w32_wnd_proc): Handle WM_GETMINMAXINFO message.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24412
diff changeset
3769
49369
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
3770 case WM_SETCURSOR:
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
3771 if (LOWORD (lParam) == HTCLIENT)
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
3772 return 0;
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
3773
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
3774 goto dflt;
49494
07f0ea120d7d (init_external_image_libraries): Try alternate names for the jpeg dll.
Juanma Barranquero <lekktu@gmail.com>
parents: 49455
diff changeset
3775
49369
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
3776 case WM_EMACS_SETCURSOR:
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
3777 {
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
3778 Cursor cursor = (Cursor) wParam;
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
3779 if (cursor)
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
3780 SetCursor (cursor);
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
3781 return 0;
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
3782 }
49494
07f0ea120d7d (init_external_image_libraries): Try alternate names for the jpeg dll.
Juanma Barranquero <lekktu@gmail.com>
parents: 49455
diff changeset
3783
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3784 case WM_EMACS_CREATESCROLLBAR:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3785 return (LRESULT) w32_createscrollbar ((struct frame *) wParam,
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3786 (struct scroll_bar *) lParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3787
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3788 case WM_EMACS_SHOWWINDOW:
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3789 return ShowWindow ((HWND) wParam, (WPARAM) lParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3790
21608
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3791 case WM_EMACS_SETFOREGROUND:
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3792 {
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3793 HWND foreground_window;
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3794 DWORD foreground_thread, retval;
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3795
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3796 /* 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
3797 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
3798 pull the focus away from it. */
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3799 foreground_window = GetForegroundWindow ();
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3800 foreground_thread = GetWindowThreadProcessId (foreground_window, NULL);
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3801 if (!foreground_window
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3802 || foreground_thread == GetCurrentThreadId ()
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3803 || !AttachThreadInput (GetCurrentThreadId (),
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3804 foreground_thread, TRUE))
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3805 foreground_thread = 0;
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3806
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3807 retval = SetForegroundWindow ((HWND) wParam);
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3808
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3809 /* Detach from the previous foreground thread. */
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3810 if (foreground_thread)
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3811 AttachThreadInput (GetCurrentThreadId (),
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3812 foreground_thread, FALSE);
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3813
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3814 return retval;
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
3815 }
21608
d191a8737145 (w32_msg_pump): Handle WM_EMACS_SETLOCALE.
Geoff Voelker <voelker@cs.washington.edu>
parents: 19707
diff changeset
3816
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3817 case WM_EMACS_SETWINDOWPOS:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
3818 {
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3819 WINDOWPOS * pos = (WINDOWPOS *) wParam;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3820 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
3821 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
3822 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3823
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3824 case WM_EMACS_DESTROYWINDOW:
21884
bc4455bca454 Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21874
diff changeset
3825 DragAcceptFiles ((HWND) wParam, FALSE);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3826 return DestroyWindow ((HWND) wParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3827
42865
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3828 case WM_EMACS_HIDE_CARET:
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3829 return HideCaret (hwnd);
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3830
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3831 case WM_EMACS_SHOW_CARET:
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3832 return ShowCaret (hwnd);
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3833
40385
b3dbd98f9b97 (w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents: 40120
diff changeset
3834 case WM_EMACS_DESTROY_CARET:
b3dbd98f9b97 (w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents: 40120
diff changeset
3835 w32_system_caret_hwnd = NULL;
42865
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3836 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
3837 return DestroyCaret ();
b3dbd98f9b97 (w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents: 40120
diff changeset
3838
b3dbd98f9b97 (w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents: 40120
diff changeset
3839 case WM_EMACS_TRACK_CARET:
b3dbd98f9b97 (w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents: 40120
diff changeset
3840 /* 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
3841 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
3842 {
42865
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3843 /* 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
3844 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
3845 w32_system_caret_hwnd = hwnd;
42865
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3846 CreateCaret (hwnd, NULL, 0,
40385
b3dbd98f9b97 (w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents: 40120
diff changeset
3847 w32_system_caret_height);
b3dbd98f9b97 (w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents: 40120
diff changeset
3848 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3849
42865
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3850 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
3851 return 0;
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3852 /* 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
3853 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
3854 && w32_visible_system_caret_hwnd != hwnd)
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3855 {
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3856 w32_visible_system_caret_hwnd = hwnd;
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3857 return ShowCaret (hwnd);
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3858 }
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3859 /* 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
3860 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
3861 && w32_visible_system_caret_hwnd)
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3862 {
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3863 w32_visible_system_caret_hwnd = NULL;
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3864 return HideCaret (hwnd);
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3865 }
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3866 else
40d08b8571ec (w32_visible_system_caret_hwnd): New static variable.
Jason Rumney <jasonr@gnu.org>
parents: 42845
diff changeset
3867 return 1;
40385
b3dbd98f9b97 (w32_wnd_proc) <WM_KILLFOCUS>: Destroy the system caret.
Jason Rumney <jasonr@gnu.org>
parents: 40120
diff changeset
3868
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3869 case WM_EMACS_TRACKPOPUPMENU:
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3870 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3871 UINT flags;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3872 POINT *pos;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3873 int retval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3874 pos = (POINT *)lParam;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3875 flags = TPM_CENTERALIGN;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3876 if (button_state & LMOUSE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3877 flags |= TPM_LEFTBUTTON;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3878 else if (button_state & RMOUSE)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3879 flags |= TPM_RIGHTBUTTON;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3880
21735
711a61942023 (x_set_vertical_scroll_bars): Put scroll bars on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 21608
diff changeset
3881 /* 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
3882 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
3883 ReleaseCapture ();
23160
95a213639589 (w32_wnd_proc): Always zero button_state when releasing
Geoff Voelker <voelker@cs.washington.edu>
parents: 22625
diff changeset
3884 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
3885
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3886 /* 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
3887 TrackPopupMenu below, and should be ignored. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3888 f = x_window_to_frame (dpyinfo, hwnd);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3889 if (f)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3890 f->output_data.w32->menubar_active = 1;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3891
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3892 if (TrackPopupMenu ((HMENU)wParam, flags, pos->x, pos->y,
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3893 0, hwnd, NULL))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3894 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3895 MSG amsg;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3896 /* Eat any mouse messages during popupmenu */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3897 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
3898 PM_REMOVE));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3899 /* Get the menu selection, if any */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3900 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
3901 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3902 retval = LOWORD (amsg.wParam);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3903 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3904 else
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3905 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3906 retval = 0;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3907 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3908 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3909 else
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3910 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3911 retval = -1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3912 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3913
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3914 return retval;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3915 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3916
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3917 default:
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3918 /* Check for messages registered at runtime. */
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3919 if (msg == msh_mousewheel)
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3920 {
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3921 wmsg.dwModifiers = w32_get_modifiers ();
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3922 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
69426
46a8c3e0161d (signal_user_input): New function.
Jason Rumney <jasonr@gnu.org>
parents: 69406
diff changeset
3923 signal_user_input ();
21874
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3924 return 0;
c0871d40073e (msh_mousewheel): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21735
diff changeset
3925 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3926
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3927 dflt:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3928 return DefWindowProc (hwnd, msg, wParam, lParam);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3929 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
3930
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3931
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3932 /* 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
3933 return 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3934 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3935
64662
605f42af1c34 (my_set_window_pos, my_show_window): Don't declare.
Juanma Barranquero <lekktu@gmail.com>
parents: 64487
diff changeset
3936 static void
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3937 my_create_window (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3938 struct frame * f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3939 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3940 MSG msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3941
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
3942 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
3943 abort ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3944 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3945 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3946
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3947
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3948 /* 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
3949 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
3950 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
3951 deadlocks when tooltips are created for menu items. */
64662
605f42af1c34 (my_set_window_pos, my_show_window): Don't declare.
Juanma Barranquero <lekktu@gmail.com>
parents: 64487
diff changeset
3952 static void
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3953 my_create_tip_window (f)
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3954 struct frame *f;
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3955 {
41448
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
3956 RECT rect;
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
3957
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
3958 rect.left = rect.top = 0;
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
3959 rect.right = FRAME_PIXEL_WIDTH (f);
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
3960 rect.bottom = FRAME_PIXEL_HEIGHT (f);
41448
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
3961
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
3962 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
3963 FRAME_EXTERNAL_MENU_BAR (f));
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
3964
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
3965 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
3966 = CreateWindow (EMACS_CLASS,
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3967 f->namebuf,
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3968 f->output_data.w32->dwStyle,
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
3969 f->left_pos,
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
3970 f->top_pos,
41448
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
3971 rect.right - rect.left,
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
3972 rect.bottom - rect.top,
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3973 FRAME_W32_WINDOW (SELECTED_FRAME ()), /* owner */
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3974 NULL,
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3975 hinst,
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3976 NULL);
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3977
41448
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
3978 if (tip_window)
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
3979 {
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
3980 SetWindowLong (tip_window, WND_FONTWIDTH_INDEX, FRAME_COLUMN_WIDTH (f));
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
3981 SetWindowLong (tip_window, WND_LINEHEIGHT_INDEX, FRAME_LINE_HEIGHT (f));
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
3982 SetWindowLong (tip_window, WND_BORDER_INDEX, FRAME_INTERNAL_BORDER_WIDTH (f));
41448
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
3983 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
3984
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
3985 /* Tip frames have no scrollbars. */
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
3986 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
3987
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3988 /* 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
3989 ShowWindow (tip_window, SW_HIDE);
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3990 }
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3991 }
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3992
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
3993
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3994 /* Create and set up the w32 window for frame F. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3995
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3996 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
3997 w32_window (f, window_prompting, minibuffer_only)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3998 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3999 long window_prompting;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4000 int minibuffer_only;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4001 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4002 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4003
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4004 /* Use the resource name as the top-level window name
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4005 for looking up resources. Make a non-Lisp copy
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4006 for the window manager, so GC relocation won't bother it.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4007
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4008 Elsewhere we specify the window name for the window manager. */
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
4009
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4010 {
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
4011 char *str = (char *) SDATA (Vx_resource_name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4012 f->namebuf = (char *) xmalloc (strlen (str) + 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4013 strcpy (f->namebuf, str);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4014 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4015
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4016 my_create_window (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4017
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4018 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4019
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4020 /* x_set_name normally ignores requests to set the name if the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4021 requested name is the same as the current name. This is the one
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4022 place where that assumption isn't correct; f->name is set, but
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4023 the server hasn't been told. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4024 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4025 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4026 int explicit = f->explicit_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4027
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4028 f->explicit_name = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4029 name = f->name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4030 f->name = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4031 x_set_name (f, name, explicit);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4032 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4033
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4034 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4035
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4036 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4037 initialize_frame_menubar (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4038
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4039 if (FRAME_W32_WINDOW (f) == 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4040 error ("Unable to create window");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4041 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4042
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4043 /* Handle the icon stuff for this window. Perhaps later we might
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4044 want an x_set_icon_position which can be called interactively as
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4045 well. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4046
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4047 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4048 x_icon (f, parms)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4049 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4050 Lisp_Object parms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4051 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4052 Lisp_Object icon_x, icon_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4053
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16602
diff changeset
4054 /* Set the position of the icon. Note that Windows 95 groups all
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4055 icons in the tray. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4056 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
4057 icon_y = w32_get_arg (parms, Qicon_top, 0, 0, RES_TYPE_NUMBER);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4058 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4059 {
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
4060 CHECK_NUMBER (icon_x);
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
4061 CHECK_NUMBER (icon_y);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4062 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4063 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4064 error ("Both left and top icon corners of icon must be specified");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4065
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4066 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4067
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4068 if (! EQ (icon_x, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4069 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4070
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4071 #if 0 /* TODO */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4072 /* Start up iconic or window? */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4073 x_wm_set_window_state
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4074 (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
4075 ? IconicState
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4076 : NormalState));
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4077
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
4078 x_text_icon (f, (char *) SDATA ((!NILP (f->icon_name)
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4079 ? f->icon_name
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
4080 : f->name)));
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4081 #endif
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4082
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4083 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4084 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4085
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4086
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4087 static void
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4088 x_make_gc (f)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4089 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4090 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4091 XGCValues gc_values;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4092
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4093 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4094
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4095 /* Create the GC's of this frame.
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4096 Note that many default values are used. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4097
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4098 /* Normal video */
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
4099 gc_values.font = FRAME_FONT (f);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4100
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4101 /* 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
4102 gc_values.foreground = FRAME_BACKGROUND_PIXEL (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4103 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
4104 f->output_data.w32->cursor_gc
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4105 = XCreateGC (NULL, FRAME_W32_WINDOW (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4106 (GCFont | GCForeground | GCBackground),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4107 &gc_values);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4108
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4109 /* Reliefs. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4110 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
4111 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
4112
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4113 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4114 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4115
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4116
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4117 /* 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
4118 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
4119 constructed. */
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4120
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4121 static Lisp_Object
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4122 unwind_create_frame (frame)
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4123 Lisp_Object frame;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4124 {
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4125 struct frame *f = XFRAME (frame);
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4126
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4127 /* 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
4128 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
4129 {
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4130 #ifdef GLYPH_DEBUG
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4131 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
4132 #endif
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
4133
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4134 x_free_frame_resources (f);
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4135
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4136 /* 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
4137 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
4138 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
4139
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
4140 return Qt;
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4141 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
4142
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4143 return Qnil;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4144 }
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4145
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4146
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4147 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4148 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
4149 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
4150 Returns an Emacs frame object.
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4151 PARAMETERS is an alist of frame parameters.
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
4152 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
4153 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
4154 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
4155 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
4156
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
4157 This function is an internal primitive--use `make-frame' instead. */)
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4158 (parameters)
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4159 Lisp_Object parameters;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4160 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4161 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4162 Lisp_Object frame, tem;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4163 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4164 int minibuffer_only = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4165 long window_prompting = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4166 int width, height;
46285
3f111801efb4 Rename BINDING_STACK_SIZE to SPECPDL_INDEX.
Juanma Barranquero <lekktu@gmail.com>
parents: 46272
diff changeset
4167 int count = SPECPDL_INDEX ();
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4168 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4169 Lisp_Object display;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4170 struct w32_display_info *dpyinfo = NULL;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4171 Lisp_Object parent;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4172 struct kboard *kb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4173
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4174 check_w32 ();
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4175
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4176 /* Use this general default value to start with
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4177 until we know if this frame has a specified name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4178 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4179
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4180 display = w32_get_arg (parameters, Qdisplay, 0, 0, RES_TYPE_STRING);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4181 if (EQ (display, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4182 display = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4183 dpyinfo = check_x_display_info (display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4184 #ifdef MULTI_KBOARD
83619
5da6a46ddbd6 * s/darwin.h (SYSTEM_PURESIZE_EXTRA): Define here.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83618
diff changeset
4185 kb = dpyinfo->terminal->kboard;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4186 #else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4187 kb = &the_only_kboard;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4188 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4189
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4190 name = w32_get_arg (parameters, Qname, "name", "Name", RES_TYPE_STRING);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4191 if (!STRINGP (name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4192 && ! EQ (name, Qunbound)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4193 && ! NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4194 error ("Invalid frame name--not a string or nil");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4195
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4196 if (STRINGP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4197 Vx_resource_name = name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4198
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4199 /* See if parent window is specified. */
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4200 parent = w32_get_arg (parameters, Qparent_id, NULL, NULL, RES_TYPE_NUMBER);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4201 if (EQ (parent, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4202 parent = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4203 if (! NILP (parent))
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
4204 CHECK_NUMBER (parent);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4205
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4206 /* 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
4207 /* 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
4208 it to make_frame_without_minibuffer. */
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4209 frame = Qnil;
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4210 GCPRO4 (parameters, parent, name, frame);
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4211 tem = w32_get_arg (parameters, Qminibuffer, "minibuffer", "Minibuffer",
32669
092d2df2a6c3 (Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents: 31110
diff changeset
4212 RES_TYPE_SYMBOL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4213 if (EQ (tem, Qnone) || NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4214 f = make_frame_without_minibuffer (Qnil, kb, display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4215 else if (EQ (tem, Qonly))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4216 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4217 f = make_minibuffer_frame ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4218 minibuffer_only = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4219 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4220 else if (WINDOWP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4221 f = make_frame_without_minibuffer (tem, kb, display);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4222 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4223 f = make_frame (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4224
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4225 XSETFRAME (frame, f);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4226
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4227 /* Note that Windows does support scroll bars. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4228 FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
50362
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
4229
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4230 /* By default, make scrollbars the system standard width. */
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
4231 FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = GetSystemMetrics (SM_CXVSCROLL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4232
83571
ca1c27e2707e (x_set_tool_bar_lines): Don't use updating_frame.
Jason Rumney <jasonr@gnu.org>
parents: 76700
diff changeset
4233 f->terminal = dpyinfo->terminal;
ca1c27e2707e (x_set_tool_bar_lines): Don't use updating_frame.
Jason Rumney <jasonr@gnu.org>
parents: 76700
diff changeset
4234 f->terminal->reference_count++;
ca1c27e2707e (x_set_tool_bar_lines): Don't use updating_frame.
Jason Rumney <jasonr@gnu.org>
parents: 76700
diff changeset
4235
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4236 f->output_method = output_w32;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4237 f->output_data.w32 =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4238 (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
4239 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
4240 FRAME_FONTSET (f) = -1;
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
4241 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
4242
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4243 f->icon_name
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4244 = w32_get_arg (parameters, 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
4245 if (! STRINGP (f->icon_name))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4246 f->icon_name = Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4247
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4248 /* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4249 #ifdef MULTI_KBOARD
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4250 FRAME_KBOARD (f) = kb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4251 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4252
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4253 /* Specify the parent under which to make this window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4254
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4255 if (!NILP (parent))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4256 {
32669
092d2df2a6c3 (Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents: 31110
diff changeset
4257 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
4258 f->output_data.w32->explicit_parent = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4259 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4260 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4261 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4262 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
4263 f->output_data.w32->explicit_parent = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4264 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4265
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4266 /* Set the name; the functions to which we pass f expect the name to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4267 be set. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4268 if (EQ (name, Qunbound) || NILP (name))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4269 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4270 f->name = build_string (dpyinfo->w32_id_name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4271 f->explicit_name = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4272 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4273 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4274 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4275 f->name = name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4276 f->explicit_name = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4277 /* use the frame's title when getting resources for this frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4278 specbind (Qx_resource_name, name);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4279 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4280
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4281 /* Extract the window parameters from the supplied values
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4282 that are needed to determine window geometry. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4283 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4284 Lisp_Object font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4285
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4286 font = w32_get_arg (parameters, Qfont, "font", "Font", RES_TYPE_STRING);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4287
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4288 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4289 /* First, try whatever font the caller has specified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4290 if (STRINGP (font))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4291 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4292 tem = Fquery_fontset (font, Qnil);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4293 if (STRINGP (tem))
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
4294 font = x_new_fontset (f, SDATA (tem));
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4295 else
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
4296 font = x_new_font (f, SDATA (font));
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4297 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4298 /* Try out a font which we hope has bold and italic variations. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4299 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
4300 font = x_new_font (f, "-*-Courier New-normal-r-*-*-*-100-*-*-c-*-iso8859-1");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4301 if (! STRINGP (font))
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4302 font = x_new_font (f, "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4303 /* If those didn't work, look for something which will at least work. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4304 if (! STRINGP (font))
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4305 font = x_new_font (f, "-*-Fixedsys-normal-r-*-*-12-*-*-*-c-*-iso8859-1");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4306 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4307 if (! STRINGP (font))
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4308 font = build_string ("Fixedsys");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4309
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4310 x_default_parameter (f, parameters, Qfont, font,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4311 "font", "Font", RES_TYPE_STRING);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4312 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4313
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4314 x_default_parameter (f, parameters, Qborder_width, make_number (2),
32669
092d2df2a6c3 (Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents: 31110
diff changeset
4315 "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4316 /* This defaults to 2 in order to match xterm. We recognize either
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4317 internalBorderWidth or internalBorder (which is what xterm calls
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4318 it). */
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4319 if (NILP (Fassq (Qinternal_border_width, parameters)))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4320 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4321 Lisp_Object value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4322
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4323 value = w32_get_arg (parameters, Qinternal_border_width,
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4324 "internalBorder", "InternalBorder", RES_TYPE_NUMBER);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4325 if (! EQ (value, Qunbound))
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4326 parameters = Fcons (Fcons (Qinternal_border_width, value),
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4327 parameters);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4328 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4329 /* Default internalBorderWidth to 0 on Windows to match other programs. */
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4330 x_default_parameter (f, parameters, Qinternal_border_width, make_number (0),
32669
092d2df2a6c3 (Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents: 31110
diff changeset
4331 "internalBorderWidth", "InternalBorder", RES_TYPE_NUMBER);
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4332 x_default_parameter (f, parameters, Qvertical_scroll_bars, Qright,
32669
092d2df2a6c3 (Fx_create_frame): Don't bother calling
Jason Rumney <jasonr@gnu.org>
parents: 31110
diff changeset
4333 "verticalScrollBars", "ScrollBars", RES_TYPE_SYMBOL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4334
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4335 /* Also do the stuff which must be set before the window exists. */
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4336 x_default_parameter (f, parameters, Qforeground_color, build_string ("black"),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4337 "foreground", "Foreground", RES_TYPE_STRING);
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4338 x_default_parameter (f, parameters, Qbackground_color, build_string ("white"),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4339 "background", "Background", RES_TYPE_STRING);
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4340 x_default_parameter (f, parameters, Qmouse_color, build_string ("black"),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4341 "pointerColor", "Foreground", RES_TYPE_STRING);
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4342 x_default_parameter (f, parameters, Qcursor_color, build_string ("black"),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4343 "cursorColor", "Foreground", RES_TYPE_STRING);
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4344 x_default_parameter (f, parameters, Qborder_color, build_string ("black"),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4345 "borderColor", "BorderColor", RES_TYPE_STRING);
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4346 x_default_parameter (f, parameters, Qscreen_gamma, Qnil,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4347 "screenGamma", "ScreenGamma", RES_TYPE_FLOAT);
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4348 x_default_parameter (f, parameters, Qline_spacing, Qnil,
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4349 "lineSpacing", "LineSpacing", RES_TYPE_NUMBER);
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4350 x_default_parameter (f, parameters, Qleft_fringe, Qnil,
41726
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41638
diff changeset
4351 "leftFringe", "LeftFringe", RES_TYPE_NUMBER);
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4352 x_default_parameter (f, parameters, Qright_fringe, Qnil,
41726
2dd41afd9b55 Merged fringe width related changes from xfns.c.
Kim F. Storm <storm@cua.dk>
parents: 41638
diff changeset
4353 "rightFringe", "RightFringe", RES_TYPE_NUMBER);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4354
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4355
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4356 /* 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
4357 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
4358 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
4359 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
4360 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
4361 happen. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4362 init_frame_faces (f);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
4363
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4364 x_default_parameter (f, parameters, Qmenu_bar_lines, make_number (1),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4365 "menuBar", "MenuBar", RES_TYPE_NUMBER);
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4366 x_default_parameter (f, parameters, Qtool_bar_lines, make_number (1),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4367 "toolBar", "ToolBar", RES_TYPE_NUMBER);
44109
b615e4daf825 [HAVE_IMAGES, HAVE_PBM]: Remove conditionals.
Jason Rumney <jasonr@gnu.org>
parents: 44097
diff changeset
4368
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4369 x_default_parameter (f, parameters, Qbuffer_predicate, Qnil,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4370 "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL);
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4371 x_default_parameter (f, parameters, Qtitle, Qnil,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4372 "title", "Title", RES_TYPE_STRING);
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4373 x_default_parameter (f, parameters, Qfullscreen, Qnil,
43398
8782b8cfed62 *** empty log message ***
Jason Rumney <jasonr@gnu.org>
parents: 43210
diff changeset
4374 "fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4375
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4376 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
4377 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
4378
49369
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
4379 f->output_data.w32->text_cursor = w32_load_cursor (IDC_IBEAM);
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
4380 f->output_data.w32->nontext_cursor = w32_load_cursor (IDC_ARROW);
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
4381 f->output_data.w32->modeline_cursor = w32_load_cursor (IDC_ARROW);
50229
e3a41ffa1cba Remove setup of cross_cursor (already has hand_cursor).
Kim F. Storm <storm@cua.dk>
parents: 50164
diff changeset
4382 f->output_data.w32->hand_cursor = w32_load_cursor (IDC_HAND);
49369
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
4383 f->output_data.w32->hourglass_cursor = w32_load_cursor (IDC_WAIT);
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
4384 f->output_data.w32->horizontal_drag_cursor = w32_load_cursor (IDC_SIZEWE);
5518e109ec3b 2003-01-21 Jason Rumney <jasonr@gnu.org>
Jason Rumney <jasonr@gnu.org>
parents: 49079
diff changeset
4385
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4386 window_prompting = x_figure_window_size (f, parameters, 1);
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4387
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4388 tem = w32_get_arg (parameters, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4389 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
4390
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4391 w32_window (f, window_prompting, minibuffer_only);
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4392 x_icon (f, parameters);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4393
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4394 x_make_gc (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4395
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4396 /* Now consider the frame official. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4397 FRAME_W32_DISPLAY_INFO (f)->reference_count++;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4398 Vframe_list = Fcons (frame, Vframe_list);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4399
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4400 /* We need to do this after creating the window, so that the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4401 icon-creation functions can say whose icon they're describing. */
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4402 x_default_parameter (f, parameters, Qicon_type, Qnil,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4403 "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4404
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4405 x_default_parameter (f, parameters, Qauto_raise, Qnil,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4406 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN);
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4407 x_default_parameter (f, parameters, Qauto_lower, Qnil,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4408 "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN);
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4409 x_default_parameter (f, parameters, Qcursor_type, Qbox,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4410 "cursorType", "CursorType", RES_TYPE_SYMBOL);
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4411 x_default_parameter (f, parameters, Qscroll_bar_width, Qnil,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4412 "scrollBarWidth", "ScrollBarWidth", RES_TYPE_NUMBER);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4413
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
4414 /* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4415 Change will not be effected unless different from the current
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
4416 FRAME_LINES (f). */
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
4417 width = FRAME_COLS (f);
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
4418 height = FRAME_LINES (f);
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
4419
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
4420 FRAME_LINES (f) = 0;
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
4421 SET_FRAME_COLS (f, 0);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4422 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
4423
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4424 /* 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
4425 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
4426 bar so that its size can be taken into account. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4427 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4428 x_wm_set_size_hint (f, window_prompting, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4429 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4430
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4431 /* 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
4432 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
4433 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
4434 if (! f->output_data.w32->explicit_parent)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4435 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4436 Lisp_Object visibility;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4437
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
4438 visibility = w32_get_arg (parameters, Qvisibility, 0, 0, RES_TYPE_SYMBOL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4439 if (EQ (visibility, Qunbound))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4440 visibility = Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4441
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4442 if (EQ (visibility, Qicon))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4443 x_iconify_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4444 else if (! NILP (visibility))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4445 x_make_frame_visible (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4446 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4447 /* Must have been Qnil. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4448 ;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4449 }
83616
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83608
diff changeset
4450
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83608
diff changeset
4451 /* Initialize `default-minibuffer-frame' in case this is the first
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83608
diff changeset
4452 frame on this terminal. */
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83608
diff changeset
4453 if (FRAME_HAS_MINIBUF_P (f)
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83608
diff changeset
4454 && (!FRAMEP (kb->Vdefault_minibuffer_frame)
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83608
diff changeset
4455 || !FRAME_LIVE_P (XFRAME (kb->Vdefault_minibuffer_frame))))
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83608
diff changeset
4456 kb->Vdefault_minibuffer_frame = frame;
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83608
diff changeset
4457
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83608
diff changeset
4458 /* All remaining specified parameters, which have not been "used"
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83608
diff changeset
4459 by x_get_arg and friends, now go in the misc. alist of the frame. */
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83608
diff changeset
4460 for (tem = parameters; !NILP (tem); tem = XCDR (tem))
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83608
diff changeset
4461 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83608
diff changeset
4462 f->param_alist = Fcons (XCAR (tem), f->param_alist);
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83608
diff changeset
4463
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83608
diff changeset
4464 store_frame_param (f, Qwindow_system, Qw32);
b78afd4acd43 * term.c (init_tty): Better initialize ttys in windows.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 83608
diff changeset
4465
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4466 UNGCPRO;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
4467
36594
756c28377036 (Fx_create_frame): Clear Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents: 36312
diff changeset
4468 /* 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
4469 and similar functions. */
756c28377036 (Fx_create_frame): Clear Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents: 36312
diff changeset
4470 Vwindow_list = Qnil;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
4471
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4472 return unbind_to (count, frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4473 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4474
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4475 /* FRAME is used only to get a handle on the X display. We don't pass the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4476 display info directly because we're called from frame.c, which doesn't
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4477 know about that structure. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4478 Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4479 x_get_focus_frame (frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4480 struct frame *frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4481 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4482 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4483 Lisp_Object xfocus;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4484 if (! dpyinfo->w32_focus_frame)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4485 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4486
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4487 XSETFRAME (xfocus, dpyinfo->w32_focus_frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4488 return xfocus;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4489 }
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4490
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4491 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
4492 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
4493 (frame)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4494 Lisp_Object frame;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4495 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4496 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
4497 return Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4498 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
4499
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4500
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4501 /* 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
4502 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
4503 {
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4504 char *charset, *encoding;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4505
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4506 encoding = strrchr(fontname, '-');
34284
3a21ff35392b (xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents: 34133
diff changeset
4507 if (!encoding || encoding == fontname)
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4508 return NULL;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4509
34314
8318a4ea6764 (xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents: 34284
diff changeset
4510 for (charset = encoding - 1; charset >= fontname; charset--)
8318a4ea6764 (xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents: 34284
diff changeset
4511 if (*charset == '-')
8318a4ea6764 (xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents: 34284
diff changeset
4512 break;
8318a4ea6764 (xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents: 34284
diff changeset
4513
8318a4ea6764 (xlfd_charset_of_font): Fix last change.
Andrew Innes <andrewi@gnu.org>
parents: 34284
diff changeset
4514 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
4515 return NULL;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4516
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4517 return charset + 1;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4518 }
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4519
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4520 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
4521 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
4522 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
4523 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
4524 char * charset);
6bc1c4d4eb50 (w32_to_x_font): Change prototype to fit the declaration.
Eli Zaretskii <eliz@gnu.org>
parents: 36594
diff changeset
4525 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
4526
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
4527 static struct font_info *
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4528 w32_load_system_font (f,fontname,size)
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4529 struct frame *f;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4530 char * fontname;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
4531 int size;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4532 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4533 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
4534 Lisp_Object font_names;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4535
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4536 /* 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
4537 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
4538 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
4539 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
4540
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4541 if (!NILP (font_names))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4542 {
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4543 Lisp_Object tail;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4544 int i;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4545
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4546 /* 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
4547 than loading another one. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4548 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
4549 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
4550 if (dpyinfo->font_table[i].name
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4551 && (!strcmp (dpyinfo->font_table[i].name,
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
4552 SDATA (XCAR (tail)))
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4553 || !strcmp (dpyinfo->font_table[i].full_name,
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
4554 SDATA (XCAR (tail)))))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4555 return (dpyinfo->font_table + i);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4556
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
4557 fontname = (char *) SDATA (XCAR (font_names));
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4558 }
24481
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
4559 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
4560 {
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
4561 /* 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
4562 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
4563 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
4564 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
4565 listed or not. */
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
4566 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
4567 FARPROC enum_font_families_ex
24481
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
4568 = 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
4569 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
4570 return NULL;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
4571 }
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4572
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4573 /* 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
4574 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4575 char *full_name, *encoding, *charset;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4576 XFontStruct *font;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4577 struct font_info *fontp;
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4578 LOGFONT lf;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4579 BOOL ok;
40009
f6ecf530f0a3 (w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
4580 int codepage;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4581 int i;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4582
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4583 if (!fontname || !x_to_w32_font (fontname, &lf))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4584 return (NULL);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4585
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4586 if (!*lf.lfFaceName)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4587 /* 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
4588 from CreateFontIndirect - this is not particularly
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4589 desirable, especially since CreateFontIndirect does not
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4590 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
4591 ended up with. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4592 return NULL;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4593
48359
1e8497bc057d (w32_load_system_font): Don't disable Cleartype.
Jason Rumney <jasonr@gnu.org>
parents: 48351
diff changeset
4594 lf.lfQuality = DEFAULT_QUALITY;
43210
3df71b933c36 (w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents: 43207
diff changeset
4595
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4596 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
4597 bzero (font, sizeof (*font));
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4598
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4599 /* 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
4600 font->bdf = NULL;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4601
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4602 BLOCK_INPUT;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4603
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4604 font->hfont = CreateFontIndirect (&lf);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4605
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
4606 if (font->hfont == NULL)
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4607 {
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4608 ok = FALSE;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
4609 }
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
4610 else
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4611 {
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4612 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
4613 HANDLE oldobj;
40009
f6ecf530f0a3 (w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
4614
f6ecf530f0a3 (w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
4615 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
4616
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4617 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
4618 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
4619
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4620 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
4621 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
4622 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
4623 else
39548
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4624 {
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4625 /* 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
4626 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
4627 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
4628 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
4629 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
4630 working from anyway. */
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4631 /* 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
4632 CPINFO cpi = {0};
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4633 GetCPInfo (codepage, &cpi);
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4634 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
4635 }
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
4636
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4637 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
4638 ReleaseDC (dpyinfo->root_window, hdc);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4639 /* 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
4640 actually loaded. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4641 lf.lfHeight = font->tm.tmInternalLeading - font->tm.tmHeight;
59333
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4642 lf.lfWidth = font->tm.tmMaxCharWidth;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4643 lf.lfWeight = font->tm.tmWeight;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4644 lf.lfItalic = font->tm.tmItalic;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4645 lf.lfCharSet = font->tm.tmCharSet;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4646 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
4647 ? VARIABLE_PITCH : FIXED_PITCH);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4648 lf.lfOutPrecision = ((font->tm.tmPitchAndFamily & TMPF_VECTOR)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4649 ? 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
4650
0574ffc14f77 (w32_load_system_font): Call w32_cache_char_metrics.
Andrew Innes <andrewi@gnu.org>
parents: 32669
diff changeset
4651 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
4652 }
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4653
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4654 UNBLOCK_INPUT;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4655
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4656 if (!ok)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4657 {
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
4658 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
4659 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
4660 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4661
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4662 /* 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
4663 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
4664 if (dpyinfo->font_table[i].name == NULL)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4665 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4666
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4667 /* 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
4668 if (i == dpyinfo->n_fonts
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4669 && 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
4670 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4671 int sz;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4672 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
4673 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
4674 dpyinfo->font_table
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4675 = (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
4676 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4677
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4678 fontp = dpyinfo->font_table + i;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4679 if (i == dpyinfo->n_fonts)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4680 ++dpyinfo->n_fonts;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4681
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4682 /* 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
4683 BLOCK_INPUT;
52737
6685d28af4a7 * w32fns.c (w32_load_system_font): Clear all members of FONTP before
Jason Rumney <jasonr@gnu.org>
parents: 52401
diff changeset
4684 bzero (fontp, sizeof (*fontp));
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4685 fontp->font = font;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4686 fontp->font_idx = i;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4687 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
4688 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
4689
59333
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4690 if (lf.lfPitchAndFamily == FIXED_PITCH)
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4691 {
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4692 /* Fixed width font. */
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4693 fontp->average_width = fontp->space_width = FONT_WIDTH (font);
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4694 }
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4695 else
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4696 {
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4697 wchar_t space = 32;
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4698 XCharStruct* pcm;
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4699 pcm = w32_per_char_metric (font, &space, ANSI_FONT);
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4700 if (pcm)
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4701 fontp->space_width = pcm->width;
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4702 else
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4703 fontp->space_width = FONT_WIDTH (font);
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4704
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4705 fontp->average_width = font->tm.tmAveCharWidth;
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4706 }
f23a47fb1568 (w32_load_system_font): Set FONT_WIDTH to maximum, not
Jason Rumney <jasonr@gnu.org>
parents: 57872
diff changeset
4707
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4708 charset = xlfd_charset_of_font (fontname);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4709
40009
f6ecf530f0a3 (w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
4710 /* 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
4711 (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
4712 fontp->codepage = codepage;
f6ecf530f0a3 (w32_load_system_font): Cache codepage for font, in
Andrew Innes <andrewi@gnu.org>
parents: 39973
diff changeset
4713
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4714 /* 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
4715 full_name = (char *)xmalloc (100);
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4716 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
4717 fontp->full_name = full_name;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4718 else
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4719 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4720 /* 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
4721 xfree (full_name);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4722 fontp->full_name = fontp->name;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4723 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4724
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4725 fontp->size = FONT_WIDTH (font);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4726 fontp->height = FONT_HEIGHT (font);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4727
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4728 /* 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
4729 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
4730 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
4731 (0:0x20..0x7F, 1:0xA0..0xFF,
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
4732 (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
4733 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
4734 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
4735 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
4736 decided, set FONT_ENCODING_NOT_DECIDED. */
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4737
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4738 /* 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
4739 type FONT_ENCODING_NOT_DECIDED. */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4740 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
4741 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
4742 fontp->encoding[1] = 4;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4743 else
24692
a0a2521b783d (x_to_w32_charset): Fix typo: want to map all Japanese
Andrew Innes <andrewi@gnu.org>
parents: 24679
diff changeset
4744 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
4745
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4746 /* 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
4747 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
4748 fontp->baseline_offset = 0;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4749 fontp->relative_compose = 0;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4750 fontp->default_ascent = 0;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4751
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
4752 /* 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
4753 has a character with a smaller width than any other character
43398
8782b8cfed62 *** empty log message ***
Jason Rumney <jasonr@gnu.org>
parents: 43210
diff changeset
4754 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
4755 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
4756 glyph matrix reallocation necessary. */
43398
8782b8cfed62 *** empty log message ***
Jason Rumney <jasonr@gnu.org>
parents: 43210
diff changeset
4757 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
4758 UNBLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4759 return fontp;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4760 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4761 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
4762
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4763 /* 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
4764 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
4765 If loading fails, return NULL. */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4766 struct font_info *
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4767 w32_load_font (f,fontname,size)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4768 struct frame *f;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4769 char * fontname;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4770 int size;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4771 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4772 Lisp_Object bdf_fonts;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4773 struct font_info *retval = NULL;
56855
650b7ca40098 2004-08-31 NAKAMURA Toshikazu <nr-tkz@nifty.com> (tiny change)
Jason Rumney <jasonr@gnu.org>
parents: 56480
diff changeset
4774 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4775
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
4776 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
4777
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4778 while (!retval && CONSP (bdf_fonts))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4779 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4780 char *bdf_name, *bdf_file;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4781 Lisp_Object bdf_pair;
56855
650b7ca40098 2004-08-31 NAKAMURA Toshikazu <nr-tkz@nifty.com> (tiny change)
Jason Rumney <jasonr@gnu.org>
parents: 56480
diff changeset
4782 int i;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4783
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
4784 bdf_name = SDATA (XCAR (bdf_fonts));
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
4785 bdf_pair = Fassoc (XCAR (bdf_fonts), Vw32_bdf_filename_alist);
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
4786 bdf_file = SDATA (XCDR (bdf_pair));
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4787
56855
650b7ca40098 2004-08-31 NAKAMURA Toshikazu <nr-tkz@nifty.com> (tiny change)
Jason Rumney <jasonr@gnu.org>
parents: 56480
diff changeset
4788 // If the font is already loaded, do not load it again.
650b7ca40098 2004-08-31 NAKAMURA Toshikazu <nr-tkz@nifty.com> (tiny change)
Jason Rumney <jasonr@gnu.org>
parents: 56480
diff changeset
4789 for (i = 0; i < dpyinfo->n_fonts; i++)
650b7ca40098 2004-08-31 NAKAMURA Toshikazu <nr-tkz@nifty.com> (tiny change)
Jason Rumney <jasonr@gnu.org>
parents: 56480
diff changeset
4790 {
650b7ca40098 2004-08-31 NAKAMURA Toshikazu <nr-tkz@nifty.com> (tiny change)
Jason Rumney <jasonr@gnu.org>
parents: 56480
diff changeset
4791 if ((dpyinfo->font_table[i].name
650b7ca40098 2004-08-31 NAKAMURA Toshikazu <nr-tkz@nifty.com> (tiny change)
Jason Rumney <jasonr@gnu.org>
parents: 56480
diff changeset
4792 && !strcmp (dpyinfo->font_table[i].name, bdf_name))
650b7ca40098 2004-08-31 NAKAMURA Toshikazu <nr-tkz@nifty.com> (tiny change)
Jason Rumney <jasonr@gnu.org>
parents: 56480
diff changeset
4793 || (dpyinfo->font_table[i].full_name
650b7ca40098 2004-08-31 NAKAMURA Toshikazu <nr-tkz@nifty.com> (tiny change)
Jason Rumney <jasonr@gnu.org>
parents: 56480
diff changeset
4794 && !strcmp (dpyinfo->font_table[i].full_name, bdf_name)))
56856
d407cd57475c Fix typo in last checkin
Jason Rumney <jasonr@gnu.org>
parents: 56855
diff changeset
4795 return dpyinfo->font_table + i;
56855
650b7ca40098 2004-08-31 NAKAMURA Toshikazu <nr-tkz@nifty.com> (tiny change)
Jason Rumney <jasonr@gnu.org>
parents: 56480
diff changeset
4796 }
650b7ca40098 2004-08-31 NAKAMURA Toshikazu <nr-tkz@nifty.com> (tiny change)
Jason Rumney <jasonr@gnu.org>
parents: 56480
diff changeset
4797
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4798 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
4799
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
4800 bdf_fonts = XCDR (bdf_fonts);
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4801 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4802
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4803 if (retval)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4804 return retval;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4805
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4806 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
4807 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4808
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
4809
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
4810 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4811 w32_unload_font (dpyinfo, font)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4812 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4813 XFontStruct * font;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4814 {
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
4815 if (font)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4816 {
32721
0574ffc14f77 (w32_load_system_font): Call w32_cache_char_metrics.
Andrew Innes <andrewi@gnu.org>
parents: 32669
diff changeset
4817 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
4818 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
4819
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
4820 if (font->hfont) DeleteObject(font->hfont);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4821 xfree (font);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4822 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4823 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4824
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4825 /* The font conversion stuff between x and w32 */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4826
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4827 /* X font string is as follows (from faces.el)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4828 * (let ((- "[-?]")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4829 * (foundry "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4830 * (family "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4831 * (weight "\\(bold\\|demibold\\|medium\\)") ; 1
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4832 * (weight\? "\\([^-]*\\)") ; 1
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4833 * (slant "\\([ior]\\)") ; 2
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4834 * (slant\? "\\([^-]?\\)") ; 2
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4835 * (swidth "\\([^-]*\\)") ; 3
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4836 * (adstyle "[^-]*") ; 4
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4837 * (pixelsize "[0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4838 * (pointsize "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4839 * (resx "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4840 * (resy "[0-9][0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4841 * (spacing "[cmp?*]")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4842 * (avgwidth "[0-9]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4843 * (registry "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4844 * (encoding "[^-]+")
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4845 * )
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4846 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4847
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
4848 static LONG
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4849 x_to_w32_weight (lpw)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4850 char * lpw;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4851 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4852 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
4853
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4854 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
4855 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
4856 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
4857 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
4858 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
4859 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
4860 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
4861 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
4862 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
4863 else if (stricmp (lpw,"thin") == 0) return FW_THIN;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4864 else
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4865 return FW_DONTCARE;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4866 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4867
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4868
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
4869 static char *
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4870 w32_to_x_weight (fnweight)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4871 int fnweight;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4872 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4873 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
4874 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
4875 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
4876 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
4877 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
4878 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
4879 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
4880 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
4881 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
4882 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4883 return "*";
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4884 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4885
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
4886 static LONG
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4887 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
4888 char * lpcs;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4889 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4890 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
4891 char *charset;
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4892 int len = strlen (lpcs);
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4893
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4894 /* Support "*-#nnn" format for unknown charsets. */
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4895 if (strncmp (lpcs, "*-#", 3) == 0)
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4896 return atoi (lpcs + 3);
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4897
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4898 /* 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
4899 charset = alloca (len + 1);
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4900 strcpy (charset, lpcs);
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4901 lpcs = strchr (charset, '*');
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4902 if (lpcs)
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4903 *lpcs = 0;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4904
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4905 /* 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
4906 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
4907 (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
4908 */
39548
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
4909 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
4910
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4911 if (NILP(this_entry))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4912 {
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4913 /* 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
4914 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
4915 return ANSI_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4916 else
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4917 return DEFAULT_CHARSET;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4918 }
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4919
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4920 w32_charset = Fcar (Fcdr (this_entry));
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4921
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
4922 /* Translate Lisp symbol to number. */
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4923 if (EQ (w32_charset, Qw32_charset_ansi))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4924 return ANSI_CHARSET;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4925 if (EQ (w32_charset, Qw32_charset_symbol))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4926 return SYMBOL_CHARSET;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4927 if (EQ (w32_charset, Qw32_charset_shiftjis))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4928 return SHIFTJIS_CHARSET;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4929 if (EQ (w32_charset, Qw32_charset_hangeul))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4930 return HANGEUL_CHARSET;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4931 if (EQ (w32_charset, Qw32_charset_chinesebig5))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4932 return CHINESEBIG5_CHARSET;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4933 if (EQ (w32_charset, Qw32_charset_gb2312))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4934 return GB2312_CHARSET;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4935 if (EQ (w32_charset, Qw32_charset_oem))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4936 return OEM_CHARSET;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4937 #ifdef JOHAB_CHARSET
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4938 if (EQ (w32_charset, Qw32_charset_johab))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4939 return JOHAB_CHARSET;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4940 if (EQ (w32_charset, Qw32_charset_easteurope))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4941 return EASTEUROPE_CHARSET;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4942 if (EQ (w32_charset, Qw32_charset_turkish))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4943 return TURKISH_CHARSET;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4944 if (EQ (w32_charset, Qw32_charset_baltic))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4945 return BALTIC_CHARSET;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4946 if (EQ (w32_charset, Qw32_charset_russian))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4947 return RUSSIAN_CHARSET;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4948 if (EQ (w32_charset, Qw32_charset_arabic))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4949 return ARABIC_CHARSET;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4950 if (EQ (w32_charset, Qw32_charset_greek))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4951 return GREEK_CHARSET;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4952 if (EQ (w32_charset, Qw32_charset_hebrew))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4953 return HEBREW_CHARSET;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4954 if (EQ (w32_charset, Qw32_charset_vietnamese))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4955 return VIETNAMESE_CHARSET;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4956 if (EQ (w32_charset, Qw32_charset_thai))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4957 return THAI_CHARSET;
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4958 if (EQ (w32_charset, Qw32_charset_mac))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4959 return MAC_CHARSET;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4960 #endif /* JOHAB_CHARSET */
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4961 #ifdef UNICODE_CHARSET
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
4962 if (EQ (w32_charset, Qw32_charset_unicode))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4963 return UNICODE_CHARSET;
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
4964 #endif
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4965
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4966 return DEFAULT_CHARSET;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4967 }
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
4968
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4969
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
4970 static char *
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
4971 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
4972 int fncharset;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4973 {
40528
7fb50bbb61ad (w32_to_x_charset): Increase size of XLFD charset buffer.
Jason Rumney <jasonr@gnu.org>
parents: 40385
diff changeset
4974 static char buf[32];
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4975 Lisp_Object charset_type;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4976
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4977 switch (fncharset)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
4978 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4979 case ANSI_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4980 /* 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
4981 being set up yet. */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4982 if (NILP(Vw32_charset_info_alist))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4983 return "iso8859-1";
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4984 charset_type = Qw32_charset_ansi;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4985 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4986 case DEFAULT_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4987 charset_type = Qw32_charset_default;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4988 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4989 case SYMBOL_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4990 charset_type = Qw32_charset_symbol;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4991 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4992 case SHIFTJIS_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4993 charset_type = Qw32_charset_shiftjis;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4994 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4995 case HANGEUL_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4996 charset_type = Qw32_charset_hangeul;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4997 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4998 case GB2312_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
4999 charset_type = Qw32_charset_gb2312;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5000 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5001 case CHINESEBIG5_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5002 charset_type = Qw32_charset_chinesebig5;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5003 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5004 case OEM_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5005 charset_type = Qw32_charset_oem;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5006 break;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5007
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5008 /* 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
5009 character sets. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5010 #ifdef EASTEUROPE_CHARSET
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5011 case EASTEUROPE_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5012 charset_type = Qw32_charset_easteurope;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5013 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5014 case TURKISH_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5015 charset_type = Qw32_charset_turkish;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5016 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5017 case BALTIC_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5018 charset_type = Qw32_charset_baltic;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5019 break;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5020 case RUSSIAN_CHARSET:
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5021 charset_type = Qw32_charset_russian;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5022 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5023 case ARABIC_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5024 charset_type = Qw32_charset_arabic;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5025 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5026 case GREEK_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5027 charset_type = Qw32_charset_greek;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5028 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5029 case HEBREW_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5030 charset_type = Qw32_charset_hebrew;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5031 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5032 case VIETNAMESE_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5033 charset_type = Qw32_charset_vietnamese;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5034 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5035 case THAI_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5036 charset_type = Qw32_charset_thai;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5037 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5038 case MAC_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5039 charset_type = Qw32_charset_mac;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5040 break;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5041 case JOHAB_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5042 charset_type = Qw32_charset_johab;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5043 break;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5044 #endif
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5045
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5046 #ifdef UNICODE_CHARSET
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5047 case UNICODE_CHARSET:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5048 charset_type = Qw32_charset_unicode;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5049 break;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5050 #endif
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5051 default:
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5052 /* Encode numerical value of unknown charset. */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5053 sprintf (buf, "*-#%u", fncharset);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5054 return buf;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5055 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
5056
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5057 {
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5058 Lisp_Object rest;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5059 char * best_match = NULL;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5060
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5061 /* 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
5062 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
5063 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
5064
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5065 Format of each entry is
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5066 (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE)).
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5067 */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5068 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
5069 {
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5070 char * x_charset;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5071 Lisp_Object w32_charset;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5072 Lisp_Object codepage;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5073
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5074 Lisp_Object this_entry = XCAR (rest);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5075
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5076 /* Skip invalid entries in alist. */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5077 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
5078 || !CONSP (XCDR (this_entry))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5079 || !SYMBOLP (XCAR (XCDR (this_entry))))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5080 continue;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5081
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
5082 x_charset = SDATA (XCAR (this_entry));
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5083 w32_charset = XCAR (XCDR (this_entry));
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5084 codepage = XCDR (XCDR (this_entry));
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5085
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5086 /* 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
5087 which means ignore). */
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
5088 if (EQ (w32_charset, charset_type)
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
5089 && (!INTEGERP (codepage) || XINT (codepage) == CP_DEFAULT
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5090 || IsValidCodePage (XINT (codepage))))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5091 {
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5092 /* 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
5093 best. */
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5094 if (!best_match)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5095 best_match = x_charset;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5096 /* 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
5097 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
5098 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
5099 && 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
5100 best_match = x_charset;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5101 /* 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
5102 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
5103 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
5104 && 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
5105 {
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5106 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
5107 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
5108 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
5109 best_match = x_charset;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
5110 }
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5111 }
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5112 }
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5113
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5114 /* 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
5115 if (!best_match)
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5116 {
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5117 sprintf (buf, "*-#%u", fncharset);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5118 return buf;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5119 }
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5120
40528
7fb50bbb61ad (w32_to_x_charset): Increase size of XLFD charset buffer.
Jason Rumney <jasonr@gnu.org>
parents: 40385
diff changeset
5121 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
5122 buf[31] = '\0';
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5123 return buf;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5124 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5125 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5126
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5127
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5128 /* 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
5129 static Lisp_Object
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5130 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
5131 int fncharset;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5132 {
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5133 static char buf[32];
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5134 Lisp_Object charset_type;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5135 Lisp_Object retval = Qnil;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5136
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5137 switch (fncharset)
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5138 {
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5139 case ANSI_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5140 /* 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
5141 being set up yet. */
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5142 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
5143 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
5144
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5145 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
5146 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5147 case DEFAULT_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5148 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
5149 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5150 case SYMBOL_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5151 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
5152 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5153 case SHIFTJIS_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5154 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
5155 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5156 case HANGEUL_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5157 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
5158 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5159 case GB2312_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5160 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
5161 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5162 case CHINESEBIG5_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5163 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
5164 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5165 case OEM_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5166 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
5167 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5168
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5169 /* 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
5170 character sets. */
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5171 #ifdef EASTEUROPE_CHARSET
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5172 case EASTEUROPE_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5173 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
5174 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5175 case TURKISH_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5176 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
5177 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5178 case BALTIC_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5179 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
5180 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5181 case RUSSIAN_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5182 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
5183 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5184 case ARABIC_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5185 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
5186 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5187 case GREEK_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5188 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
5189 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5190 case HEBREW_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5191 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
5192 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5193 case VIETNAMESE_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5194 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
5195 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5196 case THAI_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5197 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
5198 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5199 case MAC_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5200 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
5201 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5202 case JOHAB_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5203 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
5204 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5205 #endif
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5206
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5207 #ifdef UNICODE_CHARSET
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5208 case UNICODE_CHARSET:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5209 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
5210 break;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5211 #endif
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5212 default:
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5213 /* 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
5214 sprintf (buf, "*-#%u", fncharset);
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5215 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
5216 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
5217
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5218 {
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5219 Lisp_Object rest;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5220 /* 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
5221 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
5222
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5223 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
5224 (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
5225 */
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5226 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
5227 {
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5228 Lisp_Object x_charset;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5229 Lisp_Object w32_charset;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5230 Lisp_Object codepage;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5231
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5232 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
5233
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5234 /* 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
5235 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
5236 || !CONSP (XCDR (this_entry))
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5237 || !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
5238 continue;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5239
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5240 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
5241 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
5242 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
5243
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5244 /* 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
5245 which means ignore). */
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
5246 if (EQ (w32_charset, charset_type)
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
5247 && (!INTEGERP (codepage) || XINT (codepage) == CP_DEFAULT
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5248 || IsValidCodePage (XINT (codepage))))
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5249 {
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5250 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
5251 }
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5252 }
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5253
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5254 /* 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
5255 if (NILP (retval))
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5256 {
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5257 sprintf (buf, "*-#%u", fncharset);
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5258 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
5259 }
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5260
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5261 return retval;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5262 }
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5263 }
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5264
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5265 /* 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
5266 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
5267 w32-charset-to-codepage-alist. */
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
5268 int
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5269 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
5270 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5271 Lisp_Object codepage, entry;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5272 char *charset_str, *charset, *end;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5273
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5274 if (NILP (Vw32_charset_info_alist))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5275 return CP_DEFAULT;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5276
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5277 /* 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
5278 charset = xlfd_charset_of_font (fontname);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5279
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5280 if (!charset)
34284
3a21ff35392b (xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents: 34133
diff changeset
5281 return CP_UNKNOWN;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5282
39548
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5283 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
5284 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
5285
39548
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5286 #if 0
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5287 /* Remove leading "*-". */
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5288 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
5289 charset = charset_str + 2;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5290 else
39548
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5291 #endif
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5292 charset = charset_str;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5293
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5294 /* 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
5295 if (end = strchr (charset, '*'))
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5296 {
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5297 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
5298 end--;
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5299 *end = '\0';
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5300 }
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5301
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5302 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
5303 if (NILP (entry))
34284
3a21ff35392b (xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents: 34133
diff changeset
5304 return CP_UNKNOWN;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5305
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5306 codepage = Fcdr (Fcdr (entry));
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5307
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5308 if (NILP (codepage))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5309 return CP_8BIT;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5310 else if (XFASTINT (codepage) == XFASTINT (Qt))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5311 return CP_UNICODE;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5312 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
5313 return XINT (codepage);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5314 else
34284
3a21ff35392b (xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents: 34133
diff changeset
5315 return CP_UNKNOWN;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5316 }
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
5318
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
5319 static BOOL
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5320 w32_to_x_font (lplogfont, lpxstr, len, specific_charset)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5321 LOGFONT * lplogfont;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5322 char * lpxstr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5323 int len;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5324 char * specific_charset;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5325 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5326 char* fonttype;
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5327 char *fontname;
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5328 char height_pixels[8];
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5329 char height_dpi[8];
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5330 char width_pixels[8];
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5331 char *fontname_dash;
44047
73645cbc79a7 (x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents: 43963
diff changeset
5332 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
5333 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
5334 int bufsz;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5335 struct coding_system coding;
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5336
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5337 if (!lpxstr) abort ();
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5338
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5339 if (!lplogfont)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5340 return FALSE;
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5341
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5342 if (lplogfont->lfOutPrecision == OUT_STRING_PRECIS)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5343 fonttype = "raster";
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5344 else if (lplogfont->lfOutPrecision == OUT_STROKE_PRECIS)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5345 fonttype = "outline";
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5346 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5347 fonttype = "unknown";
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5348
41322
482c520b29ba (Vw32_system_coding_system): Remove.
Jason Rumney <jasonr@gnu.org>
parents: 41250
diff changeset
5349 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
5350 &coding);
29021
be2769eac1a5 (w32_to_x_font): Setup members src_multibyte and
Kenichi Handa <handa@m17n.org>
parents: 28983
diff changeset
5351 coding.src_multibyte = 0;
be2769eac1a5 (w32_to_x_font): Setup members src_multibyte and
Kenichi Handa <handa@m17n.org>
parents: 28983
diff changeset
5352 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
5353 coding.mode |= CODING_MODE_LAST_BLOCK;
45983
1f9be7a1addc (w32_to_x_font): Disable composition handling.
Kenichi Handa <handa@m17n.org>
parents: 45963
diff changeset
5354 /* We explicitely disable composition handling because selection
1f9be7a1addc (w32_to_x_font): Disable composition handling.
Kenichi Handa <handa@m17n.org>
parents: 45963
diff changeset
5355 data should not contain any composition sequence. */
1f9be7a1addc (w32_to_x_font): Disable composition handling.
Kenichi Handa <handa@m17n.org>
parents: 45963
diff changeset
5356 coding.composing = COMPOSITION_DISABLED;
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5357 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
5358
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5359 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
5360 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
5361 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
5362 *(fontname + coding.produced) = '\0';
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5363
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5364 /* 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
5365 misinterpreted. */
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5366 fontname_dash = fontname;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5367 while (fontname_dash = strchr (fontname_dash, '-'))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5368 *fontname_dash = '_';
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5369
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5370 if (lplogfont->lfHeight)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5371 {
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5372 sprintf (height_pixels, "%u", abs (lplogfont->lfHeight));
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5373 sprintf (height_dpi, "%u",
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5374 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
5375 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5376 else
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5377 {
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5378 strcpy (height_pixels, "*");
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5379 strcpy (height_dpi, "*");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5380 }
66449
24efdc78f7c1 (w32_to_x_font): Avoid forcing font widths.
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
5381
24efdc78f7c1 (w32_to_x_font): Avoid forcing font widths.
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
5382 #if 0 /* Never put the width in the xfld. It fails on fonts with
24efdc78f7c1 (w32_to_x_font): Avoid forcing font widths.
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
5383 double-width characters. */
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5384 if (lplogfont->lfWidth)
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5385 sprintf (width_pixels, "%u", lplogfont->lfWidth * 10);
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5386 else
66449
24efdc78f7c1 (w32_to_x_font): Avoid forcing font widths.
Jason Rumney <jasonr@gnu.org>
parents: 64770
diff changeset
5387 #endif
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5388 strcpy (width_pixels, "*");
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5389
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5390 _snprintf (lpxstr, len - 1,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5391 "-%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
5392 fonttype, /* foundry */
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5393 fontname, /* family */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5394 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
5395 lplogfont->lfItalic?'i':'r', /* slant */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5396 /* setwidth name */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5397 /* add style name */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5398 height_pixels, /* pixel size */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5399 height_dpi, /* point size */
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5400 display_resx, /* resx */
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5401 display_resy, /* resy */
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5402 ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5403 ? 'p' : 'c', /* spacing */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5404 width_pixels, /* avg width */
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5405 specific_charset ? specific_charset
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
5406 : w32_to_x_charset (lplogfont->lfCharSet)
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5407 /* charset registry and encoding */
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5408 );
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5409
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5410 lpxstr[len - 1] = 0; /* just to be sure */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5411 return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5412 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5413
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
5414 static BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5415 x_to_w32_font (lpxstr, lplogfont)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5416 char * lpxstr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5417 LOGFONT * lplogfont;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5418 {
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5419 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
5420
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5421 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
5422
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5423 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
5424
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5425 /* 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
5426 #if 1
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5427 lplogfont->lfOutPrecision = OUT_DEFAULT_PRECIS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5428 lplogfont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5429 lplogfont->lfQuality = DEFAULT_QUALITY;
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5430 #else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5431 /* go for maximum quality */
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5432 lplogfont->lfOutPrecision = OUT_STROKE_PRECIS;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5433 lplogfont->lfClipPrecision = CLIP_STROKE_PRECIS;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5434 lplogfont->lfQuality = PROOF_QUALITY;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5435 #endif
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5436
23620
2b55b8f8cdc1 (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if
Andrew Innes <andrewi@gnu.org>
parents: 23558
diff changeset
5437 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
5438 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
5439 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
5440
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5441 if (!lpxstr)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5442 return FALSE;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5443
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5444 /* 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
5445 * 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
5446 * format:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5447 * "<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
5448 */
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
5449
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5450 if (*lpxstr == '-')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5451 {
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5452 int fields, tem;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5453 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
5454 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
5455 char * encoding;
44047
73645cbc79a7 (x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents: 43963
diff changeset
5456 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
5457
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5458 fields = sscanf (lpxstr,
39548
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5459 "-%*[^-]-%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
5460 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
5461 if (fields == EOF)
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5462 return (FALSE);
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5463
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5464 /* 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
5465 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
5466 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
5467 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
5468 "-raster-6x10-*-gb2312*-*"
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5469 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
5470 if (fields == 3)
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5471 {
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5472 fields = sscanf (lpxstr,
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5473 "-%*[^-]-%49[^-]-*-%49s",
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5474 name, remainder);
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5475 }
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5476 else if (fields < 9)
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5477 {
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5478 fields = 0;
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5479 remainder[0] = 0;
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5480 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5481
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5482 if (fields > 0 && name[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5483 {
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
5484 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
5485 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
5486
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5487 setup_coding_system
41322
482c520b29ba (Vw32_system_coding_system): Remove.
Jason Rumney <jasonr@gnu.org>
parents: 41250
diff changeset
5488 (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
5489 coding.src_multibyte = 1;
57535
201c0ad15e73 (w32_font_match): Encode font name being matched.
Jason Rumney <jasonr@gnu.org>
parents: 56971
diff changeset
5490 coding.dst_multibyte = 0;
53798
ad0a7541533d * w32select.c (Fw32_set_clipboard_data): Make coding iso2022 safe.
Jason Rumney <jasonr@gnu.org>
parents: 53739
diff changeset
5491 /* Need to set COMPOSITION_DISABLED, otherwise Emacs crashes in
ad0a7541533d * w32select.c (Fw32_set_clipboard_data): Make coding iso2022 safe.
Jason Rumney <jasonr@gnu.org>
parents: 53739
diff changeset
5492 encode_coding_iso2022 trying to dereference a null pointer. */
ad0a7541533d * w32select.c (Fw32_set_clipboard_data): Make coding iso2022 safe.
Jason Rumney <jasonr@gnu.org>
parents: 53739
diff changeset
5493 coding.composing = COMPOSITION_DISABLED;
ad0a7541533d * w32select.c (Fw32_set_clipboard_data): Make coding iso2022 safe.
Jason Rumney <jasonr@gnu.org>
parents: 53739
diff changeset
5494 if (coding.type == coding_type_iso2022)
ad0a7541533d * w32select.c (Fw32_set_clipboard_data): Make coding iso2022 safe.
Jason Rumney <jasonr@gnu.org>
parents: 53739
diff changeset
5495 coding.flags |= CODING_FLAG_ISO_SAFE;
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
5496 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
5497 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
5498 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
5499 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
5500 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
5501 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
5502 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
5503 strcpy (lplogfont->lfFaceName, buf);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5504 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5505 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5506 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5507 lplogfont->lfFaceName[0] = '\0';
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5508 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5509
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5510 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5511
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5512 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
5513
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5514 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5515
33879
9bbea0dda9cd (x_to_w32_font): Do not filter out italic fonts, as new
Jason Rumney <jasonr@gnu.org>
parents: 33870
diff changeset
5516 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
5517
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5518 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5519
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5520 if (fields > 0 && pixels[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5521 lplogfont->lfHeight = atoi (pixels);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5522
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5523 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5524 fields--;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5525 if (fields > 0 && resy[0] != '*')
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5526 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5527 tem = atoi (resy);
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5528 if (tem > 0) dpi = tem;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5529 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5530
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5531 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
5532 lplogfont->lfHeight = atoi (height) * dpi / 720;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5533
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5534 if (fields > 0)
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5535 lplogfont->lfPitchAndFamily =
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5536 (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
5537
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5538 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5539
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5540 if (fields > 0 && width[0] != '*')
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5541 lplogfont->lfWidth = atoi (width) / 10;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5542
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5543 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5544
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5545 /* 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
5546 fails the test against xlfd-tight-regexp in fontset.el). */
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
5547 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5548 int len = strlen (remainder);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5549 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
5550 remainder[len-1] = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5551 }
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5552 encoding = remainder;
39548
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5553 #if 0
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5554 if (strncmp (encoding, "*-", 2) == 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5555 encoding += 2;
39548
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5556 #endif
6192be048459 (x_to_w32_color): Fix argument to alloca.
Andrew Innes <andrewi@gnu.org>
parents: 39137
diff changeset
5557 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
5558 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5559 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5560 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5561 int fields;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5562 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
5563
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5564 fields = sscanf (lpxstr,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5565 "%99[^:]:%9[^:]:%9[^:]:%19s",
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5566 name, height, width, weight);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5567
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5568 if (fields == EOF) return (FALSE);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5569
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5570 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5571 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5572 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
5573 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
5574 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5575 else
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5576 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5577 lplogfont->lfFaceName[0] = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5578 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5579
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5580 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5581
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5582 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5583 lplogfont->lfHeight = atoi (height);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5584
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5585 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5586
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5587 if (fields > 0)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5588 lplogfont->lfWidth = atoi (width);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5589
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5590 fields--;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5591
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
5592 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
5593 }
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5594
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
5595 /* 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
5596 lplogfont->lfHeight = - abs (lplogfont->lfHeight);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5597
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5598 return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5599 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5600
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5601 /* 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
5602 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
5603 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
5604 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
5605 */
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
5606 static int
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
5607 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
5608 {
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
5609 int pixel_height, field_number;
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5610 char *read_from, *write_to;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5611
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5612 xassert (fontname);
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5613
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5614 pixel_height = field_number = 0;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5615 write_to = NULL;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5616
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5617 /* Look for height fields. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5618 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
5619 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5620 if (*read_from == '-')
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5621 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5622 field_number++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5623 if (field_number == 7) /* Pixel height. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5624 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5625 read_from++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5626 write_to = read_from;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5627
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5628 /* Find end of field. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5629 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
5630 ;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5631
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5632 /* 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
5633 if (*read_from)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5634 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5635 *read_from = '\0';
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5636 read_from++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5637 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5638 pixel_height = atoi (write_to);
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5639 /* Blank out field. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5640 if (read_from > write_to)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5641 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5642 *write_to = '-';
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5643 write_to++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5644 }
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5645 /* 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
5646 return now. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5647 else
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5648 return pixel_height;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5649
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5650 /* 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
5651 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
5652 if (pixel_height)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5653 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5654 /* Find end of point size field. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5655 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
5656 ;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5657
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5658 if (*read_from)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5659 read_from++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5660
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5661 /* Blank out the point size field. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5662 if (read_from > write_to)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5663 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5664 *write_to = '-';
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5665 write_to++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5666 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5667 else
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5668 return pixel_height;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5669
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5670 break;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5671 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5672 /* 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
5673 if (*read_from == '-')
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5674 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5675 read_from++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5676 break;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5677 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5678 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5679 else if (field_number == 8)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5680 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5681 /* 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
5682 height and convert that. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5683 int point_size;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5684 char *point_size_start = read_from++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5685
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5686 /* Find end of field. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5687 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
5688 ;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5689
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5690 if (*read_from)
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5691 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5692 *read_from = '\0';
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5693 read_from++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5694 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5695
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5696 point_size = atoi (point_size_start);
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5697
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5698 /* Convert to pixel height. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5699 pixel_height = point_size
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5700 * 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
5701
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5702 /* Blank out this field and break. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5703 *write_to = '-';
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5704 write_to++;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5705 break;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5706 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5707 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5708 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5709
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5710 /* 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
5711 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
5712 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5713 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
5714 *write_to = *read_from;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5715 *write_to = '\0';
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5716 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5717
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5718 return pixel_height;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5719 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5720
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5721 /* Assume parameter 1 is fully qualified, no wildcards. */
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
5722 static BOOL
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5723 w32_font_match (fontname, pattern)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5724 char * fontname;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5725 char * pattern;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5726 {
57872
71ea49de0560 Use fast_string_match_ignore_case for comparing font names.
Jason Rumney <jasonr@gnu.org>
parents: 57868
diff changeset
5727 char *ptr;
57535
201c0ad15e73 (w32_font_match): Encode font name being matched.
Jason Rumney <jasonr@gnu.org>
parents: 56971
diff changeset
5728 char *font_name_copy;
201c0ad15e73 (w32_font_match): Encode font name being matched.
Jason Rumney <jasonr@gnu.org>
parents: 56971
diff changeset
5729 char *regex = alloca (strlen (pattern) * 2 + 3);
201c0ad15e73 (w32_font_match): Encode font name being matched.
Jason Rumney <jasonr@gnu.org>
parents: 56971
diff changeset
5730
57872
71ea49de0560 Use fast_string_match_ignore_case for comparing font names.
Jason Rumney <jasonr@gnu.org>
parents: 57868
diff changeset
5731 font_name_copy = alloca (strlen (fontname) + 1);
71ea49de0560 Use fast_string_match_ignore_case for comparing font names.
Jason Rumney <jasonr@gnu.org>
parents: 57868
diff changeset
5732 strcpy (font_name_copy, fontname);
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5733
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5734 ptr = regex;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5735 *ptr++ = '^';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5736
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5737 /* 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
5738 for (; *pattern; pattern++)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5739 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5740 if (*pattern == '?')
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5741 *ptr++ = '.';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5742 else if (*pattern == '*')
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5743 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5744 *ptr++ = '.';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5745 *ptr++ = '*';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5746 }
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
5747 else
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5748 *ptr++ = *pattern;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5749 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5750 *ptr = '$';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5751 *(ptr + 1) = '\0';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5752
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5753 /* 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
5754 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
5755 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
5756 pattern that declares the point height.
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5757 */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5758 {
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5759 int font_height, pattern_height;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5760
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5761 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
5762 pattern_height = xlfd_strip_height (regex);
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5763
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5764 /* 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
5765 if the heights differ. */
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5766 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
5767 return FALSE;
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5768 }
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
5769
57872
71ea49de0560 Use fast_string_match_ignore_case for comparing font names.
Jason Rumney <jasonr@gnu.org>
parents: 57868
diff changeset
5770 return (fast_string_match_ignore_case (build_string (regex),
71ea49de0560 Use fast_string_match_ignore_case for comparing font names.
Jason Rumney <jasonr@gnu.org>
parents: 57868
diff changeset
5771 build_string(font_name_copy)) >= 0);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5772 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5773
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5774 /* 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
5775 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
5776 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
5777 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
5778 fall back on.
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5779
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5780 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
5781 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
5782 each family. */
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5783
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
5784 typedef struct enumfont_t
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5785 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5786 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5787 int numFonts;
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5788 LOGFONT logfont;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5789 XFontStruct *size_ref;
45465
84120e75baa0 * w32fns.c (enumfont_t): Remove tail, make pattern a normal
Jason Rumney <jasonr@gnu.org>
parents: 45454
diff changeset
5790 Lisp_Object pattern;
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5791 Lisp_Object list;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5792 } enumfont_t;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5793
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5794
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5795 static void
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5796 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
5797
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5798
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
5799 static int CALLBACK
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5800 enum_font_cb2 (lplf, lptm, FontType, lpef)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5801 ENUMLOGFONT * lplf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5802 NEWTEXTMETRIC * lptm;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5803 int FontType;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5804 enumfont_t * lpef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5805 {
40873
f288d1d604a7 (enum_font_cb2): Use leading @ on face name to detect
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
5806 /* 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
5807 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
5808 return 1;
f288d1d604a7 (enum_font_cb2): Use leading @ on face name to detect
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
5809
f288d1d604a7 (enum_font_cb2): Use leading @ on face name to detect
Jason Rumney <jasonr@gnu.org>
parents: 40656
diff changeset
5810 /* 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
5811 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
5812 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
5813 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
5814 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
5815 && 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
5816 return 1;
7fb50bbb61ad (w32_to_x_charset): Increase size of XLFD charset buffer.
Jason Rumney <jasonr@gnu.org>
parents: 40385
diff changeset
5817
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5818 /* 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
5819 if (lpef->logfont.lfCharSet != DEFAULT_CHARSET &&
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5820 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
5821 return 1;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5822
45232
4413ac739ab9 (enum_font_cb2): Don't use DBCS raster fonts.
Jason Rumney <jasonr@gnu.org>
parents: 45009
diff changeset
5823 if (FontType == RASTER_FONTTYPE)
4413ac739ab9 (enum_font_cb2): Don't use DBCS raster fonts.
Jason Rumney <jasonr@gnu.org>
parents: 45009
diff changeset
5824 {
4413ac739ab9 (enum_font_cb2): Don't use DBCS raster fonts.
Jason Rumney <jasonr@gnu.org>
parents: 45009
diff changeset
5825 /* DBCS raster fonts have problems displaying, so skip them. */
4413ac739ab9 (enum_font_cb2): Don't use DBCS raster fonts.
Jason Rumney <jasonr@gnu.org>
parents: 45009
diff changeset
5826 int charset = lplf->elfLogFont.lfCharSet;
4413ac739ab9 (enum_font_cb2): Don't use DBCS raster fonts.
Jason Rumney <jasonr@gnu.org>
parents: 45009
diff changeset
5827 if (charset == SHIFTJIS_CHARSET
4413ac739ab9 (enum_font_cb2): Don't use DBCS raster fonts.
Jason Rumney <jasonr@gnu.org>
parents: 45009
diff changeset
5828 || charset == HANGEUL_CHARSET
4413ac739ab9 (enum_font_cb2): Don't use DBCS raster fonts.
Jason Rumney <jasonr@gnu.org>
parents: 45009
diff changeset
5829 || charset == CHINESEBIG5_CHARSET
4413ac739ab9 (enum_font_cb2): Don't use DBCS raster fonts.
Jason Rumney <jasonr@gnu.org>
parents: 45009
diff changeset
5830 || charset == GB2312_CHARSET
4413ac739ab9 (enum_font_cb2): Don't use DBCS raster fonts.
Jason Rumney <jasonr@gnu.org>
parents: 45009
diff changeset
5831 #ifdef JOHAB_CHARSET
4413ac739ab9 (enum_font_cb2): Don't use DBCS raster fonts.
Jason Rumney <jasonr@gnu.org>
parents: 45009
diff changeset
5832 || charset == JOHAB_CHARSET
4413ac739ab9 (enum_font_cb2): Don't use DBCS raster fonts.
Jason Rumney <jasonr@gnu.org>
parents: 45009
diff changeset
5833 #endif
4413ac739ab9 (enum_font_cb2): Don't use DBCS raster fonts.
Jason Rumney <jasonr@gnu.org>
parents: 45009
diff changeset
5834 )
4413ac739ab9 (enum_font_cb2): Don't use DBCS raster fonts.
Jason Rumney <jasonr@gnu.org>
parents: 45009
diff changeset
5835 return 1;
4413ac739ab9 (enum_font_cb2): Don't use DBCS raster fonts.
Jason Rumney <jasonr@gnu.org>
parents: 45009
diff changeset
5836 }
4413ac739ab9 (enum_font_cb2): Don't use DBCS raster fonts.
Jason Rumney <jasonr@gnu.org>
parents: 45009
diff changeset
5837
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5838 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5839 char buf[100];
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5840 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
5841 Lisp_Object charset_list = Qnil;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5842 char *charset = NULL;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5843
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5844 /* 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
5845 if (FontType != RASTER_FONTTYPE)
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5846 {
45465
84120e75baa0 * w32fns.c (enumfont_t): Remove tail, make pattern a normal
Jason Rumney <jasonr@gnu.org>
parents: 45454
diff changeset
5847 if (!NILP (lpef->pattern))
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5848 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5849 /* 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
5850 lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5851 lplf->elfLogFont.lfWidth = lpef->logfont.lfWidth;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5852 width = make_number (lpef->logfont.lfWidth);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5853 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5854 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5855 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5856 lplf->elfLogFont.lfHeight = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5857 lplf->elfLogFont.lfWidth = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5858 }
15205
0f5d6cd72e21 (win_msg_worker): Use post_msg.
Richard M. Stallman <rms@gnu.org>
parents: 15148
diff changeset
5859 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5860
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
5861 /* 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
5862 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
5863 if (lplf->elfLogFont.lfHeight > 0)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5864 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5865 /* 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
5866 if (FontType == RASTER_FONTTYPE)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5867 lplf->elfLogFont.lfHeight = lptm->tmInternalLeading - lptm->tmHeight;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5868 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5869 lplf->elfLogFont.lfHeight = -lplf->elfLogFont.lfHeight;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5870 }
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
5871
45465
84120e75baa0 * w32fns.c (enumfont_t): Remove tail, make pattern a normal
Jason Rumney <jasonr@gnu.org>
parents: 45454
diff changeset
5872 if (!NILP (lpef->pattern))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5873 {
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
5874 charset = xlfd_charset_of_font (SDATA (lpef->pattern));
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5875
43207
2dc57fcf62e9 (enum_font_cb2): Don't let charsets unknown to Windows
Jason Rumney <jasonr@gnu.org>
parents: 42935
diff changeset
5876 /* 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
5877 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
5878 if (charset
2dc57fcf62e9 (enum_font_cb2): Don't let charsets unknown to Windows
Jason Rumney <jasonr@gnu.org>
parents: 42935
diff changeset
5879 && strncmp (charset, "*-*", 3) != 0
2dc57fcf62e9 (enum_font_cb2): Don't let charsets unknown to Windows
Jason Rumney <jasonr@gnu.org>
parents: 42935
diff changeset
5880 && 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
5881 && 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
5882 return 1;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5883 }
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
5884
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5885 if (charset)
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5886 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
5887 else
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5888 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
5889
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5890 /* Loop through the charsets. */
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5891 for ( ; CONSP (charset_list); charset_list = Fcdr (charset_list))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5892 {
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5893 Lisp_Object this_charset = Fcar (charset_list);
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
5894 charset = SDATA (this_charset);
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5895
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5896 /* 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
5897 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
5898 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
5899 && 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
5900 && lplf->elfLogFont.lfItalic == FALSE)
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5901 {
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5902 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
5903 charset, width);
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5904 /* bold. */
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5905 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
5906 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
5907 charset, width);
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5908 /* bold italic. */
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5909 lplf->elfLogFont.lfItalic = TRUE;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5910 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
5911 charset, width);
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5912 /* italic. */
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5913 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
5914 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
5915 charset, width);
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5916 }
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5917 else
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5918 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
5919 charset, width);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5920 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5921 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
5922
40528
7fb50bbb61ad (w32_to_x_charset): Increase size of XLFD charset buffer.
Jason Rumney <jasonr@gnu.org>
parents: 40385
diff changeset
5923 return 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5924 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5925
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5926 static void
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5927 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
5928 enumfont_t * lpef;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5929 LOGFONT * logfont;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5930 char * match_charset;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5931 Lisp_Object width;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5932 {
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5933 char buf[100];
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5934
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5935 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
5936 return;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5937
45465
84120e75baa0 * w32fns.c (enumfont_t): Remove tail, make pattern a normal
Jason Rumney <jasonr@gnu.org>
parents: 45454
diff changeset
5938 if (NILP (lpef->pattern)
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
5939 || w32_font_match (buf, SDATA (lpef->pattern)))
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5940 {
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5941 /* 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
5942 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
5943 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
5944 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
5945 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
5946 {
45465
84120e75baa0 * w32fns.c (enumfont_t): Remove tail, make pattern a normal
Jason Rumney <jasonr@gnu.org>
parents: 45454
diff changeset
5947 Lisp_Object entry = Fcons (font_name, width);
84120e75baa0 * w32fns.c (enumfont_t): Remove tail, make pattern a normal
Jason Rumney <jasonr@gnu.org>
parents: 45454
diff changeset
5948 lpef->list = Fcons (entry, lpef->list);
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5949 lpef->numFonts++;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5950 }
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5951 }
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5952 }
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5953
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
5954
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
5955 static int CALLBACK
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5956 enum_font_cb1 (lplf, lptm, FontType, lpef)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5957 ENUMLOGFONT * lplf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5958 NEWTEXTMETRIC * lptm;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5959 int FontType;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5960 enumfont_t * lpef;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5961 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5962 return EnumFontFamilies (lpef->hdc,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5963 lplf->elfLogFont.lfFaceName,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5964 (FONTENUMPROC) enum_font_cb2,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5965 (LPARAM) lpef);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5966 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5967
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5968
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
5969 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
5970 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
5971 ENUMLOGFONTEX * lplf;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5972 NEWTEXTMETRICEX * lptm;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5973 int font_type;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5974 enumfont_t * lpef;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5975 {
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5976 /* 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
5977 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
5978 enumerated seperately. */
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5979 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
5980 font_type, lpef);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5981 }
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5982
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
5983 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
5984 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
5985 ENUMLOGFONTEX * lplf;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5986 NEWTEXTMETRICEX * lptm;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5987 int font_type;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5988 enumfont_t * lpef;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5989 {
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5990 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
5991 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
5992 = GetProcAddress ( gdi32, "EnumFontFamiliesExA");
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5993 /* 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
5994 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
5995 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
5996 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
5997 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
5998 &lplf->elfLogFont,
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
5999 (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
6000 (LPARAM) lpef, 0);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6001 }
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6002
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6003 /* 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
6004 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
6005
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6006 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
6007 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6008 char *fontname, *ptnstr;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6009 Lisp_Object list, tem, newlist = Qnil;
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
6010 int n_fonts = 0;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6011
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6012 list = Vw32_bdf_filename_alist;
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6013 ptnstr = SDATA (pattern);
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6014
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6015 for ( ; CONSP (list); list = XCDR (list))
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6016 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6017 tem = XCAR (list);
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6018 if (CONSP (tem))
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6019 fontname = SDATA (XCAR (tem));
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6020 else if (STRINGP (tem))
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6021 fontname = SDATA (tem);
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6022 else
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6023 continue;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6024
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6025 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
6026 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6027 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
6028 n_fonts++;
49812
15e797b18d7f (w32_list_bdf_fonts, w32_list_fonts): Negative
Jason Rumney <jasonr@gnu.org>
parents: 49600
diff changeset
6029 if (max_names >= 0 && n_fonts >= max_names)
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6030 break;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6031 }
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6032 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6033
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6034 return newlist;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6035 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6036
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6037
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6038 /* 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
6039 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
6040 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
6041 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
6042 a device context to use for GetTextMetrics.
49812
15e797b18d7f (w32_list_bdf_fonts, w32_list_fonts): Negative
Jason Rumney <jasonr@gnu.org>
parents: 49600
diff changeset
6043 MAXNAMES sets a limit on how many fonts to match. If MAXNAMES is
15e797b18d7f (w32_list_bdf_fonts, w32_list_fonts): Negative
Jason Rumney <jasonr@gnu.org>
parents: 49600
diff changeset
6044 negative, then all matching fonts are returned. */
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6045
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6046 Lisp_Object
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
6047 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
6048 struct frame *f;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
6049 Lisp_Object pattern;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
6050 int size;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
6051 int maxnames;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6052 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6053 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
6054 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
6055 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
6056 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
6057
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6058 patterns = Fassoc (pattern, Valternate_fontname_alist);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6059 if (NILP (patterns))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6060 patterns = Fcons (pattern, Qnil);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6061
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6062 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
6063 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6064 enumfont_t ef;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6065 int codepage;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6066
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6067 tpat = XCAR (patterns);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6068
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6069 if (!STRINGP (tpat))
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6070 continue;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6071
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6072 /* 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
6073 going to be able to output one of these anyway. */
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6074 codepage = w32_codepage_for_font (SDATA (tpat));
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6075 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
6076 && codepage != CP_DEFAULT && codepage != CP_UNKNOWN
3a21ff35392b (xlfd_charset_of_font): Don't overwrite fontname
Andrew Innes <andrewi@gnu.org>
parents: 34133
diff changeset
6077 && !IsValidCodePage(codepage))
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6078 continue;
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6079
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6080 /* 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
6081 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
6082 ((PATTERN (FONTNAME . WIDTH) ...) ...)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6083 */
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6084 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
6085 !NILP (list = Fassoc (tpat, tem)))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6086 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6087 list = Fcdr_safe (list);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6088 /* 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
6089 goto label_cached;
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 BLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6093 /* At first, put PATTERN in the cache. */
45465
84120e75baa0 * w32fns.c (enumfont_t): Remove tail, make pattern a normal
Jason Rumney <jasonr@gnu.org>
parents: 45454
diff changeset
6094 ef.pattern = tpat;
84120e75baa0 * w32fns.c (enumfont_t): Remove tail, make pattern a normal
Jason Rumney <jasonr@gnu.org>
parents: 45454
diff changeset
6095 ef.list = Qnil;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6096 ef.numFonts = 0;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6097
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6098 /* 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
6099 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
6100 older versions of NT that don't support the 'Ex function. */
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6101 x_to_w32_font (SDATA (tpat), &ef.logfont);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6102 {
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6103 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
6104 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
6105 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
6106 = GetProcAddress ( gdi32, "EnumFontFamiliesExA");
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6107
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6108 /* 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
6109 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
6110 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
6111 /* 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
6112 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
6113 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
6114
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6115 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
6116
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6117 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
6118 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
6119 &font_match_pattern,
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6120 (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
6121 (LPARAM) &ef, 0);
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6122 else
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6123 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
6124 (LPARAM)&ef);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6125
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6126 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
6127 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6128
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6129 UNBLOCK_INPUT;
45465
84120e75baa0 * w32fns.c (enumfont_t): Remove tail, make pattern a normal
Jason Rumney <jasonr@gnu.org>
parents: 45454
diff changeset
6130 list = ef.list;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6131
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6132 /* 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
6133 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
6134 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
6135 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
6136 XCDR (dpyinfo->name_list_element)));
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6137
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6138 label_cached:
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6139 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
6140
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6141 newlist = second_best = Qnil;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6142
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
6143 /* 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
6144 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
6145 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6146 int found_size;
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6147 tem = XCAR (list);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6148
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6149 if (!CONSP (tem))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6150 continue;
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6151 if (NILP (XCAR (tem)))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6152 continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6153 if (!size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6154 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6155 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
6156 n_fonts++;
49812
15e797b18d7f (w32_list_bdf_fonts, w32_list_fonts): Negative
Jason Rumney <jasonr@gnu.org>
parents: 49600
diff changeset
6157 if (maxnames >= 0 && n_fonts >= maxnames)
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6158 break;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6159 else
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6160 continue;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6161 }
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6162 if (!INTEGERP (XCDR (tem)))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6163 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6164 /* 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
6165 load it and try GetTextMetrics. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6166 W32FontStruct thisinfo;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6167 LOGFONT lf;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6168 HDC hdc;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6169 HANDLE oldobj;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6170
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6171 if (!x_to_w32_font (SDATA (XCAR (tem)), &lf))
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6172 continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6173
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6174 BLOCK_INPUT;
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6175 thisinfo.bdf = NULL;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6176 thisinfo.hfont = CreateFontIndirect (&lf);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6177 if (thisinfo.hfont == NULL)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6178 continue;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6179
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6180 hdc = GetDC (dpyinfo->root_window);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6181 oldobj = SelectObject (hdc, thisinfo.hfont);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6182 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
6183 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
6184 else
39973
579177964efa Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents: 39812
diff changeset
6185 XSETCDR (tem, make_number (0));
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6186 SelectObject (hdc, oldobj);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6187 ReleaseDC (dpyinfo->root_window, hdc);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6188 DeleteObject(thisinfo.hfont);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6189 UNBLOCK_INPUT;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6190 }
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6191 found_size = XINT (XCDR (tem));
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6192 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
6193 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6194 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
6195 n_fonts++;
49812
15e797b18d7f (w32_list_bdf_fonts, w32_list_fonts): Negative
Jason Rumney <jasonr@gnu.org>
parents: 49600
diff changeset
6196 if (maxnames >= 0 && n_fonts >= maxnames)
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6197 break;
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6198 }
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6199 /* 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
6200 no exact match is found. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6201 else if (found_size > 0)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6202 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6203 if (NILP (second_best))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6204 second_best = tem;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
6205
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6206 else if (found_size < size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6207 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6208 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
6209 || 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
6210 second_best = tem;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6211 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6212 else
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6213 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6214 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
6215 && XINT (XCDR (second_best)) >
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6216 found_size)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6217 second_best = tem;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6218 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6219 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6220 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6221
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6222 if (!NILP (newlist))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6223 break;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6224 else if (!NILP (second_best))
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6225 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6226 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
6227 break;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6228 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6229 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6230
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6231 /* Include any bdf fonts. */
49812
15e797b18d7f (w32_list_bdf_fonts, w32_list_fonts): Negative
Jason Rumney <jasonr@gnu.org>
parents: 49600
diff changeset
6232 if (n_fonts < maxnames || maxnames < 0)
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6233 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6234 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
6235 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
6236 combined[1] = newlist;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6237 newlist = Fnconc(2, combined);
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6238 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6239
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6240 return newlist;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6241 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6242
24214
4fb0bce809bc (w32_load_system_font): Do not load unlisted fonts if
Geoff Voelker <voelker@cs.washington.edu>
parents: 24211
diff changeset
6243
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6244 /* 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
6245 struct font_info *
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6246 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
6247 FRAME_PTR f;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6248 int font_idx;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6249 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6250 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
6251 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6252
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6253
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6254 struct font_info*
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6255 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
6256 {
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6257 int i;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6258 struct font_info *pfi;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6259
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6260 pfi = FRAME_W32_FONT_TABLE (f);
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6261
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6262 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
6263 {
72274
680d93dcff9e (w32_query_font): Fix last change: use stricmp.
Eli Zaretskii <eliz@gnu.org>
parents: 72269
diff changeset
6264 if (stricmp(pfi->name, fontname) == 0) return pfi;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6265 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6266
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6267 return NULL;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6268 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6269
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6270 /* 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
6271 `encoder' of the structure. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6272
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6273 void
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6274 w32_find_ccl_program (fontp)
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6275 struct font_info *fontp;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6276 {
25069
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
6277 Lisp_Object list, elt;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6278
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6279 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
6280 {
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6281 elt = XCAR (list);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6282 if (CONSP (elt)
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6283 && STRINGP (XCAR (elt))
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6284 && (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
6285 >= 0))
25069
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
6286 break;
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
6287 }
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
6288 if (! NILP (list))
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
6289 {
25084
d89aa269255d (w32_find_ccl_program): Add casting.
Kenichi Handa <handa@m17n.org>
parents: 25069
diff changeset
6290 struct ccl_program *ccl
d89aa269255d (w32_find_ccl_program): Add casting.
Kenichi Handa <handa@m17n.org>
parents: 25069
diff changeset
6291 = (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
6292
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6293 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
6294 xfree (ccl);
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
6295 else
ee9bfbc340ba (w32_find_ccl_program): Get compiled CCL code by just
Kenichi Handa <handa@m17n.org>
parents: 24856
diff changeset
6296 fontp->font_encoder = ccl;
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6297 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6298 }
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6299
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
6300 /* directory-files from dired.c. */
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
6301 Lisp_Object Fdirectory_files P_((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
6302
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
6303
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6304 /* 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
6305 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
6306 static Lisp_Object
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6307 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
6308 {
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6309 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
6310 char fontname[100];
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6311
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6312 if (!STRINGP(directory))
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6313 return Qnil;
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6314
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6315 filelist = Fdirectory_files (directory, Qt,
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
6316 build_string (".*\\.[bB][dD][fF]"), Qt);
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6317
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6318 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
6319 {
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6320 Lisp_Object filename = XCAR (filelist);
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6321 if (w32_BDF_to_x_font (SDATA (filename), fontname, 100))
35288
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6322 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
6323 }
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6324 return list;
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6325 }
912ea0b8e09b (x_to_w32_color, x_set_icon_name, xlfd_strip_height)
Jason Rumney <jasonr@gnu.org>
parents: 34998
diff changeset
6326
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6327 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
6328 1, 1, 0,
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
6329 doc: /* Return a list of BDF fonts in DIRECTORY.
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
6330 The list is suitable for appending to `w32-bdf-filename-alist'.
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
6331 Fonts which do not contain an xlfd description will not be included
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
6332 in the list. DIRECTORY may be a list of directories. */)
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6333 (directory)
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6334 Lisp_Object directory;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6335 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6336 Lisp_Object list = Qnil;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6337 struct gcpro gcpro1, gcpro2;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6338
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6339 if (!CONSP (directory))
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6340 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
6341
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6342 for ( ; CONSP (directory); directory = XCDR (directory))
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6343 {
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6344 Lisp_Object pair[2];
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6345 pair[0] = list;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6346 pair[1] = Qnil;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6347 GCPRO2 (directory, list);
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6348 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
6349 list = Fnconc( 2, pair );
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6350 UNGCPRO;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6351 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6352 return list;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6353 }
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6354
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
6355
26729
f5dded41adcc Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents: 25646
diff changeset
6356 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
6357 doc: /* Internal function called by `color-defined-p', which see. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6358 (color, frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6359 Lisp_Object color, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6360 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6361 XColor foo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6362 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6363
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
6364 CHECK_STRING (color);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6365
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6366 if (w32_defined_color (f, SDATA (color), &foo, 0))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6367 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6368 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6369 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6370 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6371
26729
f5dded41adcc Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents: 25646
diff changeset
6372 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
6373 doc: /* Internal function called by `color-values', which see. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6374 (color, frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6375 Lisp_Object color, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6376 {
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6377 XColor foo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6378 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6379
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
6380 CHECK_STRING (color);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6381
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6382 if (w32_defined_color (f, SDATA (color), &foo, 0))
72529
892ea79efee6 (Fxw_color_values): Simplify; use list3.
Kim F. Storm <storm@cua.dk>
parents: 72274
diff changeset
6383 return list3 (make_number ((GetRValue (foo.pixel) << 8)
892ea79efee6 (Fxw_color_values): Simplify; use list3.
Kim F. Storm <storm@cua.dk>
parents: 72274
diff changeset
6384 | GetRValue (foo.pixel)),
892ea79efee6 (Fxw_color_values): Simplify; use list3.
Kim F. Storm <storm@cua.dk>
parents: 72274
diff changeset
6385 make_number ((GetGValue (foo.pixel) << 8)
892ea79efee6 (Fxw_color_values): Simplify; use list3.
Kim F. Storm <storm@cua.dk>
parents: 72274
diff changeset
6386 | GetGValue (foo.pixel)),
892ea79efee6 (Fxw_color_values): Simplify; use list3.
Kim F. Storm <storm@cua.dk>
parents: 72274
diff changeset
6387 make_number ((GetBValue (foo.pixel) << 8)
892ea79efee6 (Fxw_color_values): Simplify; use list3.
Kim F. Storm <storm@cua.dk>
parents: 72274
diff changeset
6388 | GetBValue (foo.pixel)));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6389 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6390 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6391 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6392
26729
f5dded41adcc Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents: 25646
diff changeset
6393 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
6394 doc: /* Internal function called by `display-color-p', which see. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6395 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6396 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6397 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6398 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6399
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6400 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 2)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6401 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6402
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6403 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6404 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6405
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
6406 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
6407 Sx_display_grayscale_p, 0, 1, 0,
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
6408 doc: /* Return t if DISPLAY supports shades of gray.
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
6409 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
6410 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
6411 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
6412 If omitted or nil, that stands for the selected frame's display. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6413 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6414 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6415 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6416 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6417
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6418 if ((dpyinfo->n_planes * dpyinfo->n_cbits) <= 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6419 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6420
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6421 return Qt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6422 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6423
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
6424 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
6425 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
6426 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
6427 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
6428 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
6429 If omitted or nil, that stands for the selected frame's display. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6430 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6431 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6432 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6433 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6435 return make_number (dpyinfo->width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6436 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6437
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6438 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
6439 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
6440 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
6441 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
6442 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
6443 If omitted or nil, that stands for the selected frame's display. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6444 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6445 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6446 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6447 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6448
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6449 return make_number (dpyinfo->height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6450 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6451
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6452 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
6453 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
6454 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
6455 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
6456 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
6457 If omitted or nil, that stands for the selected frame's display. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6458 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6459 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6460 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6461 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6462
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6463 return make_number (dpyinfo->n_planes * dpyinfo->n_cbits);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6464 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6465
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6466 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
6467 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
6468 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
6469 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
6470 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
6471 If omitted or nil, that stands for the selected frame's display. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6472 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6473 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6474 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6475 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6476 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6477 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6478
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6479 hdc = GetDC (dpyinfo->root_window);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6480 if (dpyinfo->has_palette)
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
6481 cap = GetDeviceCaps (hdc, SIZEPALETTE);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6482 else
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
6483 cap = GetDeviceCaps (hdc, NUMCOLORS);
34998
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
6484
43773
8d3931ead0df (Fx_display_color_cells): Force 24+ bit color depths to 24-bit.
Juanma Barranquero <lekktu@gmail.com>
parents: 43484
diff changeset
6485 /* 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
6486 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
6487 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
6488 cap = 1 << min(dpyinfo->n_planes * dpyinfo->n_cbits, 24);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
6489
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6490 ReleaseDC (dpyinfo->root_window, hdc);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
6491
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6492 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6493 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6494
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6495 DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6496 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
6497 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
6498 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
6499 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
6500 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
6501 If omitted or nil, that stands for the selected frame's display. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6502 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6503 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6504 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6505 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6506
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6507 return make_number (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6508 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6509
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6510 DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
57765
77c93cbb1721 (Fx_server_vendor, Fx_server_version): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 57535
diff changeset
6511 doc: /* Returns the "vendor ID" string of the W32 system (Microsoft).
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
6512 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
6513 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
6514 If omitted or nil, that stands for the selected frame's display. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6515 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6516 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6517 {
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
6518 return build_string ("Microsoft Corp.");
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6519 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6520
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6521 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
6522 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
6523 The value is a list of three integers: the major and minor
57765
77c93cbb1721 (Fx_server_vendor, Fx_server_version): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 57535
diff changeset
6524 version numbers of the X Protocol in use, and the distributor-specific release
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
6525 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
6526
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
6527 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
6528 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
6529 If omitted or nil, that stands for the selected frame's display. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6530 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6531 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6532 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6533 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
6534 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
6535 Fcons (make_number (w32_build_number), Qnil)));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6536 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6537
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6538 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
6539 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
6540 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
6541 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
6542 If omitted or nil, that stands for the selected frame's display. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6543 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6544 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6545 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6546 return make_number (1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6547 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6548
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
6549 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
6550 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
6551 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
6552 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
6553 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
6554 If omitted or nil, that stands for the selected frame's display. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6555 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6556 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6557 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6558 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6559 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6560 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6561
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6562 hdc = GetDC (dpyinfo->root_window);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
6563
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6564 cap = GetDeviceCaps (hdc, VERTSIZE);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
6565
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6566 ReleaseDC (dpyinfo->root_window, hdc);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
6567
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6568 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6569 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6570
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6571 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
6572 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
6573 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
6574 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
6575 If omitted or nil, that stands for the selected frame's display. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6576 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6577 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6578 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6579 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6580
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6581 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6582 int cap;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6583
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6584 hdc = GetDC (dpyinfo->root_window);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
6585
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6586 cap = GetDeviceCaps (hdc, HORZSIZE);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
6587
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6588 ReleaseDC (dpyinfo->root_window, hdc);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
6589
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6590 return make_number (cap);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6591 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6592
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6593 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
6594 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
6595 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
6596 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
6597 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
6598 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
6599 If omitted or nil, that stands for the selected frame's display. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6600 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6601 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6602 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6603 return intern ("not-useful");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6604 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6605
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6606 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
6607 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
6608 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
6609 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
6610 `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
6611
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
6612 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
6613 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
6614 If omitted or nil, that stands for the selected frame's display. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6615 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6616 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6617 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6618 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
6619 Lisp_Object result = Qnil;
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
6620
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
6621 if (dpyinfo->has_palette)
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
6622 result = intern ("pseudo-color");
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
6623 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
6624 result = intern ("static-grey");
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
6625 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
6626 result = intern ("static-color");
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
6627 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
6628 result = intern ("true-color");
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
6629
5091928844df (Fx_display_color_cells): Determine correct value, when
Andrew Innes <andrewi@gnu.org>
parents: 34942
diff changeset
6630 return result;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6631 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6632
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6633 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
6634 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
6635 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
6636 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
6637 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
6638 If omitted or nil, that stands for the selected frame's display. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6639 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6640 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6641 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6642 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6643 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6644
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6645 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6646 x_pixel_width (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6647 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6648 {
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
6649 return FRAME_PIXEL_WIDTH (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6650 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6651
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6652 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6653 x_pixel_height (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6654 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6655 {
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
6656 return FRAME_PIXEL_HEIGHT (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6657 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6658
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6659 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6660 x_char_width (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6661 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6662 {
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
6663 return FRAME_COLUMN_WIDTH (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6664 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6665
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6666 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6667 x_char_height (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6668 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6669 {
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
6670 return FRAME_LINE_HEIGHT (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6671 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6672
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6673 int
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6674 x_screen_planes (f)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6675 register struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6676 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6677 return FRAME_W32_DISPLAY_INFO (f)->n_planes;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6678 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6679
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6680 /* Return the display structure for the display named NAME.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6681 Open a new connection if necessary. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6682
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6683 struct w32_display_info *
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6684 x_display_info_for_name (name)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6685 Lisp_Object name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6686 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6687 Lisp_Object names;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6688 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6689
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
6690 CHECK_STRING (name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6691
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6692 for (dpyinfo = &one_w32_display_info, names = w32_display_name_list;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6693 dpyinfo;
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6694 dpyinfo = dpyinfo->next, names = XCDR (names))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6695 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6696 Lisp_Object tem;
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6697 tem = Fstring_equal (XCAR (XCAR (names)), name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6698 if (!NILP (tem))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6699 return dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6700 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6701
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6702 /* Use this general default value to start with. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6703 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6704
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6705 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6706
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6707 dpyinfo = w32_term_init (name, (unsigned char *)0,
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6708 (char *) SDATA (Vx_resource_name));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6709
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6710 if (dpyinfo == 0)
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6711 error ("Cannot connect to server %s", SDATA (name));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6712
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6713 w32_in_use = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6714 XSETFASTINT (Vwindow_system_version, 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6715
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6716 return dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6717 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6718
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6719 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
6720 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
6721 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
6722 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
6723 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
6724 terminate Emacs if we can't open the connection. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6725 (display, xrm_string, must_succeed)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6726 Lisp_Object display, xrm_string, must_succeed;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6727 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6728 unsigned char *xrm_option;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6729 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6730
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
6731 /* 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
6732 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
6733 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
6734 return Qnil;
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
6735
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
6736 CHECK_STRING (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6737 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
6738 CHECK_STRING (xrm_string);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6739
83571
ca1c27e2707e (x_set_tool_bar_lines): Don't use updating_frame.
Jason Rumney <jasonr@gnu.org>
parents: 76700
diff changeset
6740 #if 0
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6741 if (! EQ (Vwindow_system, intern ("w32")))
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6742 error ("Not using Microsoft Windows");
83571
ca1c27e2707e (x_set_tool_bar_lines): Don't use updating_frame.
Jason Rumney <jasonr@gnu.org>
parents: 76700
diff changeset
6743 #endif
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6744
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6745 /* 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
6746 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
6747 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6748 Lisp_Object color_file;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6749 struct gcpro gcpro1;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6750
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6751 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
6752
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6753 GCPRO1 (color_file);
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 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
6756 color_file =
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6757 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
6758 Fsymbol_value (intern ("data-directory")));
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6759
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6760 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
6761
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6762 UNGCPRO;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6763 }
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6764 if (NILP (Vw32_color_map))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6765 Vw32_color_map = Fw32_default_color_map ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6766
51474
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
6767 /* Merge in system logical colors. */
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
6768 add_system_logical_colors_to_map (&Vw32_color_map);
0dbfd1fe2e91 (add_system_logical_colors_to_map): New function.
Jason Rumney <jasonr@gnu.org>
parents: 51211
diff changeset
6769
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6770 if (! NILP (xrm_string))
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6771 xrm_option = (unsigned char *) SDATA (xrm_string);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6772 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6773 xrm_option = (unsigned char *) 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6774
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6775 /* 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
6776 /* 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
6777 {
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6778 char basename[ MAX_PATH ], *str;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6779
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6780 strcpy (basename, SDATA (Vinvocation_name));
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6781 str = strrchr (basename, '.');
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6782 if (str) *str = 0;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6783 Vinvocation_name = build_string (basename);
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
6784 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6785 Vx_resource_name = Vinvocation_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6786
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6787 validate_x_resource_name ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6788
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6789 /* This is what opens the connection and sets x_current_display.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6790 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
6791 dpyinfo = w32_term_init (display, xrm_option,
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6792 (char *) SDATA (Vx_resource_name));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6793
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6794 if (dpyinfo == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6795 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6796 if (!NILP (must_succeed))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
6797 fatal ("Cannot connect to server %s.\n",
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6798 SDATA (display));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6799 else
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6800 error ("Cannot connect to server %s", SDATA (display));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6801 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6802
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6803 w32_in_use = 1;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
6804
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6805 XSETFASTINT (Vwindow_system_version, 3);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6806 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6807 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6808
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6809 DEFUN ("x-close-connection", Fx_close_connection,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6810 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
6811 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
6812 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
6813 If DISPLAY is nil, that stands for the selected frame's display. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6814 (display)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6815 Lisp_Object display;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6816 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
6817 struct w32_display_info *dpyinfo = check_x_display_info (display);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6818 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6819
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6820 if (dpyinfo->reference_count > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6821 error ("Display still has frames on it");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6822
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6823 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6824 /* Free the fonts in the font table. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6825 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
6826 if (dpyinfo->font_table[i].name)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6827 {
28272
f62bb21d38db (w32_wnd_proc): Handle WM_MENUSELECT message.
Jason Rumney <jasonr@gnu.org>
parents: 27936
diff changeset
6828 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
6829 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
6830 xfree (dpyinfo->font_table[i].name);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6831 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
6832 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6833 x_destroy_all_bitmaps (dpyinfo);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6834
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6835 x_delete_display (dpyinfo);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6836 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6837
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6838 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6839 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6840
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6841 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
6842 doc: /* Return the list of display names that Emacs has connections to. */)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6843 ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6844 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6845 Lisp_Object tail, result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6846
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6847 result = Qnil;
25646
9154af188477 Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents: 25289
diff changeset
6848 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
6849 result = Fcons (XCAR (XCAR (tail)), result);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6850
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6851 return result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6852 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6853
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6854 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
41008
cf49091f9de9 (Fx_synchronize): Reindent.
Pavel Janík <Pavel@Janik.cz>
parents: 40964
diff changeset
6855 doc: /* This is a noop on W32 systems. */)
cf49091f9de9 (Fx_synchronize): Reindent.
Pavel Janík <Pavel@Janik.cz>
parents: 40964
diff changeset
6856 (on, display)
cf49091f9de9 (Fx_synchronize): Reindent.
Pavel Janík <Pavel@Janik.cz>
parents: 40964
diff changeset
6857 Lisp_Object display, on;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6858 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6859 return Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6860 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6861
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6862
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6863
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6864 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6865 Window properties
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6866 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6867
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6868 DEFUN ("x-change-window-property", Fx_change_window_property,
53844
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6869 Sx_change_window_property, 2, 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
6870 doc: /* Change window property PROP to VALUE on the X window of FRAME.
53844
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6871 VALUE may be a string or a list of conses, numbers and/or strings.
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6872 If an element in the list is a string, it is converted to
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6873 an Atom and the value of the Atom is used. If an element is a cons,
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6874 it is converted to a 32 bit number where the car is the 16 top bits and the
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6875 cdr is the lower 16 bits.
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6876 FRAME nil or omitted means use the selected frame.
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6877 If TYPE is given and non-nil, it is the name of the type of VALUE.
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6878 If TYPE is not given or nil, the type is STRING.
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6879 FORMAT gives the size in bits of each element if VALUE is a list.
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6880 It must be one of 8, 16 or 32.
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6881 If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8.
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6882 If OUTER_P is non-nil, the property is changed for the outer X window of
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6883 FRAME. Default is to change on the edit X window.
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6884
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6885 Value is VALUE. */)
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6886 (prop, value, frame, type, format, outer_p)
0093eae529e8 macfns.c, w32fns.c (Fx_change_window_property):
Jan Djärv <jan.h.d@swipnet.se>
parents: 53798
diff changeset
6887 Lisp_Object prop, value, frame, type, format, outer_p;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6888 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6889 #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
6890 struct frame *f = check_x_frame (frame);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6891 Atom prop_atom;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6892
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
6893 CHECK_STRING (prop);
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
6894 CHECK_STRING (value);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6895
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6896 BLOCK_INPUT;
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6897 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6898 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
6899 prop_atom, XA_STRING, 8, PropModeReplace,
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6900 SDATA (value), SCHARS (value));
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6901
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6902 /* 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
6903 XFlush (FRAME_W32_DISPLAY (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6904 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6905
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6906 #endif /* TODO */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6907
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6908 return value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6909 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6910
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6911
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6912 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
6913 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
6914 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
6915 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
6916 (prop, frame)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6917 Lisp_Object prop, frame;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6918 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6919 #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
6920
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6921 struct frame *f = check_x_frame (frame);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6922 Atom prop_atom;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6923
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
6924 CHECK_STRING (prop);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6925 BLOCK_INPUT;
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6926 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6927 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
6928
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6929 /* 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
6930 XFlush (FRAME_W32_DISPLAY (f));
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6931 UNBLOCK_INPUT;
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6932 #endif /* TODO */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6933
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6934 return prop;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6935 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6936
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6937
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6938 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
6939 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
6940 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
6941 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
6942 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
6943 value. */)
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6944 (prop, frame)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6945 Lisp_Object prop, frame;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6946 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6947 #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
6948
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6949 struct frame *f = check_x_frame (frame);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6950 Atom prop_atom;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6951 int rc;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6952 Lisp_Object prop_value = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6953 char *tmp_data = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6954 Atom actual_type;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6955 int actual_format;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6956 unsigned long actual_size, bytes_remaining;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6957
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
6958 CHECK_STRING (prop);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6959 BLOCK_INPUT;
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
6960 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6961 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
6962 prop_atom, 0, 0, False, XA_STRING,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6963 &actual_type, &actual_format, &actual_size,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6964 &bytes_remaining, (unsigned char **) &tmp_data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6965 if (rc == Success)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6966 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6967 int size = bytes_remaining;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6968
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6969 XFree (tmp_data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6970 tmp_data = NULL;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6971
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6972 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
6973 prop_atom, 0, bytes_remaining,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6974 False, XA_STRING,
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
6975 &actual_type, &actual_format,
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
6976 &actual_size, &bytes_remaining,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6977 (unsigned char **) &tmp_data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6978 if (rc == Success)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6979 prop_value = make_string (tmp_data, size);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6980
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6981 XFree (tmp_data);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6982 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6983
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6984 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6985
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6986 return prop_value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6987
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
6988 #endif /* TODO */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6989 return Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6990 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6991
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6992
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6993
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6994 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6995 Busy cursor
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6996 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
6997
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
6998 /* 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
6999 an hourglass cursor on all frames. */
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7000
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7001 static struct atimer *hourglass_atimer;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7002
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7003 /* 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
7004
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7005 static int hourglass_shown_p;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7006
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7007 /* 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
7008
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7009 static Lisp_Object Vhourglass_delay;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7010
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7011 /* 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
7012 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
7013
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7014 #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
7015
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
7016 /* 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
7017
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7018 static void show_hourglass P_ ((struct atimer *));
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7019 static void hide_hourglass P_ ((void));
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7020
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7021
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7022 /* 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
7023
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
7024 void
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7025 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
7026 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
7027 #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
7028 EMACS_TIME delay;
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7029 int secs, usecs = 0;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7030
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7031 cancel_hourglass ();
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7032
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7033 if (INTEGERP (Vhourglass_delay)
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7034 && XINT (Vhourglass_delay) > 0)
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7035 secs = XFASTINT (Vhourglass_delay);
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7036 else if (FLOATP (Vhourglass_delay)
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7037 && 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
7038 {
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7039 Lisp_Object tem;
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7040 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
7041 secs = XFASTINT (tem);
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7042 usecs = (XFLOAT_DATA (Vhourglass_delay) - secs) * 1000000;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7043 }
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7044 else
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7045 secs = DEFAULT_HOURGLASS_DELAY;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7046
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7047 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
7048 hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7049 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
7050 #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
7051 }
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
7052
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
7053
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7054 /* 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
7055 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
7056
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
7057 void
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7058 cancel_hourglass ()
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7059 {
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7060 if (hourglass_atimer)
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7061 {
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7062 cancel_atimer (hourglass_atimer);
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7063 hourglass_atimer = NULL;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7064 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7065
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7066 if (hourglass_shown_p)
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7067 hide_hourglass ();
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7068 }
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7069
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7070
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7071 /* 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
7072 hourglass_atimer.
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7073
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7074 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
7075 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
7076 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
7077 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
7078
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
7079 static void
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7080 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
7081 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
7082 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
7083 #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
7084 /* 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
7085 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
7086 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
7087 hourglass_atimer = NULL;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7088
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7089 if (!hourglass_shown_p)
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7090 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7091 Lisp_Object rest, frame;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7092
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
7093 BLOCK_INPUT;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7094
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7095 FOR_EACH_FRAME (rest, frame)
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7096 if (FRAME_W32_P (XFRAME (frame)))
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7097 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7098 struct frame *f = XFRAME (frame);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7099
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7100 f->output_data.w32->hourglass_p = 1;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7101
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7102 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
7103 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7104 unsigned long mask = CWCursor;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7105 XSetWindowAttributes attrs;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7106
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7107 attrs.cursor = f->output_data.w32->hourglass_cursor;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7108
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7109 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
7110 = XCreateWindow (FRAME_X_DISPLAY (f),
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7111 FRAME_OUTER_WINDOW (f),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7112 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
7113 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
7114 CopyFromParent,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7115 mask, &attrs);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7116 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7117
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7118 XMapRaised (FRAME_X_DISPLAY (f),
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7119 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
7120 XFlush (FRAME_X_DISPLAY (f));
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7121 }
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
7122
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7123 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
7124 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
7125 }
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
7126 #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
7127 }
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
7128
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
7129
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7130 /* 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
7131
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
7132 static void
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7133 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
7134 {
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
7135 #if 0 /* TODO: cursor shape changes. */
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7136 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
7137 {
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
7138 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
7139
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
7140 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
7141 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
7142 {
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
7143 struct frame *f = XFRAME (frame);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7144
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7145 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
7146 /* Watch out for newly created frames. */
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7147 && 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
7148 {
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7149 XUnmapWindow (FRAME_X_DISPLAY (f),
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7150 f->output_data.x->hourglass_window);
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7151 /* 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
7152 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
7153 XSync (FRAME_X_DISPLAY (f), False);
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7154 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
7155 }
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
7156 }
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
7157
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
7158 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
7159 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
7160 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7161 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7162 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7163
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7164
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7165
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7166 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7167 Tool tips
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7168 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7169
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7170 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
7171 Lisp_Object, Lisp_Object));
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7172 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
7173 Lisp_Object, int, int, int *, int *));
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7174
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7175 /* 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
7176
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7177 Lisp_Object tip_frame;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7178
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7179 /* 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
7180 fires. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7181
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7182 Lisp_Object tip_timer;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7183 Window tip_window;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7184
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7185 /* 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
7186 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
7187
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7188 Lisp_Object last_show_tip_args;
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7189
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7190 /* 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
7191
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7192 Lisp_Object Vx_max_tooltip_size;
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7193
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7194
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7195 static Lisp_Object
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7196 unwind_create_tip_frame (frame)
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7197 Lisp_Object frame;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7198 {
34638
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
7199 Lisp_Object deleted;
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
7200
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
7201 deleted = unwind_create_frame (frame);
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
7202 if (EQ (deleted, Qt))
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
7203 {
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
7204 tip_window = NULL;
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
7205 tip_frame = Qnil;
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
7206 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7207
34638
abb4510a89f6 (unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents: 34546
diff changeset
7208 return deleted;
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7209 }
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7210
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7211
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7212 /* 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
7213 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
7214 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
7215
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7216 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
7217 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
7218 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
7219 when this happens. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7220
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7221 static Lisp_Object
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7222 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
7223 struct w32_display_info *dpyinfo;
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7224 Lisp_Object parms, text;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7225 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7226 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7227 Lisp_Object frame, tem;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7228 Lisp_Object name;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7229 long window_prompting = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7230 int width, height;
46285
3f111801efb4 Rename BINDING_STACK_SIZE to SPECPDL_INDEX.
Juanma Barranquero <lekktu@gmail.com>
parents: 46272
diff changeset
7231 int count = SPECPDL_INDEX ();
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7232 struct gcpro gcpro1, gcpro2, gcpro3;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7233 struct kboard *kb;
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7234 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
7235 Lisp_Object buffer;
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7236 struct buffer *old_buffer;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7237
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7238 check_w32 ();
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7239
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7240 /* 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
7241 this frame has a specified name. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7242 Vx_resource_name = Vinvocation_name;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7243
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7244 #ifdef MULTI_KBOARD
83878
f65f55d787ec Horizontal mouse wheel support:
Jason Rumney <jasonr@gnu.org>
parents: 83648
diff changeset
7245 kb = dpyinfo->terminal->kboard;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7246 #else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7247 kb = &the_only_kboard;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7248 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7249
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7250 /* 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
7251 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
7252 if (!STRINGP (name)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7253 && !EQ (name, Qunbound)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7254 && !NILP (name))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7255 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
7256 Vx_resource_name = name;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7257
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7258 frame = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7259 GCPRO3 (parms, name, frame);
41732
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
7260 /* 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
7261 f = make_frame (0);
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
7262 f->wants_modeline = 0;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7263 XSETFRAME (frame, f);
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7264
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7265 buffer = Fget_buffer_create (build_string (" *tip*"));
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7266 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7267 old_buffer = current_buffer;
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7268 set_buffer_internal_1 (XBUFFER (buffer));
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7269 current_buffer->truncate_lines = Qnil;
55492
43663119f752 (x_create_tip_frame): Bind inhibit-read-only and
Kenichi Handa <handa@m17n.org>
parents: 55468
diff changeset
7270 specbind (Qinhibit_read_only, Qt);
43663119f752 (x_create_tip_frame): Bind inhibit-read-only and
Kenichi Handa <handa@m17n.org>
parents: 55468
diff changeset
7271 specbind (Qinhibit_modification_hooks, Qt);
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7272 Ferase_buffer ();
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7273 Finsert (1, &text);
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7274 set_buffer_internal_1 (old_buffer);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7275
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7276 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
7277 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
7278
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7279 /* 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
7280 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
7281 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
7282 counts etc. */
83608
2ad761d6b244 (x_create_tip_frame): Set terminal and ref count.
Jason Rumney <jasonr@gnu.org>
parents: 83571
diff changeset
7283 f->terminal = dpyinfo->terminal;
2ad761d6b244 (x_create_tip_frame): Set terminal and ref count.
Jason Rumney <jasonr@gnu.org>
parents: 83571
diff changeset
7284 f->terminal->reference_count++;
27516
8001542eaee2 (w32_defined_color): Check for valid frame before
Jason Rumney <jasonr@gnu.org>
parents: 27407
diff changeset
7285 f->output_method = output_w32;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7286 f->output_data.w32 =
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7287 (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
7288 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
7289
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7290 FRAME_FONTSET (f) = -1;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7291 f->icon_name = Qnil;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7292
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7293 #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
7294 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
7295 dpyinfo_refcount = dpyinfo->reference_count;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7296 #endif /* GLYPH_DEBUG */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7297 #ifdef MULTI_KBOARD
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7298 FRAME_KBOARD (f) = kb;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7299 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7300 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
7301 f->output_data.w32->explicit_parent = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7302
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7303 /* 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
7304 be set. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7305 if (EQ (name, Qunbound) || NILP (name))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7306 {
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7307 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
7308 f->explicit_name = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7309 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7310 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7311 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7312 f->name = name;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7313 f->explicit_name = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7314 /* 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
7315 specbind (Qx_resource_name, name);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7316 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7317
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7318 /* 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
7319 that are needed to determine window geometry. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7320 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7321 Lisp_Object font;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7322
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7323 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
7324
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7325 BLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7326 /* 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
7327 if (STRINGP (font))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7328 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7329 tem = Fquery_fontset (font, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7330 if (STRINGP (tem))
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
7331 font = x_new_fontset (f, SDATA (tem));
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7332 else
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
7333 font = x_new_font (f, SDATA (font));
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7334 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7335
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7336 /* 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
7337 if (!STRINGP (font))
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7338 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
7339 if (! STRINGP (font))
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7340 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
7341 /* 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
7342 if (! STRINGP (font))
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7343 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
7344 UNBLOCK_INPUT;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7345 if (! STRINGP (font))
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7346 font = build_string ("Fixedsys");
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7347
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7348 x_default_parameter (f, parms, Qfont, font,
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7349 "font", "Font", RES_TYPE_STRING);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7350 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7351
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7352 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
7353 "borderWidth", "BorderWidth", RES_TYPE_NUMBER);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7354 /* 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
7355 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
7356 it). */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7357 if (NILP (Fassq (Qinternal_border_width, parms)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7358 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7359 Lisp_Object value;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7360
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7361 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
7362 "internalBorder", "internalBorder", RES_TYPE_NUMBER);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7363 if (! EQ (value, Qunbound))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7364 parms = Fcons (Fcons (Qinternal_border_width, value),
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7365 parms);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7366 }
41448
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
7367 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
7368 "internalBorderWidth", "internalBorderWidth",
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7369 RES_TYPE_NUMBER);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7370
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7371 /* 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
7372 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
7373 "foreground", "Foreground", RES_TYPE_STRING);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7374 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
7375 "background", "Background", RES_TYPE_STRING);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7376 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
7377 "pointerColor", "Foreground", RES_TYPE_STRING);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7378 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
7379 "cursorColor", "Foreground", RES_TYPE_STRING);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7380 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
7381 "borderColor", "BorderColor", RES_TYPE_STRING);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7382
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7383 /* 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
7384 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
7385 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
7386 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
7387 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
7388 happen. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7389 init_frame_faces (f);
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7390
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7391 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
7392 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
7393
50362
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
7394 window_prompting = x_figure_window_size (f, parms, 0);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7395
41732
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
7396 /* No fringes on tip frame. */
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7397 f->fringe_cols = 0;
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7398 f->left_fringe_width = 0;
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7399 f->right_fringe_width = 0;
41732
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
7400
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7401 BLOCK_INPUT;
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7402 my_create_tip_window (f);
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7403 UNBLOCK_INPUT;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7404
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7405 x_make_gc (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7406
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7407 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
7408 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7409 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
7410 "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7411 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
7412 "cursorType", "CursorType", RES_TYPE_SYMBOL);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7413
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7414 /* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size.
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7415 Change will not be effected unless different from the current
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7416 FRAME_LINES (f). */
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7417 width = FRAME_COLS (f);
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7418 height = FRAME_LINES (f);
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7419 FRAME_LINES (f) = 0;
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7420 SET_FRAME_COLS (f, 0);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7421 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
7422
47731
755c4233cfba * frame.c (Vdelete_frame_functions): New variable.
John Paul Wallington <jpw@pobox.com>
parents: 47161
diff changeset
7423 /* Add `tooltip' frame parameter's default value. */
755c4233cfba * frame.c (Vdelete_frame_functions): New variable.
John Paul Wallington <jpw@pobox.com>
parents: 47161
diff changeset
7424 if (NILP (Fframe_parameter (frame, intern ("tooltip"))))
755c4233cfba * frame.c (Vdelete_frame_functions): New variable.
John Paul Wallington <jpw@pobox.com>
parents: 47161
diff changeset
7425 Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt),
755c4233cfba * frame.c (Vdelete_frame_functions): New variable.
John Paul Wallington <jpw@pobox.com>
parents: 47161
diff changeset
7426 Qnil));
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7427
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7428 /* 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
7429 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
7430
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7431 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
7432 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
7433 `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
7434 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
7435 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
7436 {
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7437 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
7438
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7439 /* Set tip_frame here, so that */
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7440 tip_frame = frame;
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7441 call1 (Qface_set_after_frame_default, frame);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7442
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7443 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
7444 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
7445 Qnil));
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7446 }
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7447
83618
fe83377d2247 (x_create_tip_frame): Set window_system.
Jason Rumney <jasonr@gnu.org>
parents: 83616
diff changeset
7448 Fmodify_frame_parameters (frame, Fcons (Fcons (Qwindow_system, Qw32), Qnil));
fe83377d2247 (x_create_tip_frame): Set window_system.
Jason Rumney <jasonr@gnu.org>
parents: 83616
diff changeset
7449
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7450 f->no_split = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7451
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7452 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7453
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7454 /* 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
7455 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
7456 visible won't work. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7457 Vframe_list = Fcons (frame, Vframe_list);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7458
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7459 /* 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
7460 its display. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7461 FRAME_W32_DISPLAY_INFO (f)->reference_count++;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7462
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7463 /* 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
7464 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
7465 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
7466 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
7467 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
7468 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
7469
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7470 /* Discard the unwind_protect. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7471 return unbind_to (count, frame);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7472 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7473
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7474
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7475 /* 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
7476 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
7477 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
7478 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
7479 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
7480
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7481 static void
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7482 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
7483 struct frame *f;
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7484 Lisp_Object parms, dx, dy;
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7485 int width, height;
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7486 int *root_x, *root_y;
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7487 {
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7488 Lisp_Object left, top;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7489
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7490 /* User-specified position? */
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7491 left = Fcdr (Fassq (Qleft, parms));
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7492 top = Fcdr (Fassq (Qtop, parms));
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7493
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7494 /* 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
7495 show it. */
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7496 if (!INTEGERP (left) || !INTEGERP (top))
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7497 {
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7498 POINT pt;
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7499
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7500 BLOCK_INPUT;
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7501 GetCursorPos (&pt);
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7502 *root_x = pt.x;
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7503 *root_y = pt.y;
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7504 UNBLOCK_INPUT;
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7505 }
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7506
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7507 if (INTEGERP (top))
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7508 *root_y = XINT (top);
67581
05d48e1da3ad * xfns.c (compute_tip_xy): Handle negative dx and dy.
Jan Djärv <jan.h.d@swipnet.se>
parents: 67530
diff changeset
7509 else if (*root_y + XINT (dy) <= 0)
05d48e1da3ad * xfns.c (compute_tip_xy): Handle negative dx and dy.
Jan Djärv <jan.h.d@swipnet.se>
parents: 67530
diff changeset
7510 *root_y = 0; /* Can happen for negative dy */
67530
5b6c71adc503 * (compute_tip_xy): Calculate root_y the same way as root_x,
Jan Djärv <jan.h.d@swipnet.se>
parents: 67438
diff changeset
7511 else if (*root_y + XINT (dy) + height <= FRAME_W32_DISPLAY_INFO (f)->height)
5b6c71adc503 * (compute_tip_xy): Calculate root_y the same way as root_x,
Jan Djärv <jan.h.d@swipnet.se>
parents: 67438
diff changeset
7512 /* It fits below the pointer */
5b6c71adc503 * (compute_tip_xy): Calculate root_y the same way as root_x,
Jan Djärv <jan.h.d@swipnet.se>
parents: 67438
diff changeset
7513 *root_y += XINT (dy);
5b6c71adc503 * (compute_tip_xy): Calculate root_y the same way as root_x,
Jan Djärv <jan.h.d@swipnet.se>
parents: 67438
diff changeset
7514 else if (height + XINT (dy) <= *root_y)
5b6c71adc503 * (compute_tip_xy): Calculate root_y the same way as root_x,
Jan Djärv <jan.h.d@swipnet.se>
parents: 67438
diff changeset
7515 /* It fits above the pointer. */
5b6c71adc503 * (compute_tip_xy): Calculate root_y the same way as root_x,
Jan Djärv <jan.h.d@swipnet.se>
parents: 67438
diff changeset
7516 *root_y -= height + XINT (dy);
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7517 else
67530
5b6c71adc503 * (compute_tip_xy): Calculate root_y the same way as root_x,
Jan Djärv <jan.h.d@swipnet.se>
parents: 67438
diff changeset
7518 /* Put it on the top. */
5b6c71adc503 * (compute_tip_xy): Calculate root_y the same way as root_x,
Jan Djärv <jan.h.d@swipnet.se>
parents: 67438
diff changeset
7519 *root_y = 0;
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7520
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7521 if (INTEGERP (left))
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7522 *root_x = XINT (left);
67581
05d48e1da3ad * xfns.c (compute_tip_xy): Handle negative dx and dy.
Jan Djärv <jan.h.d@swipnet.se>
parents: 67530
diff changeset
7523 else if (*root_x + XINT (dx) <= 0)
05d48e1da3ad * xfns.c (compute_tip_xy): Handle negative dx and dy.
Jan Djärv <jan.h.d@swipnet.se>
parents: 67530
diff changeset
7524 *root_x = 0; /* Can happen for negative dx */
42537
f0e15bcba768 (compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents: 42007
diff changeset
7525 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
7526 /* 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
7527 *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
7528 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
7529 /* 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
7530 *root_x -= width + XINT (dx);
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7531 else
42537
f0e15bcba768 (compute_tip_xy): If tooltip won't fit on the screen
Jason Rumney <jasonr@gnu.org>
parents: 42007
diff changeset
7532 /* 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
7533 *root_x = 0;
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7534 }
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7535
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7536
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
7537 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
7538 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
7539 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
7540
76700
742ee8b5b284 (Fx_show_tip): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 76083
diff changeset
7541 This is an internal function; Lisp code should call `tooltip-show'.
742ee8b5b284 (Fx_show_tip): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 76083
diff changeset
7542
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
7543 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
7544
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
7545 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
7546 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
7547
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7548 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
7549 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
7550
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
7551 If the list of frame parameters PARMS 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
7552 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
7553 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
7554 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
7555 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
7556 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
7557 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
7558
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
7559 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
7560 Text larger than the specified size is clipped. */)
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
7561 (string, frame, parms, timeout, dx, dy)
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
7562 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
7563 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7564 struct frame *f;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7565 struct window *w;
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7566 int root_x, root_y;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7567 struct buffer *old_buffer;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7568 struct text_pos pos;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7569 int i, width, height;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7570 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7571 int old_windows_or_buffers_changed = windows_or_buffers_changed;
46285
3f111801efb4 Rename BINDING_STACK_SIZE to SPECPDL_INDEX.
Juanma Barranquero <lekktu@gmail.com>
parents: 46272
diff changeset
7572 int count = SPECPDL_INDEX ();
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7573
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7574 specbind (Qinhibit_redisplay, Qt);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7575
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
7576 GCPRO4 (string, parms, frame, timeout);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7577
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
7578 CHECK_STRING (string);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7579 f = check_x_frame (frame);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7580 if (NILP (timeout))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7581 timeout = make_number (5);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7582 else
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
7583 CHECK_NATNUM (timeout);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7584
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
7585 if (NILP (dx))
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
7586 dx = make_number (5);
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
7587 else
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
7588 CHECK_NUMBER (dx);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7589
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
7590 if (NILP (dy))
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7591 dy = make_number (-10);
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
7592 else
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
7593 CHECK_NUMBER (dy);
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
7594
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7595 if (NILP (last_show_tip_args))
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7596 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
7597
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7598 if (!NILP (tip_frame))
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7599 {
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7600 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
7601 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
7602 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
7603
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7604 if (EQ (frame, last_frame)
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7605 && !NILP (Fequal (last_string, string))
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7606 && !NILP (Fequal (last_parms, parms)))
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7607 {
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7608 struct frame *f = XFRAME (tip_frame);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7609
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7610 /* Only DX and DY have changed. */
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7611 if (!NILP (tip_timer))
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7612 {
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7613 Lisp_Object timer = tip_timer;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7614 tip_timer = Qnil;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7615 call1 (Qcancel_timer, timer);
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7616 }
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7617
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7618 BLOCK_INPUT;
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7619 compute_tip_xy (f, parms, dx, dy, FRAME_PIXEL_WIDTH (f),
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7620 FRAME_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
7621
3df71b933c36 (w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents: 43207
diff changeset
7622 /* 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
7623 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
7624 root_x, root_y, 0, 0,
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7625 SWP_NOSIZE | SWP_NOACTIVATE);
43210
3df71b933c36 (w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents: 43207
diff changeset
7626
3df71b933c36 (w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents: 43207
diff changeset
7627 /* 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
7628 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
7629 0, 0, 0, 0,
3df71b933c36 (w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents: 43207
diff changeset
7630 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
7631
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7632 UNBLOCK_INPUT;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7633 goto start_timer;
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7634 }
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7635 }
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7636
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7637 /* Hide a previous tip, if any. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7638 Fx_hide_tip ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7639
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7640 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
7641 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
7642 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
7643
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7644 /* Add default values to frame parameters. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7645 if (NILP (Fassq (Qname, parms)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7646 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
7647 if (NILP (Fassq (Qinternal_border_width, parms)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7648 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
7649 if (NILP (Fassq (Qborder_width, parms)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7650 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
7651 if (NILP (Fassq (Qborder_color, parms)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7652 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
7653 if (NILP (Fassq (Qbackground_color, parms)))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7654 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
7655 parms);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7656
41480
2c71c672b3c7 (x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents: 41448
diff changeset
7657 /* 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
7658 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
7659 BLOCK_INPUT;
2c71c672b3c7 (x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents: 41448
diff changeset
7660
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7661 /* 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
7662 variable tip_frame. */
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7663 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
7664 f = XFRAME (frame);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7665
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7666 /* 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
7667 w = XWINDOW (FRAME_ROOT_WINDOW (f));
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7668 w->left_col = w->top_line = make_number (0);
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7669
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7670 if (CONSP (Vx_max_tooltip_size)
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7671 && INTEGERP (XCAR (Vx_max_tooltip_size))
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7672 && 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
7673 && INTEGERP (XCDR (Vx_max_tooltip_size))
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7674 && 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
7675 {
51211
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7676 w->total_cols = XCAR (Vx_max_tooltip_size);
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7677 w->total_lines = XCDR (Vx_max_tooltip_size);
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7678 }
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7679 else
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7680 {
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7681 w->total_cols = make_number (80);
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7682 w->total_lines = make_number (40);
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7683 }
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7684
28ea05de2dc5 Make (many) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents: 50377
diff changeset
7685 FRAME_TOTAL_COLS (f) = XINT (w->total_cols);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7686 adjust_glyphs (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7687 w->pseudo_window_p = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7688
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7689 /* 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
7690 old_buffer = current_buffer;
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7691 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
7692 current_buffer->truncate_lines = Qnil;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7693 clear_glyph_matrix (w->desired_matrix);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7694 clear_glyph_matrix (w->current_matrix);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7695 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
63772
b9edfe751512 (Fx_show_tip): Pass new arg to try_window.
Richard M. Stallman <rms@gnu.org>
parents: 63704
diff changeset
7696 try_window (FRAME_ROOT_WINDOW (f), pos, 0);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7697
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7698 /* Compute width and height of the tooltip. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7699 width = height = 0;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7700 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
7701 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7702 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
7703 struct glyph *last;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7704 int row_width;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7705
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7706 /* 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
7707 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
7708 break;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7709
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7710 /* 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
7711 row->full_width_p = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7712
41638
aadcf676d5de (w32_wnd_proc) <WM_MENUSELECT>: Display help directly.
Jason Rumney <jasonr@gnu.org>
parents: 41480
diff changeset
7713 #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
7714 calculated for some tooltips. */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7715 /* 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
7716 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
7717 if (row->used[TEXT_AREA])
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7718 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7719 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
7720 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
7721 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7722 else
41638
aadcf676d5de (w32_wnd_proc) <WM_MENUSELECT>: Display help directly.
Jason Rumney <jasonr@gnu.org>
parents: 41480
diff changeset
7723 #endif
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7724 row_width = row->pixel_width;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7725
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
7726 /* 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
7727 height += row->height;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7728 width = max (width, row_width);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7729 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7730
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7731 /* 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
7732 window should have. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7733 height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7734 width += 2 * FRAME_INTERNAL_BORDER_WIDTH (f);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7735
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7736 /* 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
7737 show it. */
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
7738 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
7739
41448
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
7740 {
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
7741 /* 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
7742 RECT rect;
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
7743 rect.left = rect.top = 0;
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
7744 rect.right = width;
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
7745 rect.bottom = height;
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
7746 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
7747 FRAME_EXTERNAL_MENU_BAR (f));
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
7748
69867
847d1fc86f9d (Fx_show_tip): Add 3 to the 5th arg of SetWindowPos.
Eli Zaretskii <eliz@gnu.org>
parents: 69547
diff changeset
7749 /* Position and size tooltip, and put it in the topmost group.
847d1fc86f9d (Fx_show_tip): Add 3 to the 5th arg of SetWindowPos.
Eli Zaretskii <eliz@gnu.org>
parents: 69547
diff changeset
7750 The add-on of 3 to the 5th argument is a kludge: without it,
847d1fc86f9d (Fx_show_tip): Add 3 to the 5th arg of SetWindowPos.
Eli Zaretskii <eliz@gnu.org>
parents: 69547
diff changeset
7751 some fonts cause the last character of the tip to be truncated,
847d1fc86f9d (Fx_show_tip): Add 3 to the 5th arg of SetWindowPos.
Eli Zaretskii <eliz@gnu.org>
parents: 69547
diff changeset
7752 for some obscure reason. */
41448
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
7753 SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOPMOST,
69867
847d1fc86f9d (Fx_show_tip): Add 3 to the 5th arg of SetWindowPos.
Eli Zaretskii <eliz@gnu.org>
parents: 69547
diff changeset
7754 root_x, root_y, rect.right - rect.left + 3,
41448
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
7755 rect.bottom - rect.top, SWP_NOACTIVATE);
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
7756
43210
3df71b933c36 (w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents: 43207
diff changeset
7757 /* 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
7758 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
7759 0, 0, 0, 0,
3df71b933c36 (w32_load_system_font): Prevent Cleartype fonts from loading.
Jason Rumney <jasonr@gnu.org>
parents: 43207
diff changeset
7760 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
7761
41448
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
7762 /* 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
7763 f->async_visible = 1;
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
7764
96beda35d0fa (w32_wnd_proc) <WM_MENUSELECT>: Revert last change.
Jason Rumney <jasonr@gnu.org>
parents: 41380
diff changeset
7765 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
7766 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7767
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7768 /* Draw into the window. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7769 w->must_be_updated_p = 1;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7770 update_single_window (w, 1);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7771
41480
2c71c672b3c7 (x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents: 41448
diff changeset
7772 UNBLOCK_INPUT;
2c71c672b3c7 (x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents: 41448
diff changeset
7773
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7774 /* Restore original current buffer. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7775 set_buffer_internal_1 (old_buffer);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7776 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
7777
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7778 start_timer:
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7779 /* Let the tip disappear after timeout seconds. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7780 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
7781 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
7782
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7783 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7784 return unbind_to (count, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7785 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7786
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7787
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7788 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
7789 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
7790 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
7791 ()
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7792 {
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7793 int count;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7794 Lisp_Object deleted, frame, timer;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7795 struct gcpro gcpro1, gcpro2;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7796
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7797 /* 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
7798 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
7799 return Qnil;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7800
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7801 frame = tip_frame;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7802 timer = tip_timer;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7803 GCPRO2 (frame, timer);
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7804 tip_frame = tip_timer = deleted = Qnil;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7805
46285
3f111801efb4 Rename BINDING_STACK_SIZE to SPECPDL_INDEX.
Juanma Barranquero <lekktu@gmail.com>
parents: 46272
diff changeset
7806 count = SPECPDL_INDEX ();
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7807 specbind (Qinhibit_redisplay, Qt);
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7808 specbind (Qinhibit_quit, Qt);
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
7809
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7810 if (!NILP (timer))
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
7811 call1 (Qcancel_timer, timer);
34546
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7812
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7813 if (FRAMEP (frame))
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7814 {
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7815 Fdelete_frame (frame, Qnil);
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7816 deleted = Qt;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7817 }
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7818
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7819 UNGCPRO;
51be06b616bf (Fx_hide_tip): Avoid unnecessary work when there's
Andrew Innes <andrewi@gnu.org>
parents: 34314
diff changeset
7820 return unbind_to (count, deleted);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7821 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7822
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7823
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7824
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7825 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7826 File selection dialog
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7827 ***********************************************************************/
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7828 extern Lisp_Object Qfile_name_history;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7829
45963
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7830 /* Callback for altering the behaviour of the Open File dialog.
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7831 Makes the Filename text field contain "Current Directory" and be
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7832 read-only when "Directories" is selected in the filter. This
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7833 allows us to work around the fact that the standard Open File
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7834 dialog does not support directories. */
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7835 UINT CALLBACK
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7836 file_dialog_callback (hwnd, msg, wParam, lParam)
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7837 HWND hwnd;
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7838 UINT msg;
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7839 WPARAM wParam;
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7840 LPARAM lParam;
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7841 {
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7842 if (msg == WM_NOTIFY)
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7843 {
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7844 OFNOTIFY * notify = (OFNOTIFY *)lParam;
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7845 /* Detect when the Filter dropdown is changed. */
56263
1b78563a75d6 (file_dialog_callback): Disable edit control if set
Jason Rumney <jasonr@gnu.org>
parents: 55892
diff changeset
7846 if (notify->hdr.code == CDN_TYPECHANGE
1b78563a75d6 (file_dialog_callback): Disable edit control if set
Jason Rumney <jasonr@gnu.org>
parents: 55892
diff changeset
7847 || notify->hdr.code == CDN_INITDONE)
45963
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7848 {
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7849 HWND dialog = GetParent (hwnd);
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7850 HWND edit_control = GetDlgItem (dialog, FILE_NAME_TEXT_FIELD);
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7851
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7852 /* Directories is in index 2. */
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7853 if (notify->lpOFN->nFilterIndex == 2)
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7854 {
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7855 CommDlg_OpenSave_SetControlText (dialog, FILE_NAME_TEXT_FIELD,
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7856 "Current Directory");
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7857 EnableWindow (edit_control, FALSE);
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7858 }
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7859 else
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7860 {
56263
1b78563a75d6 (file_dialog_callback): Disable edit control if set
Jason Rumney <jasonr@gnu.org>
parents: 55892
diff changeset
7861 /* Don't override default filename on init done. */
1b78563a75d6 (file_dialog_callback): Disable edit control if set
Jason Rumney <jasonr@gnu.org>
parents: 55892
diff changeset
7862 if (notify->hdr.code == CDN_TYPECHANGE)
1b78563a75d6 (file_dialog_callback): Disable edit control if set
Jason Rumney <jasonr@gnu.org>
parents: 55892
diff changeset
7863 CommDlg_OpenSave_SetControlText (dialog,
1b78563a75d6 (file_dialog_callback): Disable edit control if set
Jason Rumney <jasonr@gnu.org>
parents: 55892
diff changeset
7864 FILE_NAME_TEXT_FIELD, "");
45963
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7865 EnableWindow (edit_control, TRUE);
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7866 }
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7867 }
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7868 }
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7869 return 0;
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7870 }
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7871
63348
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7872 /* Since we compile with _WIN32_WINNT set to 0x0400 (for NT4 compatibility)
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7873 we end up with the old file dialogs. Define a big enough struct for the
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7874 new dialog to trick GetOpenFileName into giving us the new dialogs on
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7875 Windows 2000 and XP. */
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7876 typedef struct
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7877 {
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7878 OPENFILENAME real_details;
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7879 void * pReserved;
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7880 DWORD dwReserved;
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7881 DWORD FlagsEx;
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7882 } NEWOPENFILENAME;
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7883
63704
426ba3ecedd7 (check_x_frame, check_x_display_info): Follow error conventions.
Juanma Barranquero <lekktu@gmail.com>
parents: 63348
diff changeset
7884
57868
c955f6add62a * fileio.c (Fread_file_name): Pass Qt as fifth parameter to
Jan Djärv <jan.h.d@swipnet.se>
parents: 57765
diff changeset
7885 DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
7886 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
7887 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
7888 Select DEFAULT-FILENAME in the dialog's file selection box, if
57868
c955f6add62a * fileio.c (Fread_file_name): Pass Qt as fifth parameter to
Jan Djärv <jan.h.d@swipnet.se>
parents: 57765
diff changeset
7889 specified. Ensure that file exists if MUSTMATCH is non-nil.
c955f6add62a * fileio.c (Fread_file_name): Pass Qt as fifth parameter to
Jan Djärv <jan.h.d@swipnet.se>
parents: 57765
diff changeset
7890 If ONLY-DIR-P is non-nil, the user can only select directories. */)
c955f6add62a * fileio.c (Fread_file_name): Pass Qt as fifth parameter to
Jan Djärv <jan.h.d@swipnet.se>
parents: 57765
diff changeset
7891 (prompt, dir, default_filename, mustmatch, only_dir_p)
c955f6add62a * fileio.c (Fread_file_name): Pass Qt as fifth parameter to
Jan Djärv <jan.h.d@swipnet.se>
parents: 57765
diff changeset
7892 Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7893 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7894 struct frame *f = SELECTED_FRAME ();
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7895 Lisp_Object file = Qnil;
46293
1fb8f75062c6 Use macro SPECPDL_INDEX.
Juanma Barranquero <lekktu@gmail.com>
parents: 46285
diff changeset
7896 int count = SPECPDL_INDEX ();
57868
c955f6add62a * fileio.c (Fread_file_name): Pass Qt as fifth parameter to
Jan Djärv <jan.h.d@swipnet.se>
parents: 57765
diff changeset
7897 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7898 char filename[MAX_PATH + 1];
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7899 char init_dir[MAX_PATH + 1];
56263
1b78563a75d6 (file_dialog_callback): Disable edit control if set
Jason Rumney <jasonr@gnu.org>
parents: 55892
diff changeset
7900 int default_filter_index = 1; /* 1: All Files, 2: Directories only */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7901
57868
c955f6add62a * fileio.c (Fread_file_name): Pass Qt as fifth parameter to
Jan Djärv <jan.h.d@swipnet.se>
parents: 57765
diff changeset
7902 GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file);
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
7903 CHECK_STRING (prompt);
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
7904 CHECK_STRING (dir);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7905
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7906 /* 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
7907 directory and using "*" as pattern. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7908 dir = Fexpand_file_name (dir, Qnil);
56480
5e87c40cea58 2004-07-19 KOBAYASHI Yasuhiro <kobayays@otsukakj.co.jp> (tiny change)
Jason Rumney <jasonr@gnu.org>
parents: 56430
diff changeset
7909 strncpy (init_dir, SDATA (ENCODE_FILE (dir)), MAX_PATH);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7910 init_dir[MAX_PATH] = '\0';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7911 unixtodos_filename (init_dir);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7912
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7913 if (STRINGP (default_filename))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7914 {
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7915 char *file_name_only;
56480
5e87c40cea58 2004-07-19 KOBAYASHI Yasuhiro <kobayays@otsukakj.co.jp> (tiny change)
Jason Rumney <jasonr@gnu.org>
parents: 56430
diff changeset
7916 char *full_path_name = SDATA (ENCODE_FILE (default_filename));
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7917
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7918 unixtodos_filename (full_path_name);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7919
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7920 file_name_only = strrchr (full_path_name, '\\');
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7921 if (!file_name_only)
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7922 file_name_only = full_path_name;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7923 else
56263
1b78563a75d6 (file_dialog_callback): Disable edit control if set
Jason Rumney <jasonr@gnu.org>
parents: 55892
diff changeset
7924 file_name_only++;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7925
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7926 strncpy (filename, file_name_only, MAX_PATH);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7927 filename[MAX_PATH] = '\0';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7928 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7929 else
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7930 filename[0] = '\0';
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
7931
45963
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7932 {
63348
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7933 NEWOPENFILENAME new_file_details;
63297
431c88e4a3a2 (Fx_file_dialog): Unblock input before falling back to minibuffer.
Jason Rumney <jasonr@gnu.org>
parents: 63279
diff changeset
7934 BOOL file_opened = FALSE;
63348
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7935 OPENFILENAME * file_details = &new_file_details.real_details;
63704
426ba3ecedd7 (check_x_frame, check_x_display_info): Follow error conventions.
Juanma Barranquero <lekktu@gmail.com>
parents: 63348
diff changeset
7936
45963
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7937 /* Prevent redisplay. */
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7938 specbind (Qinhibit_redisplay, Qt);
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7939 BLOCK_INPUT;
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7940
63348
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7941 bzero (&new_file_details, sizeof (new_file_details));
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7942 /* Apparently NT4 crashes if you give it an unexpected size.
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7943 I'm not sure about Windows 9x, so play it safe. */
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7944 if (w32_major_version > 4 && w32_major_version < 95)
77995
04fafc2fc785 (Fx_file_dialog): Take size from struct not pointer.
Jason Rumney <jasonr@gnu.org>
parents: 76700
diff changeset
7945 file_details->lStructSize = sizeof (NEWOPENFILENAME);
63348
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7946 else
77995
04fafc2fc785 (Fx_file_dialog): Take size from struct not pointer.
Jason Rumney <jasonr@gnu.org>
parents: 76700
diff changeset
7947 file_details->lStructSize = sizeof (OPENFILENAME);
63348
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7948
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7949 file_details->hwndOwner = FRAME_W32_WINDOW (f);
45963
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7950 /* Undocumented Bug in Common File Dialog:
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7951 If a filter is not specified, shell links are not resolved. */
63348
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7952 file_details->lpstrFilter = "All Files (*.*)\0*.*\0Directories\0*|*\0\0";
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7953 file_details->lpstrFile = filename;
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7954 file_details->nMaxFile = sizeof (filename);
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7955 file_details->lpstrInitialDir = init_dir;
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7956 file_details->lpstrTitle = SDATA (prompt);
56263
1b78563a75d6 (file_dialog_callback): Disable edit control if set
Jason Rumney <jasonr@gnu.org>
parents: 55892
diff changeset
7957
57868
c955f6add62a * fileio.c (Fread_file_name): Pass Qt as fifth parameter to
Jan Djärv <jan.h.d@swipnet.se>
parents: 57765
diff changeset
7958 if (! NILP (only_dir_p))
56263
1b78563a75d6 (file_dialog_callback): Disable edit control if set
Jason Rumney <jasonr@gnu.org>
parents: 55892
diff changeset
7959 default_filter_index = 2;
1b78563a75d6 (file_dialog_callback): Disable edit control if set
Jason Rumney <jasonr@gnu.org>
parents: 55892
diff changeset
7960
63348
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7961 file_details->nFilterIndex = default_filter_index;
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7962
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7963 file_details->Flags = (OFN_HIDEREADONLY | OFN_NOCHANGEDIR
45963
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7964 | OFN_EXPLORER | OFN_ENABLEHOOK);
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7965 if (!NILP (mustmatch))
63348
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7966 {
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7967 /* Require that the path to the parent directory exists. */
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7968 file_details->Flags |= OFN_PATHMUSTEXIST;
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7969 /* If we are looking for a file, require that it exists. */
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7970 if (NILP (only_dir_p))
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7971 file_details->Flags |= OFN_FILEMUSTEXIST;
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7972 }
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7973
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7974 file_details->lpfnHook = (LPOFNHOOKPROC) file_dialog_callback;
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7975
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7976 file_opened = GetOpenFileName (file_details);
63297
431c88e4a3a2 (Fx_file_dialog): Unblock input before falling back to minibuffer.
Jason Rumney <jasonr@gnu.org>
parents: 63279
diff changeset
7977
431c88e4a3a2 (Fx_file_dialog): Unblock input before falling back to minibuffer.
Jason Rumney <jasonr@gnu.org>
parents: 63279
diff changeset
7978 UNBLOCK_INPUT;
431c88e4a3a2 (Fx_file_dialog): Unblock input before falling back to minibuffer.
Jason Rumney <jasonr@gnu.org>
parents: 63279
diff changeset
7979
431c88e4a3a2 (Fx_file_dialog): Unblock input before falling back to minibuffer.
Jason Rumney <jasonr@gnu.org>
parents: 63279
diff changeset
7980 if (file_opened)
45963
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7981 {
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7982 dostounix_filename (filename);
63348
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7983
abe4cbe0bdef (NEWOPENFILENAME): New struct.
Jason Rumney <jasonr@gnu.org>
parents: 63340
diff changeset
7984 if (file_details->nFilterIndex == 2)
45963
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7985 {
56263
1b78563a75d6 (file_dialog_callback): Disable edit control if set
Jason Rumney <jasonr@gnu.org>
parents: 55892
diff changeset
7986 /* "Directories" selected - strip dummy file name. */
45963
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7987 char * last = strrchr (filename, '/');
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7988 *last = '\0';
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7989 }
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7990
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7991 file = DECODE_FILE(build_string (filename));
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7992 }
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7993 /* User cancelled the dialog without making a selection. */
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7994 else if (!CommDlgExtendedError ())
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7995 file = Qnil;
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7996 /* An error occurred, fallback on reading from the mini-buffer. */
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7997 else
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7998 file = Fcompleting_read (prompt, intern ("read-file-name-internal"),
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
7999 dir, mustmatch, dir, Qfile_name_history,
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
8000 default_filename, Qnil);
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
8001
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
8002 file = unbind_to (count, file);
e4d2d8c8186f (file_dialog_callback): New function.
Jason Rumney <jasonr@gnu.org>
parents: 45465
diff changeset
8003 }
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8004
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8005 UNGCPRO;
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8006
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8007 /* Make "Cancel" equivalent to C-g. */
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8008 if (NILP (file))
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8009 Fsignal (Qquit, Qnil);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8010
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8011 return unbind_to (count, file);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8012 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8013
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8014
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8015
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8016 /***********************************************************************
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8017 w32 specialized functions
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8018 ***********************************************************************/
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
8019
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
8020 DEFUN ("w32-select-font", Fw32_select_font, Sw32_select_font, 0, 2, 0,
69547
eb2730e56d3b (Fw32_select_font): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 69444
diff changeset
8021 doc: /* Select a font for the named FRAME using the W32 font dialog.
eb2730e56d3b (Fw32_select_font): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 69444
diff changeset
8022 Returns an X-style font string corresponding to the selection.
eb2730e56d3b (Fw32_select_font): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 69444
diff changeset
8023
eb2730e56d3b (Fw32_select_font): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 69444
diff changeset
8024 If FRAME is omitted or nil, it defaults to the selected frame.
eb2730e56d3b (Fw32_select_font): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 69444
diff changeset
8025 If INCLUDE-PROPORTIONAL is non-nil, include proportional fonts
eb2730e56d3b (Fw32_select_font): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 69444
diff changeset
8026 in the font selection dialog. */)
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
8027 (frame, include_proportional)
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
8028 Lisp_Object frame, include_proportional;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8029 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8030 FRAME_PTR f = check_x_frame (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8031 CHOOSEFONT cf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8032 LOGFONT lf;
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
8033 TEXTMETRIC tm;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
8034 HDC hdc;
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
8035 HANDLE oldobj;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8036 char buf[100];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8037
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8038 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
8039 bzero (&lf, sizeof (lf));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8040
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8041 cf.lStructSize = sizeof (cf);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
8042 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
8043 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
8044
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
8045 /* 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
8046 monospaced fonts. */
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
8047 if (NILP (include_proportional))
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
8048 cf.Flags |= CF_FIXEDPITCHONLY;
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
8049
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8050 cf.lpLogFont = &lf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8051
24497
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
8052 /* 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
8053 default font. */
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
8054 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
8055 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
8056 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
8057 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
8058 {
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
8059 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
8060 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
8061 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
8062 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
8063 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
8064 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
8065 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
8066 }
b09ceba3d319 (enum_font_cb2): Set the font height to be the
Geoff Voelker <voelker@cs.washington.edu>
parents: 24481
diff changeset
8067 SelectObject (hdc, oldobj);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8068 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
8069
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
8070 if (!ChooseFont (&cf) || !w32_to_x_font (&lf, buf, 100, NULL))
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14243
diff changeset
8071 return Qnil;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8072
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8073 return build_string (buf);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8074 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8075
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8076 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
8077 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
8078 doc: /* Send frame a Windows WM_SYSCOMMAND message of type COMMAND.
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
8079 Some useful values for COMMAND are #xf030 to maximize frame (#xf020
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
8080 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
8081 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
8082 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
8083
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8084 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
8085 (command, frame)
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
8086 Lisp_Object command, frame;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
8087 {
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
8088 FRAME_PTR f = check_x_frame (frame);
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
8089
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
8090 CHECK_NUMBER (command);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
8091
24718
547f54dfbb94 (x_to_w32_charset): Reinstall VIETNAMESE_CHARSET
Andrew Innes <andrewi@gnu.org>
parents: 24695
diff changeset
8092 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
8093
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
8094 return Qnil;
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
8095 }
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
8096
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8097 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
8098 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
8099 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
8100 invokes the application registered to handle OPERATION for DOCUMENT.
74350
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8101
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8102 OPERATION is either nil or a string that names a supported operation.
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8103 What operations can be used depends on the particular DOCUMENT and its
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8104 handler application, but typically it is one of the following common
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8105 operations:
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8106
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8107 \"open\" - open DOCUMENT, which could be a file, a directory, or an
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8108 executable program. If it is an application, that
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8109 application is launched in the current buffer's default
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8110 directory. Otherwise, the application associated with
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8111 DOCUMENT is launched in the buffer's default directory.
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8112 \"print\" - print DOCUMENT, which must be a file
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8113 \"explore\" - start the Windows Explorer on DOCUMENT
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8114 \"edit\" - launch an editor and open DOCUMENT for editing; which
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8115 editor is launched depends on the association for the
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8116 specified DOCUMENT
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8117 \"find\" - initiate search starting from DOCUMENT which must specify
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8118 a directory
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8119 nil - invoke the default OPERATION, or \"open\" if default is
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8120 not defined or unavailable
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8121
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8122 DOCUMENT is typically the name of a document file or a URL, but can
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8123 also be a program executable to run, or a directory to open in the
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8124 Windows Explorer.
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8125
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8126 If DOCUMENT is a program executable, the optional arg PARAMETERS can
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8127 be a string containing command line parameters that will be passed to
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8128 the program; otherwise, PARAMETERS should be nil or unspecified.
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8129
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8130 Second optional argument SHOW-FLAG can be used to control how the
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8131 application will be displayed when it is invoked. If SHOW-FLAG is nil
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8132 or unspceified, the application is displayed normally, otherwise it is
501f287c0352 (Fw32_shell_execute): Doc fix.
Eli Zaretskii <eliz@gnu.org>
parents: 74221
diff changeset
8133 an integer representing a ShowWindow flag:
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8134
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8135 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
8136 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
8137 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
8138 6 - start minimized */)
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8139 (operation, document, parameters, show_flag)
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8140 Lisp_Object operation, document, parameters, show_flag;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8141 {
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8142 Lisp_Object current_dir;
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8143
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
8144 CHECK_STRING (document);
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8145
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8146 /* Encode filename and current directory. */
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8147 current_dir = ENCODE_FILE (current_buffer->directory);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8148 document = ENCODE_FILE (document);
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8149 if ((int) ShellExecute (NULL,
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8150 (STRINGP (operation) ?
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
8151 SDATA (operation) : NULL),
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
8152 SDATA (document),
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8153 (STRINGP (parameters) ?
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
8154 SDATA (parameters) : NULL),
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
8155 SDATA (current_dir),
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8156 (INTEGERP (show_flag) ?
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8157 XINT (show_flag) : SW_SHOWDEFAULT))
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8158 > 32)
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8159 return Qt;
34698
cc62e2e0949d (Fw32_shell_execute): Use it.
Andrew Innes <andrewi@gnu.org>
parents: 34643
diff changeset
8160 error ("ShellExecute failed: %s", w32_strerror (0));
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8161 }
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
8162
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8163 /* 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
8164 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
8165 lispy_function_keys. */
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8166 static int
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8167 lookup_vk_code (char *key)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8168 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8169 int i;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8170
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8171 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
8172 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
8173 && 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
8174 return i;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8175
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8176 return -1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8177 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8178
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8179 /* 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
8180 definition. */
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8181 static Lisp_Object
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8182 w32_parse_hot_key (key)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8183 Lisp_Object key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8184 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8185 /* 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
8186 register Lisp_Object c;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8187 int vk_code;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8188 int lisp_modifiers;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8189 int w32_modifiers;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8190 struct gcpro gcpro1;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8191
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
8192 CHECK_VECTOR (key);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8193
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8194 if (XFASTINT (Flength (key)) != 1)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8195 return Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8196
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8197 GCPRO1 (key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8198
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8199 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
8200
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8201 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
8202 c = Fevent_convert_list (c);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8203
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8204 UNGCPRO;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8205
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8206 if (! INTEGERP (c) && ! SYMBOLP (c))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8207 error ("Key definition is invalid");
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8208
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8209 /* 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
8210 if (SYMBOLP (c))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8211 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8212 c = parse_modifiers (c);
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8213 lisp_modifiers = XINT (Fcar (Fcdr (c)));
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8214 c = Fcar (c);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8215 if (!SYMBOLP (c))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8216 abort ();
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
8217 vk_code = lookup_vk_code (SDATA (SYMBOL_NAME (c)));
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8218 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8219 else if (INTEGERP (c))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8220 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8221 lisp_modifiers = XINT (c) & ~CHARACTERBITS;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8222 /* 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
8223 vk_code = XINT (c) & CHARACTERBITS;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8224 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8225
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8226 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
8227 return Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8228
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8229 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
8230 && !NILP (Vw32_alt_is_meta))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8231 lisp_modifiers |= alt_modifier;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8232
31110
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
8233 /* Supply defs missing from mingw32. */
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
8234 #ifndef MOD_ALT
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
8235 #define MOD_ALT 0x0001
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
8236 #define MOD_CONTROL 0x0002
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
8237 #define MOD_SHIFT 0x0004
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
8238 #define MOD_WIN 0x0008
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
8239 #endif
9feda85db5d6 (max): Define macro.
Andrew Innes <andrewi@gnu.org>
parents: 30601
diff changeset
8240
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8241 /* 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
8242 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
8243 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
8244 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
8245 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
8246
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8247 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
8248 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8249
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8250 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
8251 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
8252 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
8253 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
8254 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
8255 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
8256 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
8257
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8258 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
8259 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
8260 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
8261 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
8262
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8263 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
8264 (key)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8265 Lisp_Object key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8266 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8267 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
8268
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8269 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
8270 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8271 /* 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
8272 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
8273
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8274 /* 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
8275 if (NILP (item))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8276 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
8277 else
39973
579177964efa Avoid (most) uses of XCAR/XCDR as lvalues, for flexibility in experimenting
Ken Raeburn <raeburn@raeburn.org>
parents: 39812
diff changeset
8278 XSETCAR (item, key);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8279
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8280 /* 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
8281 takes effect without needing to switch focus. */
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8282 #ifdef USE_LISP_UNION_TYPE
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8283 PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY,
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8284 (WPARAM) key.i, 0);
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8285 #else
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8286 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
8287 (WPARAM) key, 0);
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8288 #endif
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8289 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8290
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8291 return key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8292 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8293
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8294 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
8295 Sw32_unregister_hot_key, 1, 1, 0,
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
8296 doc: /* Unregister KEY 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
8297 (key)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8298 Lisp_Object key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8299 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8300 Lisp_Object item;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8301
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8302 if (!INTEGERP (key))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8303 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
8304
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8305 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
8306
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8307 if (!NILP (item))
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8308 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8309 /* 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
8310 that it takes effect without needing focus switch. */
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8311 #ifdef USE_LISP_UNION_TYPE
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8312 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8313 (WPARAM) XINT (XCAR (item)), (LPARAM) item.i))
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8314 #else
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8315 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
55673
4401083a1583 Fix last change for non USE_LISP_UNION_TYPE case.
Jason Rumney <jasonr@gnu.org>
parents: 55656
diff changeset
8316 (WPARAM) XINT (XCAR (item)), (LPARAM) item))
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8317
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8318 #endif
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8319 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8320 MSG msg;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8321 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
8322 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8323 return Qt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8324 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8325 return Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8326 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8327
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8328 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
8329 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
8330 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
8331 ()
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8332 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8333 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
8334 }
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8335
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8336 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
8337 Sw32_reconstruct_hot_key, 1, 1, 0,
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
8338 doc: /* Convert hot-key ID to a lisp key combination.
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
8339 usage: (w32-reconstruct-hot-key ID) */)
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8340 (hotkeyid)
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8341 Lisp_Object hotkeyid;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8342 {
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8343 int vk_code, w32_modifiers;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8344 Lisp_Object key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8345
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
8346 CHECK_NUMBER (hotkeyid);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8347
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8348 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
8349 w32_modifiers = HOTKEY_MODIFIERS (hotkeyid);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8350
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8351 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
8352 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
8353 else
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8354 key = make_number (vk_code);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8355
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8356 key = Fcons (key, Qnil);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8357 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
8358 key = Fcons (Qshift, key);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8359 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
8360 key = Fcons (Qctrl, key);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8361 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
8362 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
8363 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
8364 key = Fcons (Qhyper, key);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8365
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8366 return key;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8367 }
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8368
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8369 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
8370 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
8371 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
8372 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
8373 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
8374 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
8375 (key, new_state)
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8376 Lisp_Object key, new_state;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8377 {
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8378 int vk_code;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8379
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8380 if (EQ (key, intern ("capslock")))
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8381 vk_code = VK_CAPITAL;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8382 else if (EQ (key, intern ("kp-numlock")))
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8383 vk_code = VK_NUMLOCK;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8384 else if (EQ (key, intern ("scroll")))
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8385 vk_code = VK_SCROLL;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8386 else
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8387 return Qnil;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8388
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8389 if (!dwWindowsThreadId)
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8390 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
8391
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8392 #ifdef USE_LISP_UNION_TYPE
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8393 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8394 (WPARAM) vk_code, (LPARAM) new_state.i))
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8395 #else
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8396 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
55673
4401083a1583 Fix last change for non USE_LISP_UNION_TYPE case.
Jason Rumney <jasonr@gnu.org>
parents: 55656
diff changeset
8397 (WPARAM) vk_code, (LPARAM) new_state))
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8398 #endif
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8399 {
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8400 MSG msg;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8401 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
8402 return make_number (msg.wParam);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8403 }
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8404 return Qnil;
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8405 }
74661
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8406
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8407 DEFUN ("w32-window-exists-p", Fw32_window_exists_p, Sw32_window_exists_p,
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8408 2, 2, 0,
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8409 doc: /* Return non-nil if a window exists with the specified CLASS and NAME.
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8410
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8411 This is a direct interface to the Windows API FindWindow function. */)
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8412 (class, name)
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8413 Lisp_Object class, name;
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8414 {
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8415 HWND hnd;
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8416
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8417 if (!NILP (class))
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8418 CHECK_STRING (class);
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8419 if (!NILP (name))
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8420 CHECK_STRING (name);
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8421
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8422 hnd = FindWindow (STRINGP (class) ? ((LPCTSTR) SDATA (class)) : NULL,
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8423 STRINGP (name) ? ((LPCTSTR) SDATA (name)) : NULL);
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8424 if (!hnd)
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8425 return Qnil;
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8426 return Qt;
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8427 }
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8428
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8429
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8430
34643
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8431 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
8432 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
8433 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
8434 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
8435 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
8436 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
8437 (filename)
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8438 Lisp_Object filename;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8439 {
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8440 Lisp_Object encoded, value;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8441
40656
cdfd4d09b79a Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents: 40528
diff changeset
8442 CHECK_STRING (filename);
34643
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8443 filename = Fexpand_file_name (filename, Qnil);
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8444 encoded = ENCODE_FILE (filename);
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8445
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8446 value = Qnil;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8447
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8448 /* Determining the required information on Windows turns out, sadly,
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8449 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
8450 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
8451 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
8452 added rather late on. */
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8453 {
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8454 HMODULE hKernel = GetModuleHandle ("kernel32");
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8455 BOOL (*pfn_GetDiskFreeSpaceEx)
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8456 (char *, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER)
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8457 = (void *) GetProcAddress (hKernel, "GetDiskFreeSpaceEx");
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8458
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8459 /* 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
8460 volume holding FILENAME. */
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8461 char rootname[MAX_PATH];
46370
40db0673e6f0 Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents: 46293
diff changeset
8462 char *name = SDATA (encoded);
34643
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8463
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8464 /* find the root name of the volume if given */
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8465 if (isalpha (name[0]) && name[1] == ':')
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8466 {
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8467 rootname[0] = name[0];
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8468 rootname[1] = name[1];
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8469 rootname[2] = '\\';
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8470 rootname[3] = 0;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8471 }
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8472 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
8473 {
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8474 char *str = rootname;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8475 int slashes = 4;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8476 do
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8477 {
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8478 if (IS_DIRECTORY_SEP (*name) && --slashes == 0)
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8479 break;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8480 *str++ = *name++;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8481 }
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8482 while ( *name );
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8483
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8484 *str++ = '\\';
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8485 *str = 0;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8486 }
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8487
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8488 if (pfn_GetDiskFreeSpaceEx)
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8489 {
44047
73645cbc79a7 (x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents: 43963
diff changeset
8490 /* 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
8491 use signed ones instead. */
34643
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8492 LARGE_INTEGER availbytes;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8493 LARGE_INTEGER freebytes;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8494 LARGE_INTEGER totalbytes;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8495
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8496 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
8497 (ULARGE_INTEGER *)&availbytes,
73645cbc79a7 (x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents: 43963
diff changeset
8498 (ULARGE_INTEGER *)&totalbytes,
73645cbc79a7 (x_set_cursor_color): Set foreground of cursor, not frame.
Jason Rumney <jasonr@gnu.org>
parents: 43963
diff changeset
8499 (ULARGE_INTEGER *)&freebytes))
34643
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8500 value = list3 (make_float ((double) totalbytes.QuadPart),
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8501 make_float ((double) freebytes.QuadPart),
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8502 make_float ((double) availbytes.QuadPart));
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8503 }
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8504 else
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8505 {
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8506 DWORD sectors_per_cluster;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8507 DWORD bytes_per_sector;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8508 DWORD free_clusters;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8509 DWORD total_clusters;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8510
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8511 if (GetDiskFreeSpace(rootname,
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8512 &sectors_per_cluster,
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8513 &bytes_per_sector,
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8514 &free_clusters,
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8515 &total_clusters))
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8516 value = list3 (make_float ((double) total_clusters
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8517 * sectors_per_cluster * bytes_per_sector),
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8518 make_float ((double) free_clusters
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8519 * sectors_per_cluster * bytes_per_sector),
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8520 make_float ((double) free_clusters
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8521 * sectors_per_cluster * bytes_per_sector));
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8522 }
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8523 }
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8524
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8525 return value;
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8526 }
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
8527
53739
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8528 DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name,
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8529 0, 0, 0, doc: /* Return the name of Windows default printer device. */)
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8530 ()
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8531 {
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8532 static char pname_buf[256];
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8533 int err;
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8534 HANDLE hPrn;
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8535 PRINTER_INFO_2 *ppi2 = NULL;
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8536 DWORD dwNeeded = 0, dwReturned = 0;
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8537
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8538 /* Retrieve the default string from Win.ini (the registry).
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8539 * String will be in form "printername,drivername,portname".
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8540 * This is the most portable way to get the default printer. */
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8541 if (GetProfileString ("windows", "device", ",,", pname_buf, sizeof (pname_buf)) <= 0)
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8542 return Qnil;
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8543 /* printername precedes first "," character */
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8544 strtok (pname_buf, ",");
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8545 /* We want to know more than the printer name */
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8546 if (!OpenPrinter (pname_buf, &hPrn, NULL))
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8547 return Qnil;
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8548 GetPrinter (hPrn, 2, NULL, 0, &dwNeeded);
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8549 if (dwNeeded == 0)
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8550 {
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8551 ClosePrinter (hPrn);
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8552 return Qnil;
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8553 }
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8554 /* Allocate memory for the PRINTER_INFO_2 struct */
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8555 ppi2 = (PRINTER_INFO_2 *) xmalloc (dwNeeded);
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8556 if (!ppi2)
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8557 {
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8558 ClosePrinter (hPrn);
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8559 return Qnil;
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8560 }
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8561 /* Call GetPrinter() again with big enouth memory block */
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8562 err = GetPrinter (hPrn, 2, (LPBYTE)ppi2, dwNeeded, &dwReturned);
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8563 ClosePrinter (hPrn);
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8564 if (!err)
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8565 {
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8566 xfree(ppi2);
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8567 return Qnil;
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8568 }
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8569
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8570 if (ppi2)
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8571 {
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8572 if (ppi2->Attributes & PRINTER_ATTRIBUTE_SHARED && ppi2->pServerName)
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8573 {
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8574 /* a remote printer */
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8575 if (*ppi2->pServerName == '\\')
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8576 _snprintf(pname_buf, sizeof (pname_buf), "%s\\%s", ppi2->pServerName,
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8577 ppi2->pShareName);
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8578 else
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8579 _snprintf(pname_buf, sizeof (pname_buf), "\\\\%s\\%s", ppi2->pServerName,
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8580 ppi2->pShareName);
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8581 pname_buf[sizeof (pname_buf) - 1] = '\0';
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8582 }
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8583 else
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8584 {
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8585 /* a local printer */
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8586 strncpy(pname_buf, ppi2->pPortName, sizeof (pname_buf));
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8587 pname_buf[sizeof (pname_buf) - 1] = '\0';
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8588 /* `pPortName' can include several ports, delimited by ','.
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8589 * we only use the first one. */
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8590 strtok(pname_buf, ",");
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8591 }
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8592 xfree(ppi2);
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8593 }
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8594
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8595 return build_string (pname_buf);
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8596 }
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
8597
41480
2c71c672b3c7 (x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents: 41448
diff changeset
8598 /***********************************************************************
2c71c672b3c7 (x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents: 41448
diff changeset
8599 Initialization
2c71c672b3c7 (x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents: 41448
diff changeset
8600 ***********************************************************************/
2c71c672b3c7 (x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents: 41448
diff changeset
8601
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
8602 /* Keep this list in the same order as frame_parms in frame.c.
50362
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8603 Use 0 for unsupported frame parameters. */
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8604
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8605 frame_parm_handler w32_frame_parm_handlers[] =
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8606 {
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8607 x_set_autoraise,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8608 x_set_autolower,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8609 x_set_background_color,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8610 x_set_border_color,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8611 x_set_border_width,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8612 x_set_cursor_color,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8613 x_set_cursor_type,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8614 x_set_font,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8615 x_set_foreground_color,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8616 x_set_icon_name,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8617 x_set_icon_type,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8618 x_set_internal_border_width,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8619 x_set_menu_bar_lines,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8620 x_set_mouse_color,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8621 x_explicitly_set_name,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8622 x_set_scroll_bar_width,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8623 x_set_title,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8624 x_set_unsplittable,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8625 x_set_vertical_scroll_bars,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8626 x_set_visibility,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8627 x_set_tool_bar_lines,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8628 0, /* x_set_scroll_bar_foreground, */
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8629 0, /* x_set_scroll_bar_background, */
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8630 x_set_screen_gamma,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8631 x_set_line_spacing,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8632 x_set_fringe_width,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8633 x_set_fringe_width,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8634 0, /* x_set_wait_for_wm, */
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8635 x_set_fullscreen,
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8636 };
6d942c1d5f2d * w32fns.c (Qauto_raise, Qauto_lower, ...): Remove vars for frame
Kim F. Storm <storm@cua.dk>
parents: 50229
diff changeset
8637
41480
2c71c672b3c7 (x_create_tip_frame): Set frame's fringes_extra to 0.
Jason Rumney <jasonr@gnu.org>
parents: 41448
diff changeset
8638 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
8639 syms_of_w32fns ()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8640 {
49455
a6825c5c7ce7 (init_jpeg_functions, jpeg_resync_to_restart_wrapper):
Jason Rumney <jasonr@gnu.org>
parents: 49448
diff changeset
8641 globals_of_w32fns ();
a6825c5c7ce7 (init_jpeg_functions, jpeg_resync_to_restart_wrapper):
Jason Rumney <jasonr@gnu.org>
parents: 49448
diff changeset
8642 /* This is zero if not using MS-Windows. */
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
8643 w32_in_use = 0;
41732
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
8644 track_mouse_window = NULL;
0d9b74cd27cd (trackmouse_window, track_mouse_event_fn): New vars.
Jason Rumney <jasonr@gnu.org>
parents: 41726
diff changeset
8645
42918
9b06036a8c5e (syms_of_w32fns): Initialize w32_visible_system_caret_hwnd.
Jason Rumney <jasonr@gnu.org>
parents: 42865
diff changeset
8646 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
8647
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8648 Qnone = intern ("none");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8649 staticpro (&Qnone);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8650 Qsuppress_icon = intern ("suppress-icon");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8651 staticpro (&Qsuppress_icon);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8652 Qundefined_color = intern ("undefined-color");
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8653 staticpro (&Qundefined_color);
36000
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
8654 Qcancel_timer = intern ("cancel-timer");
f4a0b086cc5d (Fx_show_tip): Fix calls to make_number.
Jason Rumney <jasonr@gnu.org>
parents: 35674
diff changeset
8655 staticpro (&Qcancel_timer);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8656
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8657 Qhyper = intern ("hyper");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8658 staticpro (&Qhyper);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8659 Qsuper = intern ("super");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8660 staticpro (&Qsuper);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8661 Qmeta = intern ("meta");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8662 staticpro (&Qmeta);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8663 Qalt = intern ("alt");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8664 staticpro (&Qalt);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8665 Qctrl = intern ("ctrl");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8666 staticpro (&Qctrl);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8667 Qcontrol = intern ("control");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8668 staticpro (&Qcontrol);
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8669 Qshift = intern ("shift");
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8670 staticpro (&Qshift);
43398
8782b8cfed62 *** empty log message ***
Jason Rumney <jasonr@gnu.org>
parents: 43210
diff changeset
8671 /* 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
8672
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8673 /* 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
8674 Vtext_property_default_nonsticky
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8675 = 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
8676
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8677
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8678 Fput (Qundefined_color, Qerror_conditions,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8679 Fcons (Qundefined_color, Fcons (Qerror, Qnil)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8680 Fput (Qundefined_color, Qerror_message,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8681 build_string ("Undefined color"));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8682
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8683 staticpro (&w32_grabbed_keys);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8684 w32_grabbed_keys = Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8685
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
8686 DEFVAR_LISP ("w32-color-map", &Vw32_color_map,
55892
c12c7852c322 (Fx_display_grayscale_p, Fw32_send_sys_command, Vw32_color_map):
Juanma Barranquero <lekktu@gmail.com>
parents: 55673
diff changeset
8687 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
8688 Vw32_color_map = Qnil;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
8689
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
8690 DEFVAR_LISP ("w32-pass-alt-to-system", &Vw32_pass_alt_to_system,
73087
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8691 doc: /* Non-nil if Alt key presses are passed on to Windows.
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8692 When non-nil, for example, Alt pressed and released and then space will
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8693 open the System menu. When nil, Emacs processes the Alt key events, and
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8694 then silently swallows them. */);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
8695 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
8696
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
8697 DEFVAR_LISP ("w32-alt-is-meta", &Vw32_alt_is_meta,
73087
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8698 doc: /* Non-nil if the Alt key is to be considered the same as the META key.
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8699 When nil, Emacs will translate the Alt key to the ALT modifier, not to META. */);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
8700 Vw32_alt_is_meta = Qt;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
8701
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8702 DEFVAR_INT ("w32-quit-key", &w32_quit_key,
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8703 doc: /* If non-zero, the virtual key code for an alternative quit key. */);
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8704 w32_quit_key = 0;
24339
e8b73c2ac4ec (Vw32_quit_key): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24252
diff changeset
8705
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
8706 DEFVAR_LISP ("w32-pass-lwindow-to-system",
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8707 &Vw32_pass_lwindow_to_system,
73087
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8708 doc: /* If non-nil, the left \"Windows\" key is passed on to Windows.
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8709
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8710 When non-nil, the Start menu is opened by tapping the key.
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8711 If you set this to nil, the left \"Windows\" key is processed by Emacs
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8712 according to the value of `w32-lwindow-modifier', which see.
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8713
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8714 Note that some combinations of the left \"Windows\" key with other keys are
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8715 caught by Windows at low level, and so binding them in Emacs will have no
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8716 effect. For example, <lwindow>-r always pops up the Windows Run dialog,
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8717 <lwindow>-<Pause> pops up the "System Properties" dialog, etc. However, see
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8718 the doc string of `w32-phantom-key-code'. */);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8719 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
8720
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
8721 DEFVAR_LISP ("w32-pass-rwindow-to-system",
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8722 &Vw32_pass_rwindow_to_system,
73087
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8723 doc: /* If non-nil, the right \"Windows\" key is passed on to Windows.
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8724
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8725 When non-nil, the Start menu is opened by tapping the key.
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8726 If you set this to nil, the right \"Windows\" key is processed by Emacs
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8727 according to the value of `w32-rwindow-modifier', which see.
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8728
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8729 Note that some combinations of the right \"Windows\" key with other keys are
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8730 caught by Windows at low level, and so binding them in Emacs will have no
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8731 effect. For example, <rwindow>-r always pops up the Windows Run dialog,
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8732 <rwindow>-<Pause> pops up the "System Properties" dialog, etc. However, see
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8733 the doc string of `w32-phantom-key-code'. */);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8734 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
8735
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8736 DEFVAR_LISP ("w32-phantom-key-code",
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8737 &Vw32_phantom_key_code,
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8738 doc: /* Virtual key code used to generate \"phantom\" key presses.
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8739 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
8740
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8741 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
8742 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
8743 `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
8744 /* 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
8745 means that this hack won't interfere with any real key code. */
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8746 XSETINT (Vw32_phantom_key_code, 255);
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
8747
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
8748 DEFVAR_LISP ("w32-enable-num-lock",
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8749 &Vw32_enable_num_lock,
73087
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8750 doc: /* If non-nil, the Num Lock key acts normally.
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8751 Set to nil to handle Num Lock as the `kp-numlock' key. */);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8752 Vw32_enable_num_lock = Qt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8753
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
8754 DEFVAR_LISP ("w32-enable-caps-lock",
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8755 &Vw32_enable_caps_lock,
73087
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8756 doc: /* If non-nil, the Caps Lock key acts normally.
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8757 Set to nil to handle Caps Lock as the `capslock' key. */);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8758 Vw32_enable_caps_lock = Qt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8759
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8760 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
8761 &Vw32_scroll_lock_modifier,
73087
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8762 doc: /* Modifier to use for the Scroll Lock ON state.
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8763 The value can be hyper, super, meta, alt, control or shift for the
73087
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8764 respective modifier, or nil to handle Scroll Lock as the `scroll' key.
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8765 Any other value will cause the Scroll Lock key to be ignored. */);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8766 Vw32_scroll_lock_modifier = Qt;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8767
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8768 DEFVAR_LISP ("w32-lwindow-modifier",
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8769 &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
8770 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
8771 The value can be hyper, super, meta, alt, control or shift for the
73087
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8772 respective modifier, or nil to appear as the `lwindow' key.
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8773 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
8774 Vw32_lwindow_modifier = Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8775
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8776 DEFVAR_LISP ("w32-rwindow-modifier",
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8777 &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
8778 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
8779 The value can be hyper, super, meta, alt, control or shift for the
73087
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8780 respective modifier, or nil to appear as the `rwindow' key.
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8781 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
8782 Vw32_rwindow_modifier = Qnil;
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8783
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8784 DEFVAR_LISP ("w32-apps-modifier",
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
8785 &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
8786 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
8787 The value can be hyper, super, meta, alt, control or shift for the
73087
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8788 respective modifier, or nil to appear as the `apps' key.
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8789 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
8790 Vw32_apps_modifier = Qnil;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
8791
42845
ebb3a20bc357 (w32_load_system_font, w32_to_x_charset): Use strnicmp
Jason Rumney <jasonr@gnu.org>
parents: 42833
diff changeset
8792 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
8793 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
8794 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
8795
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
8796 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
8797 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
8798 Vw32_enable_palette = Qt;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
8799
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
8800 DEFVAR_INT ("w32-mouse-button-tolerance",
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8801 &w32_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
8802 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
8803 The value is the minimum time in milliseconds that must elapse between
73087
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8804 left and right button down events before they are considered distinct events.
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8805 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
8806 button down event is generated instead. */);
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8807 w32_mouse_button_tolerance = GetDoubleClickTime () / 2;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
8808
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
8809 DEFVAR_INT ("w32-mouse-move-interval",
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8810 &w32_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
8811 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
8812 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
8813 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
8814 reported as lisp events. */);
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
8815 w32_mouse_move_interval = 0;
15290
da73440fdb5f (Vwin32_mouse_move_interval): New lisp variable.
Karl Heuer <kwzh@gnu.org>
parents: 15280
diff changeset
8816
42719
70f13c4f82c7 (w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents: 42537
diff changeset
8817 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
8818 &w32_pass_extra_mouse_buttons_to_system,
73087
9ce57eb0c589 (w32-pass-alt-to-system, w32-alt-is-meta)
Eli Zaretskii <eliz@gnu.org>
parents: 72529
diff changeset
8819 doc: /* If non-nil, the fourth and fifth mouse buttons are passed to Windows.
42719
70f13c4f82c7 (w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents: 42537
diff changeset
8820 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
8821 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
8822 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
8823 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
8824 system to handle them. */);
70f13c4f82c7 (w32_pass_extra_mouse_buttons_to_system): New user option.
Jason Rumney <jasonr@gnu.org>
parents: 42537
diff changeset
8825 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
8826
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8827 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
8828 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
8829 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
8830 unless you set the mouse color. */);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8831 Vx_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8832
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8833 Vx_nontext_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8834
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8835 Vx_mode_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8836
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
8837 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
8838 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
8839 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
8840 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
8841 Vx_hourglass_pointer_shape = Qnil;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
8842
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
8843 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
8844 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
8845 display_hourglass_p = 1;
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
8846
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
8847 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
8848 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
8849 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
8850 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
8851
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
8852 DEFVAR_LISP ("x-sensitive-text-pointer-shape",
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8853 &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
8854 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
8855 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
8856 or when you set the mouse color. */);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8857 Vx_sensitive_text_pointer_shape = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8858
34133
f1063cc498e4 (Fx_create_frame): Reintroduce the call to face-set-after-frame-defaults.
Jason Rumney <jasonr@gnu.org>
parents: 34089
diff changeset
8859 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
8860 &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
8861 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
8862 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
8863 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
8864 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
8865
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8866 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
8867 doc: /* A string indicating the foreground color of the cursor box. */);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8868 Vx_cursor_fore_pixel = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8869
40120
03eb905a4d8e (Fx_file_dialog): Pass a filter to GetOpenFileName.
Jason Rumney <jasonr@gnu.org>
parents: 40009
diff changeset
8870 DEFVAR_LISP ("x-max-tooltip-size", &Vx_max_tooltip_size,
41019
aa792c415dd6 Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 41008
diff changeset
8871 doc: /* Maximum size for tooltips.
aa792c415dd6 Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 41008
diff changeset
8872 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
8873 Vx_max_tooltip_size = Fcons (make_number (80), make_number (40));
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
8874
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8875 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
8876 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
8877 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
8878 unless you set it to something else. */);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8879 /* We don't have any way to find this out, so set it to nil
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8880 and maybe the user would like to set it to t. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8881 Vx_no_window_manager = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8882
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
8883 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
8884 &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
8885 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
8886
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8887 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
8888 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
8889 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
8890 Chinese, Japanese, and Korean. */);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
8891 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
8892
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
8893 DEFVAR_LISP ("w32-bdf-filename-alist",
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
8894 &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
8895 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
8896 Vw32_bdf_filename_alist = Qnil;
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
8897
24481
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
8898 DEFVAR_BOOL ("w32-strict-fontnames",
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
8899 &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
8900 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
8901 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
8902 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
8903 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
8904 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
8905 fontsets are automatically created. */);
24481
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
8906 w32_strict_fontnames = 0;
f65692fe7dd5 (w32_strict_fontnames): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24479
diff changeset
8907
24695
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
8908 DEFVAR_BOOL ("w32-strict-painting",
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
8909 &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
8910 doc: /* Non-nil means use strict rules for repainting frames.
63279
091ece2ed577 (syms_of_w32fns): Fix spellings.
Juanma Barranquero <lekktu@gmail.com>
parents: 59333
diff changeset
8911 Set this to nil to get the old behavior for repainting; this should
40964
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8912 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
8913 w32_strict_painting = 1;
2fe2c743ce68 (w32_strict_painting): New variable.
Andrew Innes <andrewi@gnu.org>
parents: 24692
diff changeset
8914
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8915 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
8916 &Vw32_charset_info_alist,
41019
aa792c415dd6 Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 41008
diff changeset
8917 doc: /* Alist linking Emacs character sets to Windows fonts and codepages.
aa792c415dd6 Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 41008
diff changeset
8918 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
8919
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8920 (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
8921
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8922 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
8923 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
8924 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
8925 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
8926 w32-charset-chinesebig5,
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8927 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
8928 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
8929 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
8930 w32-charset-russian, w32-charset-mac, w32-charset-baltic,
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8931 w32-charset-unicode,
fb970d0c56eb Change doc-string comments to `new style'. [w/`doc:' keyword]. Doc fixes.
Jason Rumney <jasonr@gnu.org>
parents: 40873
diff changeset
8932 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
8933 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
8934 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
8935 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
8936 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
8937 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
8938
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8939 staticpro (&Qw32_charset_ansi);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8940 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
8941 staticpro (&Qw32_charset_symbol);
64487
c9a7bffa9534 (Vx_hand_shape): Variable removed.
Kim F. Storm <storm@cua.dk>
parents: 64084
diff changeset
8942 Qw32_charset_default = intern ("w32-charset-default");
c9a7bffa9534 (Vx_hand_shape): Variable removed.
Kim F. Storm <storm@cua.dk>
parents: 64084
diff changeset
8943 staticpro (&Qw32_charset_default);
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8944 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
8945 staticpro (&Qw32_charset_shiftjis);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8946 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
8947 staticpro (&Qw32_charset_hangeul);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
8948 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
8949 staticpro (&Qw32_charset_chinesebig5);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8950 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
8951 staticpro (&Qw32_charset_gb2312);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8952 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
8953 staticpro (&Qw32_charset_oem);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8954 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
8955
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8956 #ifdef JOHAB_CHARSET
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8957 {
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8958 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
8959 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
8960 doc: /* Internal variable. */);
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8961
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8962 staticpro (&Qw32_charset_johab);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8963 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
8964 staticpro (&Qw32_charset_easteurope);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8965 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
8966 staticpro (&Qw32_charset_turkish);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8967 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
8968 staticpro (&Qw32_charset_baltic);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8969 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
8970 staticpro (&Qw32_charset_russian);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8971 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
8972 staticpro (&Qw32_charset_arabic);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8973 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
8974 staticpro (&Qw32_charset_greek);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8975 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
8976 staticpro (&Qw32_charset_hebrew);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8977 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
8978 staticpro (&Qw32_charset_vietnamese);
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
8979 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
8980 staticpro (&Qw32_charset_thai);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8981 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
8982 staticpro (&Qw32_charset_mac);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8983 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
8984 }
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8985 #endif
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8986
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8987 #ifdef UNICODE_CHARSET
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8988 {
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8989 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
8990 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
8991 &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
8992 doc: /* Internal variable. */);
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8993
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8994 staticpro (&Qw32_charset_unicode);
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8995 Qw32_charset_unicode = intern ("w32-charset-unicode");
74661
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
8996 }
29317
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8997 #endif
2d3d5bf49d4e Format and doc changes to bring closer to xfns.c.
Jason Rumney <jasonr@gnu.org>
parents: 29021
diff changeset
8998
33387
01a10bc04233 (Qw32_charset_hangeul): Rename to match w32 headers.
Jason Rumney <jasonr@gnu.org>
parents: 33216
diff changeset
8999 #if 0 /* TODO: Port to W32 */
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9000 defsubr (&Sx_change_window_property);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9001 defsubr (&Sx_delete_window_property);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9002 defsubr (&Sx_window_property);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9003 #endif
26729
f5dded41adcc Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents: 25646
diff changeset
9004 defsubr (&Sxw_display_color_p);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9005 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
9006 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
9007 defsubr (&Sxw_color_values);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9008 defsubr (&Sx_server_max_request_size);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9009 defsubr (&Sx_server_vendor);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9010 defsubr (&Sx_server_version);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9011 defsubr (&Sx_display_pixel_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9012 defsubr (&Sx_display_pixel_height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9013 defsubr (&Sx_display_mm_width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9014 defsubr (&Sx_display_mm_height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9015 defsubr (&Sx_display_screens);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9016 defsubr (&Sx_display_planes);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9017 defsubr (&Sx_display_color_cells);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9018 defsubr (&Sx_display_visual_class);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9019 defsubr (&Sx_display_backing_store);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9020 defsubr (&Sx_display_save_under);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9021 defsubr (&Sx_create_frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9022 defsubr (&Sx_open_connection);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9023 defsubr (&Sx_close_connection);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9024 defsubr (&Sx_display_list);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9025 defsubr (&Sx_synchronize);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9026
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
9027 /* W32 specific functions */
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
9028
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
9029 defsubr (&Sw32_focus_frame);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
9030 defsubr (&Sw32_select_font);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
9031 defsubr (&Sw32_define_rgb_color);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
9032 defsubr (&Sw32_default_color_map);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
9033 defsubr (&Sw32_load_color_file);
19707
0181cc080316 Include limits.h and errno.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18508
diff changeset
9034 defsubr (&Sw32_send_sys_command);
24670
045e247575d9 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24583
diff changeset
9035 defsubr (&Sw32_shell_execute);
23681
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
9036 defsubr (&Sw32_register_hot_key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
9037 defsubr (&Sw32_unregister_hot_key);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
9038 defsubr (&Sw32_registered_hot_keys);
af0276da2059 (Vw32_pass_optional_keys_to_system): Variable removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23637
diff changeset
9039 defsubr (&Sw32_reconstruct_hot_key);
23803
f112aa8f8f5d (Vw32_phantom_key_code): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23801
diff changeset
9040 defsubr (&Sw32_toggle_lock_key);
74661
0b62ec4c4929 (w32-window-exists-p): New function.
Eli Zaretskii <eliz@gnu.org>
parents: 74618
diff changeset
9041 defsubr (&Sw32_window_exists_p);
24147
c83b0bc4e8b9 (Vw32_bdf_filename_alist): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24130
diff changeset
9042 defsubr (&Sw32_find_bdf_fonts);
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
9043
34643
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
9044 defsubr (&Sfile_system_info);
53739
5456cd83c404 * makefile.w32-in, w32fns.c: Add `default-printer-name' function.
Jason Rumney <jasonr@gnu.org>
parents: 53332
diff changeset
9045 defsubr (&Sdefault_printer_name);
34643
7108531c744b (Ffile_system_info): New function.
Andrew Innes <andrewi@gnu.org>
parents: 34638
diff changeset
9046
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
9047 /* Setting callback functions for fontset handler. */
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
9048 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
9049
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9050 #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
9051 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
9052 list_fonts_func = w32_list_fonts;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9053 #endif
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9054
23506
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
9055 load_font_func = w32_load_font;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
9056 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
9057 query_font_func = w32_query_font;
246a14f0622f (Vx_pixel_size_width): New global variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23407
diff changeset
9058 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
9059 check_window_system_func = check_w32;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9060
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9061
36252
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
9062 hourglass_atimer = NULL;
a8630c63f7d5 Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents: 36080
diff changeset
9063 hourglass_shown_p = 0;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9064 defsubr (&Sx_show_tip);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9065 defsubr (&Sx_hide_tip);
34729
3dc60d80125f (syms_of_w32fns): Initialize and staticpro tip_frame.
Jason Rumney <jasonr@gnu.org>
parents: 34698
diff changeset
9066 tip_timer = Qnil;
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9067 staticpro (&tip_timer);
34729
3dc60d80125f (syms_of_w32fns): Initialize and staticpro tip_frame.
Jason Rumney <jasonr@gnu.org>
parents: 34698
diff changeset
9068 tip_frame = Qnil;
3dc60d80125f (syms_of_w32fns): Initialize and staticpro tip_frame.
Jason Rumney <jasonr@gnu.org>
parents: 34698
diff changeset
9069 staticpro (&tip_frame);
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9070
41380
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
9071 last_show_tip_args = Qnil;
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
9072 staticpro (&last_show_tip_args);
aff1b15f295b (x_window_to_frame): Remove irrelevant TODO comment.
Jason Rumney <jasonr@gnu.org>
parents: 41322
diff changeset
9073
27397
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9074 defsubr (&Sx_file_dialog);
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9075 }
d98e84b468a2 Substantial rewrite for new redisplay. Major changes:
Jason Rumney <jasonr@gnu.org>
parents: 26729
diff changeset
9076
49494
07f0ea120d7d (init_external_image_libraries): Try alternate names for the jpeg dll.
Juanma Barranquero <lekktu@gmail.com>
parents: 49455
diff changeset
9077
48888
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
9078 /*
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
9079 globals_of_w32fns is used to initialize those global variables that
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
9080 must always be initialized on startup even when the global variable
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
9081 initialized is non zero (see the function main in emacs.c).
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
9082 globals_of_w32fns is called from syms_of_w32fns when the global
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
9083 variable initialized is 0 and directly from main when initialized
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
9084 is non zero.
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
9085 */
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
9086 void globals_of_w32fns ()
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
9087 {
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
9088 HMODULE user32_lib = GetModuleHandle ("user32.dll");
51776
6a03280c654a (clipboard_sequence_fn): New variable.
Jason Rumney <jasonr@gnu.org>
parents: 51763
diff changeset
9089 /*
6a03280c654a (clipboard_sequence_fn): New variable.
Jason Rumney <jasonr@gnu.org>
parents: 51763
diff changeset
9090 TrackMouseEvent not available in all versions of Windows, so must load
6a03280c654a (clipboard_sequence_fn): New variable.
Jason Rumney <jasonr@gnu.org>
parents: 51763
diff changeset
9091 it dynamically. Do it once, here, instead of every time it is used.
48888
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
9092 */
51776
6a03280c654a (clipboard_sequence_fn): New variable.
Jason Rumney <jasonr@gnu.org>
parents: 51763
diff changeset
9093 track_mouse_event_fn = (TrackMouseEvent_Proc)
6a03280c654a (clipboard_sequence_fn): New variable.
Jason Rumney <jasonr@gnu.org>
parents: 51763
diff changeset
9094 GetProcAddress (user32_lib, "TrackMouseEvent");
6a03280c654a (clipboard_sequence_fn): New variable.
Jason Rumney <jasonr@gnu.org>
parents: 51763
diff changeset
9095 /* ditto for GetClipboardSequenceNumber. */
6a03280c654a (clipboard_sequence_fn): New variable.
Jason Rumney <jasonr@gnu.org>
parents: 51763
diff changeset
9096 clipboard_sequence_fn = (ClipboardSequence_Proc)
6a03280c654a (clipboard_sequence_fn): New variable.
Jason Rumney <jasonr@gnu.org>
parents: 51763
diff changeset
9097 GetProcAddress (user32_lib, "GetClipboardSequenceNumber");
55468
f13a7f45ce0f (Vw32_ansi_code_page): New Lisp variable.
Jason Rumney <jasonr@gnu.org>
parents: 54336
diff changeset
9098
f13a7f45ce0f (Vw32_ansi_code_page): New Lisp variable.
Jason Rumney <jasonr@gnu.org>
parents: 54336
diff changeset
9099 DEFVAR_INT ("w32-ansi-code-page",
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
9100 &w32_ansi_code_page,
55468
f13a7f45ce0f (Vw32_ansi_code_page): New Lisp variable.
Jason Rumney <jasonr@gnu.org>
parents: 54336
diff changeset
9101 doc: /* The ANSI code page used by the system. */);
55656
29b250a07fe0 (Fw32_register_hot_key, Fw32_unregister_hot_key)
Jason Rumney <jasonr@gnu.org>
parents: 55592
diff changeset
9102 w32_ansi_code_page = GetACP ();
48888
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
9103 }
f0df5f687c15 Revisited my earlier fix for the following entry in etc/PROBLEMS: 'Emacs built on Windows 9x/ME crashes at startup on Windows XP, or Emacs builtpart of on XP crashes at startup on Windows 9x/ME.' Fixed several Windows API errors detected by BoundsChecker
Ben Key <bkey1@tampabay.rr.com>
parents: 48483
diff changeset
9104
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9105 #undef abort
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9106
63340
1cd9a44aa129 (w32_abort): Use the MB_YESNO dialog instead of
Eli Zaretskii <eliz@gnu.org>
parents: 63297
diff changeset
9107 void w32_abort (void) NO_RETURN;
1cd9a44aa129 (w32_abort): Use the MB_YESNO dialog instead of
Eli Zaretskii <eliz@gnu.org>
parents: 63297
diff changeset
9108
47942
080b4586492b Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 47731
diff changeset
9109 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16259
diff changeset
9110 w32_abort()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9111 {
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
9112 int button;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
9113 button = MessageBox (NULL,
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
9114 "A fatal error has occurred!\n\n"
63340
1cd9a44aa129 (w32_abort): Use the MB_YESNO dialog instead of
Eli Zaretskii <eliz@gnu.org>
parents: 63297
diff changeset
9115 "Would you like to attach a debugger?\n\n"
67438
2e919998931e (w32_abort) [__GNUC__]: Add instructions for attaching GDB to the abort dialog.
Eli Zaretskii <eliz@gnu.org>
parents: 67269
diff changeset
9116 "Select YES to debug, NO to abort Emacs"
2e919998931e (w32_abort) [__GNUC__]: Add instructions for attaching GDB to the abort dialog.
Eli Zaretskii <eliz@gnu.org>
parents: 67269
diff changeset
9117 #if __GNUC__
2e919998931e (w32_abort) [__GNUC__]: Add instructions for attaching GDB to the abort dialog.
Eli Zaretskii <eliz@gnu.org>
parents: 67269
diff changeset
9118 "\n\n(type \"gdb -p <emacs-PID>\" and\n"
2e919998931e (w32_abort) [__GNUC__]: Add instructions for attaching GDB to the abort dialog.
Eli Zaretskii <eliz@gnu.org>
parents: 67269
diff changeset
9119 "\"continue\" inside GDB before clicking YES.)"
2e919998931e (w32_abort) [__GNUC__]: Add instructions for attaching GDB to the abort dialog.
Eli Zaretskii <eliz@gnu.org>
parents: 67269
diff changeset
9120 #endif
2e919998931e (w32_abort) [__GNUC__]: Add instructions for attaching GDB to the abort dialog.
Eli Zaretskii <eliz@gnu.org>
parents: 67269
diff changeset
9121 , "Emacs Abort Dialog",
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
9122 MB_ICONEXCLAMATION | MB_TASKMODAL
63340
1cd9a44aa129 (w32_abort): Use the MB_YESNO dialog instead of
Eli Zaretskii <eliz@gnu.org>
parents: 63297
diff changeset
9123 | MB_SETFOREGROUND | MB_YESNO);
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
9124 switch (button)
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
9125 {
63340
1cd9a44aa129 (w32_abort): Use the MB_YESNO dialog instead of
Eli Zaretskii <eliz@gnu.org>
parents: 63297
diff changeset
9126 case IDYES:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
9127 DebugBreak ();
63340
1cd9a44aa129 (w32_abort): Use the MB_YESNO dialog instead of
Eli Zaretskii <eliz@gnu.org>
parents: 63297
diff changeset
9128 exit (2); /* tell the compiler we will never return */
1cd9a44aa129 (w32_abort): Use the MB_YESNO dialog instead of
Eli Zaretskii <eliz@gnu.org>
parents: 63297
diff changeset
9129 case IDNO:
15147
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
9130 default:
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
9131 abort ();
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
9132 break;
38c0ce06203f (quit_char, Vwin32_enable_italics, Vwin32_enable_palette):
Geoff Voelker <voelker@cs.washington.edu>
parents: 15034
diff changeset
9133 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9134 }
15148
220145cf7546 (continuation of previous checkin)
Geoff Voelker <voelker@cs.washington.edu>
parents: 15147
diff changeset
9135
23801
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
9136 /* For convenience when debugging. */
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
9137 int
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
9138 w32_last_error()
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
9139 {
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
9140 return GetLastError ();
119fd94ae526 (w32_last_error): Fix cut+paste error.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23681
diff changeset
9141 }
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 52351
diff changeset
9142
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 52351
diff changeset
9143 /* arch-tag: 707589ab-b9be-4638-8cdd-74629cc9b446
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 52351
diff changeset
9144 (do not change this comment) */