]> code.delx.au - gnu-emacs/blobdiff - src/w32fns.c
Remove now-inaccurate bytecode comments
[gnu-emacs] / src / w32fns.c
index 02bd4d5594227a756e799854a360d5540e68166a..d6b54d19a19953d9afed8add319e7f3ec4d02cb2 100644 (file)
@@ -276,6 +276,8 @@ static struct
 } kbdhook;
 typedef HWND (WINAPI *GetConsoleWindow_Proc) (void);
 
+typedef BOOL (WINAPI *IsDebuggerPresent_Proc) (void);
+
 /* stdin, from w32console.c */
 extern HANDLE keyboard_handle;
 
@@ -2178,7 +2180,7 @@ funhook (int code, WPARAM w, LPARAM l)
                     can prevent this by setting the
                     w32-pass-[lr]window-to-system variable to
                     NIL.  */
-                 if (hs->vkCode == (VK_LWIN && !NILP (Vw32_pass_lwindow_to_system)) ||
+                 if ((hs->vkCode == VK_LWIN && !NILP (Vw32_pass_lwindow_to_system)) ||
                      (hs->vkCode == VK_RWIN && !NILP (Vw32_pass_rwindow_to_system)))
                    {
                      /* Not prevented - Simulate the keypress to the system.  */
@@ -2304,6 +2306,19 @@ setup_w32_kbdhook (void)
 {
   kbdhook.hook_count++;
 
+  /* This hook gets in the way of debugging, since when Emacs stops,
+     its input thread stops, and there's nothing to process keyboard
+     events, whereas this hook is global, and is invoked in the
+     context of the thread that installed it.  So we don't install the
+     hook if the process is being debugged. */
+  if (w32_kbdhook_active)
+    {
+      IsDebuggerPresent_Proc is_debugger_present = (IsDebuggerPresent_Proc)
+       GetProcAddress (GetModuleHandle ("kernel32.dll"), "IsDebuggerPresent");
+      if (is_debugger_present && is_debugger_present ())
+       return;
+    }
+
   /* Hooking is only available on NT architecture systems, as
      indicated by the w32_kbdhook_active variable.  */
   if (kbdhook.hook_count == 1 && w32_kbdhook_active)
@@ -6898,6 +6913,7 @@ Text larger than the specified size is clipped.  */)
   ptrdiff_t count = SPECPDL_INDEX ();
   ptrdiff_t count_1;
   Lisp_Object window, size;
+  AUTO_STRING (tip, " *tip*");
 
   specbind (Qinhibit_redisplay, Qt);
 
@@ -7054,7 +7070,6 @@ Text larger than the specified size is clipped.  */)
 
   tip_f = XFRAME (tip_frame);
   window = FRAME_ROOT_WINDOW (tip_f);
-  AUTO_STRING (tip, " *tip*");
   set_window_buffer (window, Fget_buffer_create (tip), false, false);
   w = XWINDOW (window);
   w->pseudo_window_p = true;