aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog54
-rw-r--r--src/emacs.c1
-rw-r--r--src/keyboard.c124
-rw-r--r--src/lisp.h20
-rw-r--r--src/w32.h1
-rw-r--r--src/w32font.c149
-rw-r--r--src/window.c41
-rw-r--r--src/xdisp.c13
8 files changed, 297 insertions, 106 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c3926f6024b..fad9b4f9e46 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,53 @@
12011-10-28 Eli Zaretskii <eliz@gnu.org>
2
3 * xdisp.c (note_mouse_highlight): Initialize `part', to avoid a
4 possible random value that matches one of those tested as
5 condition to clear the mouse face.
6
72011-10-28 Chong Yidong <cyd@gnu.org>
8
9 * xdisp.c (note_mouse_highlight): Fix use of uninitialized var.
10
112011-10-28 Dan Nicolaescu <dann@ics.uci.edu>
12
13 * window.c (make_window): Initialize phys_cursor_on_p.
14
152011-10-28 Stefan Monnier <monnier@iro.umontreal.ca>
16
17 * lisp.h (struct Lisp_Symbol): Update comments.
18
192011-10-28 Juanma Barranquero <lekktu@gmail.com>
20
21 * w32font.c (w32_load_unicows_or_gdi32): Add missing return.
22
232011-10-28 Eli Zaretskii <eliz@gnu.org>
24
25 Fix Emacs on Windows 9X (bug#8562). Thanks to oslsachem
26 <oslsachem@gmail.com> for helping to debug this.
27
28 * w32font.c (g_b_init_is_w9x, g_b_init_get_outline_metrics_w)
29 (g_b_init_get_text_metrics_w, g_b_init_get_glyph_outline_w)
30 (g_b_init_get_glyph_outline_w): New static variables.
31 (GetOutlineTextMetricsW_Proc, GetTextMetricsW_Proc)
32 (GetGlyphOutlineW_Proc): New typedefs.
33 (w32_load_unicows_or_gdi32, get_outline_metrics_w)
34 (get_text_metrics_w, get_glyph_outline_w, globals_of_w32font):
35 New functions.
36 (w32font_open_internal, compute_metrics):
37 Call get_outline_metrics_w, get_text_metrics_w, and get_glyph_outline_w
38 instead of calling the "wide" APIs directly.
39
40 * emacs.c (main) [HAVE_NTGUI]: Call globals_of_w32font.
41
42 * w32.h (syms_of_w32font): Add prototype.
43
442011-10-27 Juanma Barranquero <lekktu@gmail.com>
45
46 * window.c (Fframe_root_window, Fframe_first_window, Fwindow_end)
47 (Fframe_selected_window, Ftemp_output_buffer_show, Fnext_window)
48 (Fdelete_window_internal, Fwindow_parameters): Fix typos in docstrings.
49 (Fmove_to_window_line): Doc fix.
50
12011-10-27 Chong Yidong <cyd@gnu.org> 512011-10-27 Chong Yidong <cyd@gnu.org>
2 52
3 * process.c (make_process): Set gnutls_state to NULL. 53 * process.c (make_process): Set gnutls_state to NULL.
@@ -11,8 +61,8 @@
11 61
122011-10-27 Chong Yidong <cyd@gnu.org> 622011-10-27 Chong Yidong <cyd@gnu.org>
13 63
14 * gnutls.c (emacs_gnutls_deinit): New function. Deallocate 64 * gnutls.c (emacs_gnutls_deinit): New function.
15 credentials structures as well as calling gnutls_deinit. 65 Deallocate credentials structures as well as calling gnutls_deinit.
16 (Fgnutls_deinit, Fgnutls_boot): Use it. 66 (Fgnutls_deinit, Fgnutls_boot): Use it.
17 67
18 * process.c (make_process): Initialize GnuTLS credentials to NULL. 68 * process.c (make_process): Initialize GnuTLS credentials to NULL.
diff --git a/src/emacs.c b/src/emacs.c
index a96ad1ae1cb..197158e18e4 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1597,6 +1597,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1597 /* Initialization that must be done even if the global variable 1597 /* Initialization that must be done even if the global variable
1598 initialized is non zero. */ 1598 initialized is non zero. */
1599#ifdef HAVE_NTGUI 1599#ifdef HAVE_NTGUI
1600 globals_of_w32font ();
1600 globals_of_w32fns (); 1601 globals_of_w32fns ();
1601 globals_of_w32menu (); 1602 globals_of_w32menu ();
1602 globals_of_w32select (); 1603 globals_of_w32select ();
diff --git a/src/keyboard.c b/src/keyboard.c
index f06c8794a54..bda8a1d82f3 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -73,7 +73,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
73#include "nsterm.h" 73#include "nsterm.h"
74#endif 74#endif
75 75
76/* Variables for blockinput.h: */ 76/* Variables for blockinput.h: */
77 77
78/* Non-zero if interrupt input is blocked right now. */ 78/* Non-zero if interrupt input is blocked right now. */
79volatile int interrupt_input_blocked; 79volatile int interrupt_input_blocked;
@@ -341,7 +341,7 @@ static Lisp_Object Qconfig_changed_event;
341Lisp_Object Qevent_kind; 341Lisp_Object Qevent_kind;
342static Lisp_Object Qevent_symbol_elements; 342static Lisp_Object Qevent_symbol_elements;
343 343
344/* menu and tool bar item parts */ 344/* Menu and tool bar item parts. */
345static Lisp_Object Qmenu_enable; 345static Lisp_Object Qmenu_enable;
346static Lisp_Object QCenable, QCvisible, QChelp, QCkeys, QCkey_sequence; 346static Lisp_Object QCenable, QCvisible, QChelp, QCkeys, QCkey_sequence;
347Lisp_Object QCfilter; 347Lisp_Object QCfilter;
@@ -838,7 +838,7 @@ recursive_edit_unwind (Lisp_Object buffer)
838 838
839 839
840#if 0 /* These two functions are now replaced with 840#if 0 /* These two functions are now replaced with
841 temporarily_switch_to_single_kboard. */ 841 temporarily_switch_to_single_kboard. */
842static void 842static void
843any_kboard_state () 843any_kboard_state ()
844{ 844{
@@ -1041,7 +1041,7 @@ cmd_error (Lisp_Object data)
1041 Vquit_flag = Qnil; 1041 Vquit_flag = Qnil;
1042 1042
1043 Vinhibit_quit = Qnil; 1043 Vinhibit_quit = Qnil;
1044#if 0 /* This shouldn't be necessary anymore. --lorentey */ 1044#if 0 /* This shouldn't be necessary anymore. --lorentey */
1045 if (command_loop_level == 0 && minibuf_level == 0) 1045 if (command_loop_level == 0 && minibuf_level == 0)
1046 any_kboard_state (); 1046 any_kboard_state ();
1047#endif 1047#endif
@@ -1134,7 +1134,7 @@ command_loop (void)
1134#if 0 /* This shouldn't be necessary anymore. --lorentey */ 1134#if 0 /* This shouldn't be necessary anymore. --lorentey */
1135 /* Reset single_kboard in case top-level set it while 1135 /* Reset single_kboard in case top-level set it while
1136 evaluating an -f option, or we are stuck there for some 1136 evaluating an -f option, or we are stuck there for some
1137 other reason. */ 1137 other reason. */
1138 any_kboard_state (); 1138 any_kboard_state ();
1139#endif 1139#endif
1140 internal_catch (Qtop_level, command_loop_2, Qnil); 1140 internal_catch (Qtop_level, command_loop_2, Qnil);
@@ -1495,8 +1495,8 @@ command_loop_1 (void)
1495 if (!NILP (Vquit_flag)) 1495 if (!NILP (Vquit_flag))
1496 { 1496 {
1497 Vexecuting_kbd_macro = Qt; 1497 Vexecuting_kbd_macro = Qt;
1498 QUIT; /* Make some noise. */ 1498 QUIT; /* Make some noise. */
1499 /* Will return since macro now empty. */ 1499 /* Will return since macro now empty. */
1500 } 1500 }
1501 } 1501 }
1502 1502
@@ -1515,7 +1515,7 @@ command_loop_1 (void)
1515 Vdisable_point_adjustment = Qnil; 1515 Vdisable_point_adjustment = Qnil;
1516 1516
1517 /* Process filters and timers may have messed with deactivate-mark. 1517 /* Process filters and timers may have messed with deactivate-mark.
1518 reset it before we execute the command. */ 1518 reset it before we execute the command. */
1519 Vdeactivate_mark = Qnil; 1519 Vdeactivate_mark = Qnil;
1520 1520
1521 /* Remap command through active keymaps. */ 1521 /* Remap command through active keymaps. */
@@ -1555,7 +1555,7 @@ command_loop_1 (void)
1555 } 1555 }
1556 else 1556 else
1557 { 1557 {
1558 /* Here for a command that isn't executed directly */ 1558 /* Here for a command that isn't executed directly. */
1559 1559
1560#ifdef HAVE_WINDOW_SYSTEM 1560#ifdef HAVE_WINDOW_SYSTEM
1561 int scount = SPECPDL_INDEX (); 1561 int scount = SPECPDL_INDEX ();
@@ -1963,7 +1963,7 @@ void
1963poll_for_input_1 (void) 1963poll_for_input_1 (void)
1964{ 1964{
1965/* Tell ns_read_socket() it is being called asynchronously so it can avoid 1965/* Tell ns_read_socket() it is being called asynchronously so it can avoid
1966 doing anything dangerous. */ 1966 doing anything dangerous. */
1967#ifdef HAVE_NS 1967#ifdef HAVE_NS
1968 ++handling_signal; 1968 ++handling_signal;
1969#endif 1969#endif
@@ -2003,7 +2003,7 @@ start_polling (void)
2003#ifdef POLL_FOR_INPUT 2003#ifdef POLL_FOR_INPUT
2004 /* XXX This condition was (read_socket_hook && !interrupt_input), 2004 /* XXX This condition was (read_socket_hook && !interrupt_input),
2005 but read_socket_hook is not global anymore. Let's pretend that 2005 but read_socket_hook is not global anymore. Let's pretend that
2006 it's always set. */ 2006 it's always set. */
2007 if (!interrupt_input) 2007 if (!interrupt_input)
2008 { 2008 {
2009 /* Turn alarm handling on unconditionally. It might have 2009 /* Turn alarm handling on unconditionally. It might have
@@ -2040,7 +2040,7 @@ input_polling_used (void)
2040#ifdef POLL_FOR_INPUT 2040#ifdef POLL_FOR_INPUT
2041 /* XXX This condition was (read_socket_hook && !interrupt_input), 2041 /* XXX This condition was (read_socket_hook && !interrupt_input),
2042 but read_socket_hook is not global anymore. Let's pretend that 2042 but read_socket_hook is not global anymore. Let's pretend that
2043 it's always set. */ 2043 it's always set. */
2044 return !interrupt_input; 2044 return !interrupt_input;
2045#else 2045#else
2046 return 0; 2046 return 0;
@@ -2055,7 +2055,7 @@ stop_polling (void)
2055#ifdef POLL_FOR_INPUT 2055#ifdef POLL_FOR_INPUT
2056 /* XXX This condition was (read_socket_hook && !interrupt_input), 2056 /* XXX This condition was (read_socket_hook && !interrupt_input),
2057 but read_socket_hook is not global anymore. Let's pretend that 2057 but read_socket_hook is not global anymore. Let's pretend that
2058 it's always set. */ 2058 it's always set. */
2059 if (!interrupt_input) 2059 if (!interrupt_input)
2060 ++poll_suppress_count; 2060 ++poll_suppress_count;
2061#endif 2061#endif
@@ -2393,7 +2393,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2393 real event came from. Normally, a switch-frame event selects 2393 real event came from. Normally, a switch-frame event selects
2394 internal_last_event_frame after each command is read, but 2394 internal_last_event_frame after each command is read, but
2395 events read from a macro should never cause a new frame to be 2395 events read from a macro should never cause a new frame to be
2396 selected. */ 2396 selected. */
2397 Vlast_event_frame = internal_last_event_frame = Qmacro; 2397 Vlast_event_frame = internal_last_event_frame = Qmacro;
2398 2398
2399 /* Exit the macro if we are at the end. 2399 /* Exit the macro if we are at the end.
@@ -2503,7 +2503,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2503 Try this before the sit-for, because the sit-for 2503 Try this before the sit-for, because the sit-for
2504 would do the wrong thing if we are supposed to do 2504 would do the wrong thing if we are supposed to do
2505 menu prompting. If EVENT_HAS_PARAMETERS then we are reading 2505 menu prompting. If EVENT_HAS_PARAMETERS then we are reading
2506 after a mouse event so don't try a minibuf menu. */ 2506 after a mouse event so don't try a minibuf menu. */
2507 c = Qnil; 2507 c = Qnil;
2508 if (nmaps > 0 && INTERACTIVE 2508 if (nmaps > 0 && INTERACTIVE
2509 && !NILP (prev_event) && ! EVENT_HAS_PARAMETERS (prev_event) 2509 && !NILP (prev_event) && ! EVENT_HAS_PARAMETERS (prev_event)
@@ -4990,8 +4990,8 @@ static const char *const lispy_function_keys[] =
4990 "break", /* 0xff6b */ 4990 "break", /* 0xff6b */
4991 4991
4992 0, 0, 0, 0, 4992 0, 0, 0, 0,
4993 0, 0, 0, 0, "backtab", 0, 0, 0, /* 0xff70... */ 4993 0, 0, 0, 0, "backtab", 0, 0, 0, /* 0xff70... */
4994 0, 0, 0, 0, 0, 0, 0, "kp-numlock", /* 0xff78... */ 4994 0, 0, 0, 0, 0, 0, 0, "kp-numlock", /* 0xff78... */
4995 "kp-space", /* 0xff80 */ /* IsKeypadKey */ 4995 "kp-space", /* 0xff80 */ /* IsKeypadKey */
4996 0, 0, 0, 0, 0, 0, 0, 0, 4996 0, 0, 0, 0, 0, 0, 0, 0,
4997 "kp-tab", /* 0xff89 */ 4997 "kp-tab", /* 0xff89 */
@@ -5103,14 +5103,14 @@ static Lisp_Object *const scroll_bar_parts[] = {
5103static Lisp_Object button_down_location; 5103static Lisp_Object button_down_location;
5104 5104
5105/* Information about the most recent up-going button event: Which 5105/* Information about the most recent up-going button event: Which
5106 button, what location, and what time. */ 5106 button, what location, and what time. */
5107 5107
5108static int last_mouse_button; 5108static int last_mouse_button;
5109static int last_mouse_x; 5109static int last_mouse_x;
5110static int last_mouse_y; 5110static int last_mouse_y;
5111static Time button_down_time; 5111static Time button_down_time;
5112 5112
5113/* The number of clicks in this multiple-click. */ 5113/* The number of clicks in this multiple-click. */
5114 5114
5115static int double_click_count; 5115static int double_click_count;
5116 5116
@@ -5354,7 +5354,7 @@ make_lispy_event (struct input_event *event)
5354 5354
5355#ifdef HAVE_NS 5355#ifdef HAVE_NS
5356 /* NS_NONKEY_EVENTs are just like NON_ASCII_KEYSTROKE_EVENTs, 5356 /* NS_NONKEY_EVENTs are just like NON_ASCII_KEYSTROKE_EVENTs,
5357 except that they are non-key events (last-nonmenu-event is nil). */ 5357 except that they are non-key events (last-nonmenu-event is nil). */
5358 case NS_NONKEY_EVENT: 5358 case NS_NONKEY_EVENT:
5359#endif 5359#endif
5360 5360
@@ -5840,7 +5840,7 @@ make_lispy_event (struct input_event *event)
5840 Fcons (make_number (event->timestamp), 5840 Fcons (make_number (event->timestamp),
5841 Fcons (part, Qnil))))); 5841 Fcons (part, Qnil)))));
5842 5842
5843 /* Always treat scroll bar events as clicks. */ 5843 /* Always treat scroll bar events as clicks. */
5844 event->modifiers |= click_modifier; 5844 event->modifiers |= click_modifier;
5845 event->modifiers &= ~up_modifier; 5845 event->modifiers &= ~up_modifier;
5846 5846
@@ -6710,7 +6710,7 @@ lucid_event_type_list_p (Lisp_Object object)
6710 If READABLE_EVENTS_FILTER_EVENTS is set in FLAGS, ignore internal 6710 If READABLE_EVENTS_FILTER_EVENTS is set in FLAGS, ignore internal
6711 events (FOCUS_IN_EVENT). 6711 events (FOCUS_IN_EVENT).
6712 If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse 6712 If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse
6713 movements and toolkit scroll bar thumb drags. */ 6713 movements and toolkit scroll bar thumb drags. */
6714 6714
6715static void 6715static void
6716get_input_pending (int *addr, int flags) 6716get_input_pending (int *addr, int flags)
@@ -6744,7 +6744,7 @@ gobble_input (int expected)
6744#ifdef POLL_FOR_INPUT 6744#ifdef POLL_FOR_INPUT
6745 /* XXX This condition was (read_socket_hook && !interrupt_input), 6745 /* XXX This condition was (read_socket_hook && !interrupt_input),
6746 but read_socket_hook is not global anymore. Let's pretend that 6746 but read_socket_hook is not global anymore. Let's pretend that
6747 it's always set. */ 6747 it's always set. */
6748 if (!interrupt_input && poll_suppress_count == 0) 6748 if (!interrupt_input && poll_suppress_count == 0)
6749 { 6749 {
6750 SIGMASKTYPE mask; 6750 SIGMASKTYPE mask;
@@ -6819,7 +6819,7 @@ read_avail_input (int expected)
6819 if (store_user_signal_events ()) 6819 if (store_user_signal_events ())
6820 expected = 0; 6820 expected = 0;
6821 6821
6822 /* Loop through the available terminals, and call their input hooks. */ 6822 /* Loop through the available terminals, and call their input hooks. */
6823 t = terminal_list; 6823 t = terminal_list;
6824 while (t) 6824 while (t)
6825 { 6825 {
@@ -6840,15 +6840,15 @@ read_avail_input (int expected)
6840 expected = 0; 6840 expected = 0;
6841 } 6841 }
6842 6842
6843 if (nr == -1) /* Not OK to read input now. */ 6843 if (nr == -1) /* Not OK to read input now. */
6844 { 6844 {
6845 err = 1; 6845 err = 1;
6846 } 6846 }
6847 else if (nr == -2) /* Non-transient error. */ 6847 else if (nr == -2) /* Non-transient error. */
6848 { 6848 {
6849 /* The terminal device terminated; it should be closed. */ 6849 /* The terminal device terminated; it should be closed. */
6850 6850
6851 /* Kill Emacs if this was our last terminal. */ 6851 /* Kill Emacs if this was our last terminal. */
6852 if (!terminal_list->next_terminal) 6852 if (!terminal_list->next_terminal)
6853 /* Formerly simply reported no input, but that 6853 /* Formerly simply reported no input, but that
6854 sometimes led to a failure of Emacs to terminate. 6854 sometimes led to a failure of Emacs to terminate.
@@ -6860,7 +6860,7 @@ read_avail_input (int expected)
6860 alone in its group. */ 6860 alone in its group. */
6861 kill (getpid (), SIGHUP); 6861 kill (getpid (), SIGHUP);
6862 6862
6863 /* XXX Is calling delete_terminal safe here? It calls delete_frame. */ 6863 /* XXX Is calling delete_terminal safe here? It calls delete_frame. */
6864 { 6864 {
6865 Lisp_Object tmp; 6865 Lisp_Object tmp;
6866 XSETTERMINAL (tmp, t); 6866 XSETTERMINAL (tmp, t);
@@ -6950,7 +6950,7 @@ tty_read_avail_input (struct terminal *terminal,
6950 return 0; 6950 return 0;
6951#endif /* subprocesses */ 6951#endif /* subprocesses */
6952 6952
6953 if (!terminal->name) /* Don't read from a dead terminal. */ 6953 if (!terminal->name) /* Don't read from a dead terminal. */
6954 return 0; 6954 return 0;
6955 6955
6956 if (terminal->type != output_termcap 6956 if (terminal->type != output_termcap
@@ -6958,15 +6958,15 @@ tty_read_avail_input (struct terminal *terminal,
6958 abort (); 6958 abort ();
6959 6959
6960 /* XXX I think the following code should be moved to separate hook 6960 /* XXX I think the following code should be moved to separate hook
6961 functions in system-dependent files. */ 6961 functions in system-dependent files. */
6962#ifdef WINDOWSNT 6962#ifdef WINDOWSNT
6963 return 0; 6963 return 0;
6964#else /* not WINDOWSNT */ 6964#else /* not WINDOWSNT */
6965 if (! tty->term_initted) /* In case we get called during bootstrap. */ 6965 if (! tty->term_initted) /* In case we get called during bootstrap. */
6966 return 0; 6966 return 0;
6967 6967
6968 if (! tty->input) 6968 if (! tty->input)
6969 return 0; /* The terminal is suspended. */ 6969 return 0; /* The terminal is suspended. */
6970 6970
6971#ifdef MSDOS 6971#ifdef MSDOS
6972 n_to_read = dos_keysns (); 6972 n_to_read = dos_keysns ();
@@ -6992,7 +6992,7 @@ tty_read_avail_input (struct terminal *terminal,
6992 Gpm_GetEvent closes gpm_fd and clears it to -1, which is why 6992 Gpm_GetEvent closes gpm_fd and clears it to -1, which is why
6993 we save it in `fd' so close_gpm can remove it from the 6993 we save it in `fd' so close_gpm can remove it from the
6994 select masks. 6994 select masks.
6995 gpm==-1 if a protocol error or EWOULDBLOCK; the latter is normal. */ 6995 gpm==-1 if a protocol error or EWOULDBLOCK; the latter is normal. */
6996 while (gpm = Gpm_GetEvent (&event), gpm == 1) { 6996 while (gpm = Gpm_GetEvent (&event), gpm == 1) {
6997 nread += handle_one_term_event (tty, &event, &gpm_hold_quit); 6997 nread += handle_one_term_event (tty, &event, &gpm_hold_quit);
6998 } 6998 }
@@ -7012,7 +7012,7 @@ tty_read_avail_input (struct terminal *terminal,
7012 if (ioctl (fileno (tty->input), FIONREAD, &n_to_read) < 0) 7012 if (ioctl (fileno (tty->input), FIONREAD, &n_to_read) < 0)
7013 { 7013 {
7014 if (! noninteractive) 7014 if (! noninteractive)
7015 return -2; /* Close this terminal. */ 7015 return -2; /* Close this terminal. */
7016 else 7016 else
7017 n_to_read = 0; 7017 n_to_read = 0;
7018 } 7018 }
@@ -7045,16 +7045,16 @@ tty_read_avail_input (struct terminal *terminal,
7045 process group won't get SIGHUP's at logout time. BSDI adheres to 7045 process group won't get SIGHUP's at logout time. BSDI adheres to
7046 this part standard and returns -1 from read (0) with errno==EIO 7046 this part standard and returns -1 from read (0) with errno==EIO
7047 when the control tty is taken away. 7047 when the control tty is taken away.
7048 Jeffrey Honig <jch@bsdi.com> says this is generally safe. */ 7048 Jeffrey Honig <jch@bsdi.com> says this is generally safe. */
7049 if (nread == -1 && errno == EIO) 7049 if (nread == -1 && errno == EIO)
7050 return -2; /* Close this terminal. */ 7050 return -2; /* Close this terminal. */
7051#if defined (AIX) && defined (_BSD) 7051#if defined (AIX) && defined (_BSD)
7052 /* The kernel sometimes fails to deliver SIGHUP for ptys. 7052 /* The kernel sometimes fails to deliver SIGHUP for ptys.
7053 This looks incorrect, but it isn't, because _BSD causes 7053 This looks incorrect, but it isn't, because _BSD causes
7054 O_NDELAY to be defined in fcntl.h as O_NONBLOCK, 7054 O_NDELAY to be defined in fcntl.h as O_NONBLOCK,
7055 and that causes a value other than 0 when there is no input. */ 7055 and that causes a value other than 0 when there is no input. */
7056 if (nread == 0) 7056 if (nread == 0)
7057 return -2; /* Close this terminal. */ 7057 return -2; /* Close this terminal. */
7058#endif 7058#endif
7059 } 7059 }
7060 while ( 7060 while (
@@ -7132,7 +7132,7 @@ tty_read_avail_input (struct terminal *terminal,
7132 buf.code = cbuf[i]; 7132 buf.code = cbuf[i];
7133 /* Set the frame corresponding to the active tty. Note that the 7133 /* Set the frame corresponding to the active tty. Note that the
7134 value of selected_frame is not reliable here, redisplay tends 7134 value of selected_frame is not reliable here, redisplay tends
7135 to temporarily change it. */ 7135 to temporarily change it. */
7136 buf.frame_or_window = tty->top_frame; 7136 buf.frame_or_window = tty->top_frame;
7137 buf.arg = Qnil; 7137 buf.arg = Qnil;
7138 7138
@@ -7155,7 +7155,7 @@ handle_async_input (void)
7155 pending_signals = pending_atimers; 7155 pending_signals = pending_atimers;
7156#endif 7156#endif
7157/* Tell ns_read_socket() it is being called asynchronously so it can avoid 7157/* Tell ns_read_socket() it is being called asynchronously so it can avoid
7158 doing anything dangerous. */ 7158 doing anything dangerous. */
7159#ifdef HAVE_NS 7159#ifdef HAVE_NS
7160 ++handling_signal; 7160 ++handling_signal;
7161#endif 7161#endif
@@ -7213,7 +7213,7 @@ input_available_signal (int signo)
7213 This function exists so that the UNBLOCK_INPUT macro in 7213 This function exists so that the UNBLOCK_INPUT macro in
7214 blockinput.h can have some way to take care of input we put off 7214 blockinput.h can have some way to take care of input we put off
7215 dealing with, without assuming that every file which uses 7215 dealing with, without assuming that every file which uses
7216 UNBLOCK_INPUT also has #included the files necessary to get SIGIO. */ 7216 UNBLOCK_INPUT also has #included the files necessary to get SIGIO. */
7217void 7217void
7218reinvoke_input_signal (void) 7218reinvoke_input_signal (void)
7219{ 7219{
@@ -7240,7 +7240,7 @@ struct user_signal_info
7240 struct user_signal_info *next; 7240 struct user_signal_info *next;
7241}; 7241};
7242 7242
7243/* List of user signals. */ 7243/* List of user signals. */
7244static struct user_signal_info *user_signals = NULL; 7244static struct user_signal_info *user_signals = NULL;
7245 7245
7246void 7246void
@@ -7777,7 +7777,7 @@ parse_menu_item (Lisp_Object item, int inmenubar)
7777 { 7777 {
7778 tem = XCAR (item); 7778 tem = XCAR (item);
7779 if (SYMBOLP (tem) || STRINGP (tem) || VECTORP (tem)) 7779 if (SYMBOLP (tem) || STRINGP (tem) || VECTORP (tem))
7780 /* Be GC protected. Set keyhint to item instead of tem. */ 7780 /* Be GC protected. Set keyhint to item instead of tem. */
7781 keyhint = item; 7781 keyhint = item;
7782 } 7782 }
7783 else if (EQ (tem, QCkeys)) 7783 else if (EQ (tem, QCkeys))
@@ -7860,7 +7860,7 @@ parse_menu_item (Lisp_Object item, int inmenubar)
7860 if (inmenubar > 0) 7860 if (inmenubar > 0)
7861 return 1; 7861 return 1;
7862 7862
7863 { /* This is a command. See if there is an equivalent key binding. */ 7863 { /* This is a command. See if there is an equivalent key binding. */
7864 Lisp_Object keyeq = AREF (item_properties, ITEM_PROPERTY_KEYEQ); 7864 Lisp_Object keyeq = AREF (item_properties, ITEM_PROPERTY_KEYEQ);
7865 7865
7866 /* The previous code preferred :key-sequence to :keys, so we 7866 /* The previous code preferred :key-sequence to :keys, so we
@@ -8416,7 +8416,7 @@ append_tool_bar_item (void)
8416 These are done in different ways, depending on how the input will be read. 8416 These are done in different ways, depending on how the input will be read.
8417 Menus using X are done after auto-saving in read-char, getting the input 8417 Menus using X are done after auto-saving in read-char, getting the input
8418 event from Fx_popup_menu; menus using the minibuf use read_char recursively 8418 event from Fx_popup_menu; menus using the minibuf use read_char recursively
8419 and do auto-saving in the inner call of read_char. */ 8419 and do auto-saving in the inner call of read_char. */
8420 8420
8421static Lisp_Object 8421static Lisp_Object
8422read_char_x_menu_prompt (ptrdiff_t nmaps, Lisp_Object *maps, 8422read_char_x_menu_prompt (ptrdiff_t nmaps, Lisp_Object *maps,
@@ -8636,14 +8636,14 @@ read_char_minibuf_menu_prompt (int commandflag,
8636 tem 8636 tem
8637 = XVECTOR (item_properties)->contents[ITEM_PROPERTY_KEYEQ]; 8637 = XVECTOR (item_properties)->contents[ITEM_PROPERTY_KEYEQ];
8638 if (!NILP (tem)) 8638 if (!NILP (tem))
8639 /* Insert equivalent keybinding. */ 8639 /* Insert equivalent keybinding. */
8640 s = concat2 (s, tem); 8640 s = concat2 (s, tem);
8641#endif 8641#endif
8642 tem 8642 tem
8643 = XVECTOR (item_properties)->contents[ITEM_PROPERTY_TYPE]; 8643 = XVECTOR (item_properties)->contents[ITEM_PROPERTY_TYPE];
8644 if (EQ (tem, QCradio) || EQ (tem, QCtoggle)) 8644 if (EQ (tem, QCradio) || EQ (tem, QCtoggle))
8645 { 8645 {
8646 /* Insert button prefix. */ 8646 /* Insert button prefix. */
8647 Lisp_Object selected 8647 Lisp_Object selected
8648 = XVECTOR (item_properties)->contents[ITEM_PROPERTY_SELECTED]; 8648 = XVECTOR (item_properties)->contents[ITEM_PROPERTY_SELECTED];
8649 if (EQ (tem, QCradio)) 8649 if (EQ (tem, QCradio))
@@ -8877,7 +8877,7 @@ keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey,
8877 8877
8878 /* If keybuf[fkey->start..fkey->end] is bound in the 8878 /* If keybuf[fkey->start..fkey->end] is bound in the
8879 map and we're in a position to do the key remapping, replace it with 8879 map and we're in a position to do the key remapping, replace it with
8880 the binding and restart with fkey->start at the end. */ 8880 the binding and restart with fkey->start at the end. */
8881 if ((VECTORP (next) || STRINGP (next)) && doit) 8881 if ((VECTORP (next) || STRINGP (next)) && doit)
8882 { 8882 {
8883 int len = XFASTINT (Flength (next)); 8883 int len = XFASTINT (Flength (next));
@@ -9041,7 +9041,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9041 9041
9042 /* Non-zero if we are trying to map a key by changing an upper-case 9042 /* Non-zero if we are trying to map a key by changing an upper-case
9043 letter to lower case, or a shifted function key to an unshifted 9043 letter to lower case, or a shifted function key to an unshifted
9044 one. */ 9044 one. */
9045 int shift_translated = 0; 9045 int shift_translated = 0;
9046 9046
9047 /* If we receive a `switch-frame' or `select-window' event in the middle of 9047 /* If we receive a `switch-frame' or `select-window' event in the middle of
@@ -9049,7 +9049,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9049 While we're reading, we keep the event here. */ 9049 While we're reading, we keep the event here. */
9050 Lisp_Object delayed_switch_frame; 9050 Lisp_Object delayed_switch_frame;
9051 9051
9052 /* See the comment below... */ 9052 /* See the comment below... */
9053#if defined (GOBBLE_FIRST_EVENT) 9053#if defined (GOBBLE_FIRST_EVENT)
9054 Lisp_Object first_event; 9054 Lisp_Object first_event;
9055#endif 9055#endif
@@ -9324,7 +9324,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9324 if (!found) 9324 if (!found)
9325 { 9325 {
9326 /* Don't touch interrupted_kboard when it's been 9326 /* Don't touch interrupted_kboard when it's been
9327 deleted. */ 9327 deleted. */
9328 delayed_switch_frame = Qnil; 9328 delayed_switch_frame = Qnil;
9329 goto replay_entire_sequence; 9329 goto replay_entire_sequence;
9330 } 9330 }
@@ -9432,7 +9432,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9432 { 9432 {
9433 /* If we're at the beginning of a key sequence, and the caller 9433 /* If we're at the beginning of a key sequence, and the caller
9434 says it's okay, go ahead and return this event. If we're 9434 says it's okay, go ahead and return this event. If we're
9435 in the midst of a key sequence, delay it until the end. */ 9435 in the midst of a key sequence, delay it until the end. */
9436 if (t > 0 || !can_return_switch_frame) 9436 if (t > 0 || !can_return_switch_frame)
9437 { 9437 {
9438 delayed_switch_frame = key; 9438 delayed_switch_frame = key;
@@ -9729,7 +9729,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9729 Down-clicks are eliminated. 9729 Down-clicks are eliminated.
9730 Double-downs reduce to downs, then are eliminated. 9730 Double-downs reduce to downs, then are eliminated.
9731 Triple-downs reduce to double-downs, then to downs, 9731 Triple-downs reduce to double-downs, then to downs,
9732 then are eliminated. */ 9732 then are eliminated. */
9733 if (modifiers & (down_modifier | drag_modifier 9733 if (modifiers & (down_modifier | drag_modifier
9734 | double_modifier | triple_modifier)) 9734 | double_modifier | triple_modifier))
9735 { 9735 {
@@ -10838,7 +10838,7 @@ set_waiting_for_input (struct timeval *time_to_clear)
10838 waiting_for_input = 1; 10838 waiting_for_input = 1;
10839 10839
10840 /* If handle_interrupt was called before and buffered a C-g, 10840 /* If handle_interrupt was called before and buffered a C-g,
10841 make it run again now, to avoid timing error. */ 10841 make it run again now, to avoid timing error. */
10842 if (!NILP (Vquit_flag)) 10842 if (!NILP (Vquit_flag))
10843 quit_throw_to_read_char (); 10843 quit_throw_to_read_char ();
10844} 10844}
@@ -10859,7 +10859,7 @@ clear_waiting_for_input (void)
10859 10859
10860static void 10860static void
10861interrupt_signal (int signalnum) /* If we don't have an argument, some */ 10861interrupt_signal (int signalnum) /* If we don't have an argument, some */
10862 /* compilers complain in signal calls. */ 10862 /* compilers complain in signal calls. */
10863{ 10863{
10864 /* Must preserve main program's value of errno. */ 10864 /* Must preserve main program's value of errno. */
10865 int old_errno = errno; 10865 int old_errno = errno;
@@ -10867,12 +10867,12 @@ interrupt_signal (int signalnum) /* If we don't have an argument, some */
10867 10867
10868 SIGNAL_THREAD_CHECK (signalnum); 10868 SIGNAL_THREAD_CHECK (signalnum);
10869 10869
10870 /* See if we have an active terminal on our controlling tty. */ 10870 /* See if we have an active terminal on our controlling tty. */
10871 terminal = get_named_tty ("/dev/tty"); 10871 terminal = get_named_tty ("/dev/tty");
10872 if (!terminal) 10872 if (!terminal)
10873 { 10873 {
10874 /* If there are no frames there, let's pretend that we are a 10874 /* If there are no frames there, let's pretend that we are a
10875 well-behaving UN*X program and quit. */ 10875 well-behaving UN*X program and quit. */
10876 Fkill_emacs (Qnil); 10876 Fkill_emacs (Qnil);
10877 } 10877 }
10878 else 10878 else
@@ -10900,7 +10900,7 @@ interrupt_signal (int signalnum) /* If we don't have an argument, some */
10900 10900
10901 Otherwise it sets the Lisp variable quit-flag not-nil. This causes 10901 Otherwise it sets the Lisp variable quit-flag not-nil. This causes
10902 eval to throw, when it gets a chance. If quit-flag is already 10902 eval to throw, when it gets a chance. If quit-flag is already
10903 non-nil, it stops the job right away. */ 10903 non-nil, it stops the job right away. */
10904 10904
10905static void 10905static void
10906handle_interrupt (void) 10906handle_interrupt (void)
@@ -10909,7 +10909,7 @@ handle_interrupt (void)
10909 10909
10910 cancel_echoing (); 10910 cancel_echoing ();
10911 10911
10912 /* XXX This code needs to be revised for multi-tty support. */ 10912 /* XXX This code needs to be revised for multi-tty support. */
10913 if (!NILP (Vquit_flag) && get_named_tty ("/dev/tty")) 10913 if (!NILP (Vquit_flag) && get_named_tty ("/dev/tty"))
10914 { 10914 {
10915 /* If SIGINT isn't blocked, don't let us be interrupted by 10915 /* If SIGINT isn't blocked, don't let us be interrupted by
@@ -11019,7 +11019,7 @@ handle_interrupt (void)
11019 wait_reading_process_output() under HAVE_NS because of the call 11019 wait_reading_process_output() under HAVE_NS because of the call
11020 to ns_select there (needed because otherwise events aren't picked up 11020 to ns_select there (needed because otherwise events aren't picked up
11021 outside of polling since we don't get SIGIO like X and we don't have a 11021 outside of polling since we don't get SIGIO like X and we don't have a
11022 separate event loop thread like W32. */ 11022 separate event loop thread like W32. */
11023#ifndef HAVE_NS 11023#ifndef HAVE_NS
11024 if (waiting_for_input && !echoing) 11024 if (waiting_for_input && !echoing)
11025 quit_throw_to_read_char (); 11025 quit_throw_to_read_char ();
@@ -11468,7 +11468,7 @@ init_keyboard (void)
11468 session may have multiple display types, so we always handle 11468 session may have multiple display types, so we always handle
11469 SIGINT. There is special code in interrupt_signal to exit 11469 SIGINT. There is special code in interrupt_signal to exit
11470 Emacs on SIGINT when there are no termcap frames on the 11470 Emacs on SIGINT when there are no termcap frames on the
11471 controlling terminal. */ 11471 controlling terminal. */
11472 signal (SIGINT, interrupt_signal); 11472 signal (SIGINT, interrupt_signal);
11473#ifndef DOS_NT 11473#ifndef DOS_NT
11474 /* For systems with SysV TERMIO, C-g is set up for both SIGINT and 11474 /* For systems with SysV TERMIO, C-g is set up for both SIGINT and
@@ -12269,7 +12269,7 @@ Currently, the only supported values for this
12269variable are `sigusr1' and `sigusr2'. */); 12269variable are `sigusr1' and `sigusr2'. */);
12270 Vdebug_on_event = intern_c_string ("sigusr2"); 12270 Vdebug_on_event = intern_c_string ("sigusr2");
12271 12271
12272 /* Create the initial keyboard. */ 12272 /* Create the initial keyboard. */
12273 initial_kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); 12273 initial_kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
12274 init_kboard (initial_kboard); 12274 init_kboard (initial_kboard);
12275 /* Vwindow_system is left at t for now. */ 12275 /* Vwindow_system is left at t for now. */
diff --git a/src/lisp.h b/src/lisp.h
index bc48b790a14..c0ddb7f2b02 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -162,7 +162,7 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
162 162
163/* First, try and define DECL_ALIGN(type,var) which declares a static 163/* First, try and define DECL_ALIGN(type,var) which declares a static
164 variable VAR of type TYPE with the added requirement that it be 164 variable VAR of type TYPE with the added requirement that it be
165 TYPEBITS-aligned. */ 165 TYPEBITS-aligned. */
166#ifndef NO_DECL_ALIGN 166#ifndef NO_DECL_ALIGN
167# ifndef DECL_ALIGN 167# ifndef DECL_ALIGN
168# if HAVE_ATTRIBUTE_ALIGNED 168# if HAVE_ATTRIBUTE_ALIGNED
@@ -1088,11 +1088,9 @@ enum symbol_redirect
1088 SYMBOL_PLAINVAL = 4, 1088 SYMBOL_PLAINVAL = 4,
1089 SYMBOL_VARALIAS = 1, 1089 SYMBOL_VARALIAS = 1,
1090 SYMBOL_LOCALIZED = 2, 1090 SYMBOL_LOCALIZED = 2,
1091 SYMBOL_FORWARDED = 3 1091 SYMBOL_FORWARDED = 3
1092}; 1092};
1093 1093
1094/* In a symbol, the markbit of the plist is used as the gc mark bit */
1095
1096struct Lisp_Symbol 1094struct Lisp_Symbol
1097{ 1095{
1098 unsigned gcmarkbit : 1; 1096 unsigned gcmarkbit : 1;
@@ -1101,8 +1099,7 @@ struct Lisp_Symbol
1101 0 : it's a plain var, the value is in the `value' field. 1099 0 : it's a plain var, the value is in the `value' field.
1102 1 : it's a varalias, the value is really in the `alias' symbol. 1100 1 : it's a varalias, the value is really in the `alias' symbol.
1103 2 : it's a localized var, the value is in the `blv' object. 1101 2 : it's a localized var, the value is in the `blv' object.
1104 3 : it's a forwarding variable, the value is in `forward'. 1102 3 : it's a forwarding variable, the value is in `forward'. */
1105 */
1106 enum symbol_redirect redirect : 3; 1103 enum symbol_redirect redirect : 3;
1107 1104
1108 /* Non-zero means symbol is constant, i.e. changing its value 1105 /* Non-zero means symbol is constant, i.e. changing its value
@@ -1119,15 +1116,12 @@ struct Lisp_Symbol
1119 unsigned declared_special : 1; 1116 unsigned declared_special : 1;
1120 1117
1121 /* The symbol's name, as a Lisp string. 1118 /* The symbol's name, as a Lisp string.
1122
1123 The name "xname" is used to intentionally break code referring to 1119 The name "xname" is used to intentionally break code referring to
1124 the old field "name" of type pointer to struct Lisp_String. */ 1120 the old field "name" of type pointer to struct Lisp_String. */
1125 Lisp_Object xname; 1121 Lisp_Object xname;
1126 1122
1127 /* Value of the symbol or Qunbound if unbound. If this symbol is a 1123 /* Value of the symbol or Qunbound if unbound. Which alternative of the
1128 defvaralias, `alias' contains the symbol for which it is an 1124 union is used depends on the `redirect' field above. */
1129 alias. Use the SYMBOL_VALUE and SET_SYMBOL_VALUE macros to get
1130 and set a symbol's value, to take defvaralias into account. */
1131 union { 1125 union {
1132 Lisp_Object value; 1126 Lisp_Object value;
1133 struct Lisp_Symbol *alias; 1127 struct Lisp_Symbol *alias;
@@ -1322,7 +1316,7 @@ struct Lisp_Misc_Any /* Supertype of all Misc types. */
1322 enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_??? */ 1316 enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_??? */
1323 unsigned gcmarkbit : 1; 1317 unsigned gcmarkbit : 1;
1324 int spacer : 15; 1318 int spacer : 15;
1325 /* Make it as long as "Lisp_Free without padding". */ 1319 /* Make it as long as "Lisp_Free without padding". */
1326 void *fill; 1320 void *fill;
1327}; 1321};
1328 1322
@@ -3607,7 +3601,7 @@ extern void init_system_name (void);
3607 3601
3608#define SWITCH_ENUM_CAST(x) (x) 3602#define SWITCH_ENUM_CAST(x) (x)
3609 3603
3610/* Use this to suppress gcc's warnings. */ 3604/* Use this to suppress gcc's warnings. */
3611#ifdef lint 3605#ifdef lint
3612 3606
3613/* Use CODE only if lint checking is in effect. */ 3607/* Use CODE only if lint checking is in effect. */
diff --git a/src/w32.h b/src/w32.h
index f1915125c90..a3ca1130ce6 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -139,6 +139,7 @@ extern void term_w32select (void);
139extern void syms_of_w32menu (void); 139extern void syms_of_w32menu (void);
140extern void globals_of_w32menu (void); 140extern void globals_of_w32menu (void);
141extern void syms_of_fontset (void); 141extern void syms_of_fontset (void);
142extern void syms_of_w32font (void);
142 143
143extern int _sys_read_ahead (int fd); 144extern int _sys_read_ahead (int fd);
144extern int _sys_wait_accept (int fd); 145extern int _sys_wait_accept (int fd);
diff --git a/src/w32font.c b/src/w32font.c
index f47b7a46b1e..6c1b4d0bc20 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -145,6 +145,138 @@ struct font_callback_data
145 style variations if the font name is not specified. */ 145 style variations if the font name is not specified. */
146static void list_all_matching_fonts (struct font_callback_data *); 146static void list_all_matching_fonts (struct font_callback_data *);
147 147
148static BOOL g_b_init_is_w9x;
149static BOOL g_b_init_get_outline_metrics_w;
150static BOOL g_b_init_get_text_metrics_w;
151static BOOL g_b_init_get_glyph_outline_w;
152static BOOL g_b_init_get_glyph_outline_w;
153
154typedef UINT (WINAPI * GetOutlineTextMetricsW_Proc) (
155 HDC hdc,
156 UINT cbData,
157 LPOUTLINETEXTMETRICW lpotmw);
158typedef BOOL (WINAPI * GetTextMetricsW_Proc) (
159 HDC hdc,
160 LPTEXTMETRICW lptmw);
161typedef DWORD (WINAPI * GetGlyphOutlineW_Proc) (
162 HDC hdc,
163 UINT uChar,
164 UINT uFormat,
165 LPGLYPHMETRICS lpgm,
166 DWORD cbBuffer,
167 LPVOID lpvBuffer,
168 const MAT2 *lpmat2);
169
170/* Several "wide" functions we use to support the font backends are
171 unavailable on Windows 9X, unless UNICOWS.DLL is installed (their
172 versions in the default libraries are non-functional stubs). On NT
173 and later systems, these functions are in GDI32.DLL. The following
174 helper function attempts to load UNICOWS.DLL on Windows 9X, and
175 refuses to let Emacs start up if that library is not found. On NT
176 and later versions, it simply loads GDI32.DLL, which should always
177 be available. */
178static HMODULE
179w32_load_unicows_or_gdi32 (void)
180{
181 static BOOL is_9x = 0;
182 OSVERSIONINFO os_ver;
183 HMODULE ret;
184 if (g_b_init_is_w9x == 0)
185 {
186 g_b_init_is_w9x = 1;
187 ZeroMemory (&os_ver, sizeof (OSVERSIONINFO));
188 os_ver.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
189 if (GetVersionEx (&os_ver))
190 is_9x = (os_ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS);
191 }
192 if (is_9x)
193 {
194 ret = LoadLibrary ("Unicows.dll");
195 if (!ret)
196 {
197 int button;
198
199 button = MessageBox (NULL,
200 "Emacs cannot load the UNICOWS.DLL library.\n"
201 "This library is essential for using Emacs\n"
202 "on this system. You need to install it.\n\n"
203 "However, you can still use Emacs by invoking\n"
204 "it with the '-nw' command-line option.\n\n"
205 "Emacs will exit when you click OK.",
206 "Emacs cannot load UNICOWS.DLL",
207 MB_ICONERROR | MB_TASKMODAL
208 | MB_SETFOREGROUND | MB_OK);
209 switch (button)
210 {
211 case IDOK:
212 default:
213 exit (1);
214 }
215 }
216 }
217 else
218 ret = LoadLibrary ("Gdi32.dll");
219 return ret;
220}
221
222/* The following 3 functions call the problematic "wide" APIs via
223 function pointers, to avoid linking against the non-standard
224 libunicows on W9X. */
225static UINT WINAPI
226get_outline_metrics_w(HDC hdc, UINT cbData, LPOUTLINETEXTMETRICW lpotmw)
227{
228 static GetOutlineTextMetricsW_Proc s_pfn_Get_Outline_Text_MetricsW = NULL;
229 HMODULE hm_unicows = NULL;
230 if (g_b_init_get_outline_metrics_w == 0)
231 {
232 g_b_init_get_outline_metrics_w = 1;
233 hm_unicows = w32_load_unicows_or_gdi32 ();
234 if (hm_unicows)
235 s_pfn_Get_Outline_Text_MetricsW = (GetOutlineTextMetricsW_Proc)
236 GetProcAddress (hm_unicows, "GetOutlineTextMetricsW");
237 }
238 if (s_pfn_Get_Outline_Text_MetricsW == NULL)
239 abort (); /* cannot happen */
240 return s_pfn_Get_Outline_Text_MetricsW (hdc, cbData, lpotmw);
241}
242
243static BOOL WINAPI
244get_text_metrics_w(HDC hdc, LPTEXTMETRICW lptmw)
245{
246 static GetTextMetricsW_Proc s_pfn_Get_Text_MetricsW = NULL;
247 HMODULE hm_unicows = NULL;
248 if (g_b_init_get_text_metrics_w == 0)
249 {
250 g_b_init_get_text_metrics_w = 1;
251 hm_unicows = w32_load_unicows_or_gdi32 ();
252 if (hm_unicows)
253 s_pfn_Get_Text_MetricsW = (GetTextMetricsW_Proc)
254 GetProcAddress (hm_unicows, "GetTextMetricsW");
255 }
256 if (s_pfn_Get_Text_MetricsW == NULL)
257 abort (); /* cannot happen */
258 return s_pfn_Get_Text_MetricsW (hdc, lptmw);
259}
260
261static DWORD WINAPI
262get_glyph_outline_w (HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm,
263 DWORD cbBuffer, LPVOID lpvBuffer, const MAT2 *lpmat2)
264{
265 static GetGlyphOutlineW_Proc s_pfn_Get_Glyph_OutlineW = NULL;
266 HMODULE hm_unicows = NULL;
267 if (g_b_init_get_glyph_outline_w == 0)
268 {
269 g_b_init_get_glyph_outline_w = 1;
270 hm_unicows = w32_load_unicows_or_gdi32 ();
271 if (hm_unicows)
272 s_pfn_Get_Glyph_OutlineW = (GetGlyphOutlineW_Proc)
273 GetProcAddress (hm_unicows, "GetGlyphOutlineW");
274 }
275 if (s_pfn_Get_Glyph_OutlineW == NULL)
276 abort (); /* cannot happen */
277 return s_pfn_Get_Glyph_OutlineW (hdc, uChar, uFormat, lpgm, cbBuffer,
278 lpvBuffer, lpmat2);
279}
148 280
149static int 281static int
150memq_no_quit (Lisp_Object elt, Lisp_Object list) 282memq_no_quit (Lisp_Object elt, Lisp_Object list)
@@ -816,11 +948,11 @@ w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity,
816 old_font = SelectObject (dc, hfont); 948 old_font = SelectObject (dc, hfont);
817 949
818 /* Try getting the outline metrics (only works for truetype fonts). */ 950 /* Try getting the outline metrics (only works for truetype fonts). */
819 len = GetOutlineTextMetricsW (dc, 0, NULL); 951 len = get_outline_metrics_w (dc, 0, NULL);
820 if (len) 952 if (len)
821 { 953 {
822 metrics = (OUTLINETEXTMETRICW *) alloca (len); 954 metrics = (OUTLINETEXTMETRICW *) alloca (len);
823 if (GetOutlineTextMetricsW (dc, len, metrics)) 955 if (get_outline_metrics_w (dc, len, metrics))
824 memcpy (&w32_font->metrics, &metrics->otmTextMetrics, 956 memcpy (&w32_font->metrics, &metrics->otmTextMetrics,
825 sizeof (TEXTMETRICW)); 957 sizeof (TEXTMETRICW));
826 else 958 else
@@ -828,7 +960,7 @@ w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity,
828 } 960 }
829 961
830 if (!metrics) 962 if (!metrics)
831 GetTextMetricsW (dc, &w32_font->metrics); 963 get_text_metrics_w (dc, &w32_font->metrics);
832 964
833 w32_font->cached_metrics = NULL; 965 w32_font->cached_metrics = NULL;
834 w32_font->n_cache_blocks = 0; 966 w32_font->n_cache_blocks = 0;
@@ -2306,7 +2438,7 @@ compute_metrics (HDC dc, struct w32font_info *w32_font, unsigned int code,
2306 transform.eM11.value = 1; 2438 transform.eM11.value = 1;
2307 transform.eM22.value = 1; 2439 transform.eM22.value = 1;
2308 2440
2309 if (GetGlyphOutlineW (dc, code, options, &gm, 0, NULL, &transform) 2441 if (get_glyph_outline_w (dc, code, options, &gm, 0, NULL, &transform)
2310 != GDI_ERROR) 2442 != GDI_ERROR)
2311 { 2443 {
2312 metrics->lbearing = gm.gmptGlyphOrigin.x; 2444 metrics->lbearing = gm.gmptGlyphOrigin.x;
@@ -2581,3 +2713,12 @@ versions of Windows) characters. */);
2581 w32font_driver.type = Qgdi; 2713 w32font_driver.type = Qgdi;
2582 register_font_driver (&w32font_driver, NULL); 2714 register_font_driver (&w32font_driver, NULL);
2583} 2715}
2716
2717void
2718globals_of_w32font (void)
2719{
2720 g_b_init_is_w9x = 0;
2721 g_b_init_get_outline_metrics_w = 0;
2722 g_b_init_get_text_metrics_w = 0;
2723 g_b_init_get_glyph_outline_w = 0;
2724}
diff --git a/src/window.c b/src/window.c
index 7f4714ba17e..e6840a0ebe7 100644
--- a/src/window.c
+++ b/src/window.c
@@ -177,10 +177,10 @@ WINDOW can be any window and defaults to the selected one. */)
177} 177}
178 178
179DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0, 179DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0,
180 doc: /* Return the root window of FRAME_OR_WINDOW. 180 doc: /* Return the root window of FRAME-OR-WINDOW.
181If omitted, FRAME_OR_WINDOW defaults to the currently selected frame. 181If omitted, FRAME-OR-WINDOW defaults to the currently selected frame.
182Else if FRAME_OR_WINDOW denotes any window, return the root window of 182Else if FRAME-OR-WINDOW denotes any window, return the root window of
183that window's frame. If FRAME_OR_WINDOW denotes a live frame, return 183that window's frame. If FRAME-OR-WINDOW denotes a live frame, return
184the root window of that frame. */) 184the root window of that frame. */)
185 (Lisp_Object frame_or_window) 185 (Lisp_Object frame_or_window)
186{ 186{
@@ -222,10 +222,10 @@ WINDOW can be any window and defaults to the selected one. */)
222 222
223/* Don't move this to window.el - this must be a safe routine. */ 223/* Don't move this to window.el - this must be a safe routine. */
224DEFUN ("frame-first-window", Fframe_first_window, Sframe_first_window, 0, 1, 0, 224DEFUN ("frame-first-window", Fframe_first_window, Sframe_first_window, 0, 1, 0,
225 doc: /* Return the topmost, leftmost live window on FRAME_OR_WINDOW. 225 doc: /* Return the topmost, leftmost live window on FRAME-OR-WINDOW.
226If omitted, FRAME_OR_WINDOW defaults to the currently selected frame. 226If omitted, FRAME-OR-WINDOW defaults to the currently selected frame.
227Else if FRAME_OR_WINDOW denotes any window, return the first window of 227Else if FRAME-OR-WINDOW denotes any window, return the first window of
228that window's frame. If FRAME_OR_WINDOW denotes a live frame, return 228that window's frame. If FRAME-OR-WINDOW denotes a live frame, return
229the first window of that frame. */) 229the first window of that frame. */)
230 (Lisp_Object frame_or_window) 230 (Lisp_Object frame_or_window)
231{ 231{
@@ -256,10 +256,10 @@ the first window of that frame. */)
256 256
257DEFUN ("frame-selected-window", Fframe_selected_window, 257DEFUN ("frame-selected-window", Fframe_selected_window,
258 Sframe_selected_window, 0, 1, 0, 258 Sframe_selected_window, 0, 1, 0,
259 doc: /* Return the selected window of FRAME_OR_WINDOW. 259 doc: /* Return the selected window of FRAME-OR-WINDOW.
260If omitted, FRAME_OR_WINDOW defaults to the currently selected frame. 260If omitted, FRAME-OR-WINDOW defaults to the currently selected frame.
261Else if FRAME_OR_WINDOW denotes any window, return the selected window 261Else if FRAME-OR-WINDOW denotes any window, return the selected window
262of that window's frame. If FRAME_OR_WINDOW denotes a live frame, return 262of that window's frame. If FRAME-OR-WINDOW denotes a live frame, return
263the selected window of that frame. */) 263the selected window of that frame. */)
264 (Lisp_Object frame_or_window) 264 (Lisp_Object frame_or_window)
265{ 265{
@@ -1299,7 +1299,7 @@ WINDOW must be a live window and defaults to the selected one.
1299This is updated by redisplay, when it runs to completion. 1299This is updated by redisplay, when it runs to completion.
1300Simply changing the buffer text or setting `window-start' 1300Simply changing the buffer text or setting `window-start'
1301does not update this value. 1301does not update this value.
1302Return nil if there is no recorded value. \(This can happen if the 1302Return nil if there is no recorded value. (This can happen if the
1303last redisplay of WINDOW was preempted, and did not finish.) 1303last redisplay of WINDOW was preempted, and did not finish.)
1304If UPDATE is non-nil, compute the up-to-date position 1304If UPDATE is non-nil, compute the up-to-date position
1305if it isn't already recorded. */) 1305if it isn't already recorded. */)
@@ -1690,7 +1690,7 @@ DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters,
1690 0, 1, 0, 1690 0, 1, 0,
1691 doc: /* Return the parameters of WINDOW and their values. 1691 doc: /* Return the parameters of WINDOW and their values.
1692WINDOW defaults to the selected window. The return value is a list of 1692WINDOW defaults to the selected window. The return value is a list of
1693elements of the form (PARAMETER . VALUE). */) 1693elements of the form (PARAMETER . VALUE). */)
1694 (Lisp_Object window) 1694 (Lisp_Object window)
1695{ 1695{
1696 return Fcopy_alist (decode_any_window (window)->window_parameters); 1696 return Fcopy_alist (decode_any_window (window)->window_parameters);
@@ -2195,7 +2195,7 @@ next_window (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames, in
2195 2195
2196DEFUN ("next-window", Fnext_window, Snext_window, 0, 3, 0, 2196DEFUN ("next-window", Fnext_window, Snext_window, 0, 3, 0,
2197 doc: /* Return window following WINDOW in cyclic ordering of windows. 2197 doc: /* Return window following WINDOW in cyclic ordering of windows.
2198WINDOW must be a live window and defaults to the selected one. The 2198WINDOW must be a live window and defaults to the selected one. The
2199optional arguments MINIBUF and ALL-FRAMES specify the set of windows to 2199optional arguments MINIBUF and ALL-FRAMES specify the set of windows to
2200consider. 2200consider.
2201 2201
@@ -3226,7 +3226,7 @@ temp_output_buffer_show (register Lisp_Object buf)
3226DEFUN ("internal-temp-output-buffer-show", 3226DEFUN ("internal-temp-output-buffer-show",
3227 Ftemp_output_buffer_show, Stemp_output_buffer_show, 3227 Ftemp_output_buffer_show, Stemp_output_buffer_show,
3228 1, 1, 0, 3228 1, 1, 0,
3229 doc: /* Internal function for `with-output-to-temp-buffer''. */) 3229 doc: /* Internal function for `with-output-to-temp-buffer'. */)
3230 (Lisp_Object buf) 3230 (Lisp_Object buf)
3231{ 3231{
3232 temp_output_buffer_show (buf); 3232 temp_output_buffer_show (buf);
@@ -3322,6 +3322,7 @@ make_window (void)
3322 memset (&w->phys_cursor, 0, sizeof (w->phys_cursor)); 3322 memset (&w->phys_cursor, 0, sizeof (w->phys_cursor));
3323 w->phys_cursor_type = -1; 3323 w->phys_cursor_type = -1;
3324 w->phys_cursor_width = -1; 3324 w->phys_cursor_width = -1;
3325 w->phys_cursor_on_p = 0;
3325 w->last_cursor_off_p = w->cursor_off_p = 0; 3326 w->last_cursor_off_p = w->cursor_off_p = 0;
3326 w->must_be_updated_p = 0; 3327 w->must_be_updated_p = 0;
3327 w->pseudo_window_p = 0; 3328 w->pseudo_window_p = 0;
@@ -3847,8 +3848,8 @@ set correctly. See the code of `split-window' for how this is done. */)
3847 3848
3848DEFUN ("delete-window-internal", Fdelete_window_internal, Sdelete_window_internal, 1, 1, 0, 3849DEFUN ("delete-window-internal", Fdelete_window_internal, Sdelete_window_internal, 1, 1, 0,
3849 doc: /* Remove WINDOW from its frame. 3850 doc: /* Remove WINDOW from its frame.
3850WINDOW defaults to the selected window. Return nil. Signal an error 3851WINDOW defaults to the selected window. Return nil.
3851when WINDOW is the only window on its frame. */) 3852Signal an error when WINDOW is the only window on its frame. */)
3852 (register Lisp_Object window) 3853 (register Lisp_Object window)
3853{ 3854{
3854 register Lisp_Object parent, sibling, frame, root; 3855 register Lisp_Object parent, sibling, frame, root;
@@ -5230,8 +5231,8 @@ any partial-height lines in the text display area. */)
5230DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line, 5231DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line,
5231 1, 1, "P", 5232 1, 1, "P",
5232 doc: /* Position point relative to window. 5233 doc: /* Position point relative to window.
5233With no argument, position point at center of window. 5234ARG nil means position point at center of window.
5234An argument specifies vertical position within the window; 5235Else, ARG specifies vertical position within the window;
5235zero means top of window, negative means relative to bottom of window. */) 5236zero means top of window, negative means relative to bottom of window. */)
5236 (Lisp_Object arg) 5237 (Lisp_Object arg)
5237{ 5238{
diff --git a/src/xdisp.c b/src/xdisp.c
index e0b36dbe100..c3a924d10d4 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -27039,7 +27039,7 @@ void
27039note_mouse_highlight (struct frame *f, int x, int y) 27039note_mouse_highlight (struct frame *f, int x, int y)
27040{ 27040{
27041 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 27041 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
27042 enum window_part part; 27042 enum window_part part = ON_NOTHING;
27043 Lisp_Object window; 27043 Lisp_Object window;
27044 struct window *w; 27044 struct window *w;
27045 Cursor cursor = No_Cursor; 27045 Cursor cursor = No_Cursor;
@@ -27073,11 +27073,14 @@ note_mouse_highlight (struct frame *f, int x, int y)
27073 /* Which window is that in? */ 27073 /* Which window is that in? */
27074 window = window_from_coordinates (f, x, y, &part, 1); 27074 window = window_from_coordinates (f, x, y, &part, 1);
27075 27075
27076 /* If we were displaying active text in another window, clear that. 27076 /* If displaying active text in another window, clear that. */
27077 Also clear if we move out of text area in same window. */
27078 if (! EQ (window, hlinfo->mouse_face_window) 27077 if (! EQ (window, hlinfo->mouse_face_window)
27079 || (part != ON_TEXT && part != ON_MODE_LINE && part != ON_HEADER_LINE 27078 /* Also clear if we move out of text area in same window. */
27080 && !NILP (hlinfo->mouse_face_window))) 27079 || (!NILP (hlinfo->mouse_face_window)
27080 && !NILP (window)
27081 && part != ON_TEXT
27082 && part != ON_MODE_LINE
27083 && part != ON_HEADER_LINE))
27081 clear_mouse_face (hlinfo); 27084 clear_mouse_face (hlinfo);
27082 27085
27083 /* Not on a window -> return. */ 27086 /* Not on a window -> return. */