]> code.delx.au - gnu-emacs/blobdiff - src/w32fns.c
Delete the code that was trying to define BSD "right"
[gnu-emacs] / src / w32fns.c
index 9cd5a50e8fac823837db6231fc4327e7dfd92581..13de5fb75b361f82944c228255ca7df7462ff21d 100644 (file)
@@ -1,4 +1,4 @@
-/* Functions for the MS Win32 window system API.
+/* Graphical user interface functions for the Microsoft W32 API.
    Copyright (C) 1989, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -33,7 +33,7 @@ Boston, MA 02111-1307, USA.  */
 #include "keyboard.h"
 #include "blockinput.h"
 #include "paths.h"
-#include "ntheap.h"
+#include "w32heap.h"
 #include "termhooks.h"
 
 #include <commdlg.h>
@@ -1529,6 +1529,7 @@ x_set_mouse_color (f, arg, oldval)
 #if 0
   Cursor cursor, nontext_cursor, mode_cursor, cross_cursor;
 #endif
+  int count;
   int mask_color;
 
   if (!EQ (Qnil, arg))
@@ -1544,7 +1545,7 @@ x_set_mouse_color (f, arg, oldval)
   BLOCK_INPUT;
 
   /* It's not okay to crash if the user selects a screwy cursor.  */
-  x_catch_errors (FRAME_W32_DISPLAY (f));
+  count = x_catch_errors (FRAME_W32_DISPLAY (f));
 
   if (!EQ (Qnil, Vx_pointer_shape))
     {
@@ -1587,7 +1588,7 @@ x_set_mouse_color (f, arg, oldval)
 
   /* Check and report errors with the above calls.  */
   x_check_errors (FRAME_W32_DISPLAY (f), "can't set cursor shape: %s");
-  x_uncatch_errors (FRAME_W32_DISPLAY (f));
+  x_uncatch_errors (FRAME_W32_DISPLAY (f), count);
 
   {
     XColor fore_color, back_color;
@@ -2680,7 +2681,7 @@ my_post_msg (wmsg, hwnd, msg, wParam, lParam)
   post_msg (wmsg);
 }
 
-/* GetKeyState and MapVirtualKey on Win95 do not actually distinguish
+/* GetKeyState and MapVirtualKey on Windows 95 do not actually distinguish
    between left and right keys as advertised.  We test for this
    support dynamically, and set a flag when the support is absent.  If
    absent, we keep track of the left and right control and alt keys
@@ -2879,7 +2880,7 @@ map_keypad_keys (unsigned int wparam, unsigned int lparam)
 /* Main message dispatch loop. */
 
 DWORD 
-win_msg_worker (dw)
+windows_msg_worker (dw)
      DWORD dw;
 {
   MSG msg;
@@ -3033,10 +3034,10 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
 
       if (windows_translate)
        {
-         MSG winmsg = { hwnd, msg, wParam, lParam, 0, {0,0} };
+         MSG windows_msg = { hwnd, msg, wParam, lParam, 0, {0,0} };
 
-         winmsg.time = GetMessageTime ();
-         TranslateMessage (&winmsg);
+         windows_msg.time = GetMessageTime ();
+         TranslateMessage (&windows_msg);
          goto dflt;
        }
 
@@ -3046,24 +3047,31 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
     case WM_CHAR:
       wmsg.dwModifiers = construct_modifiers (wParam, lParam);
 
-      enter_crit ();
-      my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
-
 #if 1
-      /* Detect quit_char and set quit-flag directly.  Note that we dow
-         this *after* posting the message to ensure the main thread will
-         be woken up if blocked in sys_select(). */
+      /* Detect quit_char and set quit-flag directly.  Note that we
+        still need to post a message to ensure the main thread will be
+        woken up if blocked in sys_select(), but we do NOT want to post
+        the quit_char message itself (because it will usually be as if
+        the user had typed quit_char twice).  Instead, we post a dummy
+        message that has no particular effect. */
       {
        int c = wParam;
        if (isalpha (c) && (wmsg.dwModifiers == LEFT_CTRL_PRESSED 
                            || wmsg.dwModifiers == RIGHT_CTRL_PRESSED))
          c = make_ctrl_char (c) & 0377;
        if (c == quit_char)
-         Vquit_flag = Qt;
+         {
+           Vquit_flag = Qt;
+
+           /* The choice of message is somewhat arbitrary, as long as
+              the main thread handler just ignores it. */
+           msg = WM_QUIT;
+         }
       }
 #endif
 
-      leave_crit ();
+      my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
+
       break;
 
       /* Simulate middle mouse button events when left and right buttons
@@ -3250,7 +3258,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
   
     case WM_NCACTIVATE:
       /* Windows doesn't send us focus messages when putting up and
-        taking down a system popup dialog as for Ctrl-Alt-Del on Win95.
+        taking down a system popup dialog as for Ctrl-Alt-Del on Windows 95.
         The only indication we get that something happened is receiving
         this message afterwards.  So this is a good time to reset our
         keyboard modifiers' state. */
@@ -3364,7 +3372,7 @@ my_create_window (f)
 {
   MSG msg;
 
-  PostThreadMessage (dwWinThreadId, WM_EMACS_CREATEWINDOW, (WPARAM)f, 0);
+  PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW, (WPARAM)f, 0);
   GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
 }
 
@@ -3428,7 +3436,7 @@ x_icon (f, parms)
 {
   Lisp_Object icon_x, icon_y;
 
-  /* Set the position of the icon.  Note that win95 groups all
+  /* Set the position of the icon.  Note that Windows 95 groups all
      icons in the tray.  */
   icon_x = x_get_arg (parms, Qicon_left, 0, 0, number);
   icon_y = x_get_arg (parms, Qicon_top, 0, 0, number);