XEmacs 21.4.6 "Common Lisp".
[chise/xemacs-chise.git.1] / src / event-msw.c
index 4745a66..e4e1be5 100644 (file)
@@ -93,7 +93,7 @@ typedef unsigned int SOCKET;
 /* Timer ID used for button2 emulation */
 #define BUTTON_2_TIMER_ID 1
 
-static Lisp_Object mswindows_find_frame (HWND hwnd);
+Lisp_Object mswindows_find_frame (HWND hwnd);
 static Lisp_Object mswindows_find_console (HWND hwnd);
 static Lisp_Object mswindows_key_to_emacs_keysym (int mswindows_key, int mods,
                                                  int extendedp);
@@ -232,6 +232,7 @@ slurper_free_shared_data_maybe (struct ntpipe_slurp_stream_shared_data* s)
       CloseHandle (s->hev_thread);
       CloseHandle (s->hev_caller);
       CloseHandle (s->hev_unsleep);
+      CloseHandle (s->hpipe);
       s->inuse_p = 0;
     }
 }
@@ -1610,6 +1611,8 @@ mswindows_wm_timer_callback (HWND hwnd, UINT umsg, UINT id_timer, DWORD dwtime)
  * depends on dnd support.
  */
 #ifdef HAVE_DRAGNDROP
+extern int mswindows_dde_enable;
+
 HDDEDATA CALLBACK
 mswindows_dde_callback (UINT uType, UINT uFmt, HCONV hconv,
                        HSZ hszTopic, HSZ hszItem, HDDEDATA hdata,
@@ -1636,6 +1639,9 @@ mswindows_dde_callback (UINT uType, UINT uFmt, HCONV hconv,
       return (HDDEDATA)NULL;
 
     case XTYP_EXECUTE:
+      if (!mswindows_dde_enable)
+       return (HDDEDATA) DDE_FBUSY;
+
       if (!DdeCmpStringHandles (hszTopic, mswindows_dde_topic_system))
        {
          DWORD len = DdeGetData (hdata, NULL, 0, 0);
@@ -1643,7 +1649,7 @@ mswindows_dde_callback (UINT uType, UINT uFmt, HCONV hconv,
          char *end;
          char *filename;
          struct gcpro gcpro1, gcpro2;
-          Lisp_Object l_dndlist = Qnil;
+         Lisp_Object l_dndlist = Qnil;
          Lisp_Object emacs_event = Fmake_event (Qnil, Qnil);
          Lisp_Object frmcons, devcons, concons;
          Lisp_Event *event = XEVENT (emacs_event);
@@ -2064,17 +2070,9 @@ mswindows_wnd_proc (HWND hwnd, UINT message_, WPARAM wParam, LPARAM lParam)
   struct frame *frame;
   struct mswindows_frame* msframe;
 
-  /* Not perfect but avoids crashes. There is potential for wierd
-     behavior here. */
-  if (gc_in_progress)
-    {
-      mswindows_output_console_string ("Window procedure called during GC???????\n", 41);
-      /* Yes, this assert always triggers in a --debug XEmacs.  But
-        --debug=no is default in the stable branches.
-         #### How about patch in <200106081225.IAA31075@gwyn.tux.org>? */
-      assert (!gc_in_progress);
-      goto defproc;
-    }
+  /* If you hit this, rewrite the offending API call to occur after GC,
+     using register_post_gc_action(). */
+  assert (!gc_in_progress);
 
 #ifdef DEBUG_XEMACS
   if (debug_mswindows_events)
@@ -2830,7 +2828,8 @@ mswindows_wnd_proc (HWND hwnd, UINT message_, WPARAM wParam, LPARAM lParam)
                                               MAKEPOINTS (lParam)))
          {
            GCPRO2 (emacs_event, fobj);
-           mswindows_pump_outstanding_events ();       /* Can GC */
+           if (UNBOUNDP(mswindows_pump_outstanding_events ())) /* Can GC */
+             SendMessage (hwnd, WM_CANCELMODE, 0, 0);
            UNGCPRO;
          }
        else
@@ -3279,7 +3278,7 @@ mswindows_find_console (HWND hwnd)
 /*
  * Find the frame that matches the supplied mswindows window handle
  */
-static Lisp_Object
+Lisp_Object
 mswindows_find_frame (HWND hwnd)
 {
   LONG l = GetWindowLong (hwnd, XWL_FRAMEOBJ);
@@ -3781,7 +3780,9 @@ FROB (WM_NCHITTEST)
 FROB (WM_NCPAINT)
 FROB (WM_NCACTIVATE)
 FROB (WM_GETDLGCODE)
+#ifdef WM_SYNCPAINT /* not in VC 5 */
 FROB (WM_SYNCPAINT)
+#endif /* WM_SYNCPAINT */
 FROB (WM_NCMOUSEMOVE)
 FROB (WM_NCLBUTTONDOWN)
 FROB (WM_NCLBUTTONUP)
@@ -3804,12 +3805,12 @@ FROB (WM_SYSCHAR)
 FROB (WM_SYSDEADCHAR)
 FROB (WM_KEYLAST)
 
-#if(WINVER >= 0x0400) && !defined(CYGWIN)
+#if(WINVER >= 0x0400) && defined (WM_IME_STARTCOMPOSITION)
 FROB (WM_IME_STARTCOMPOSITION)
 FROB (WM_IME_ENDCOMPOSITION)
 FROB (WM_IME_COMPOSITION)
 FROB (WM_IME_KEYLAST)
-#endif /* WINVER >= 0x0400 */
+#endif /* WINVER >= 0x0400 && defined (WM_IME_STARTCOMPOSITION) */
 
 FROB (WM_INITDIALOG)
 FROB (WM_COMMAND)
@@ -3893,6 +3894,7 @@ FROB (WM_EXITSIZEMOVE)
 FROB (WM_DROPFILES)
 FROB (WM_MDIREFRESHMENU)
 
+#ifdef WM_IME_SETCONTEXT /* not in Cygwin? */
 
 #if(WINVER >= 0x0400) && !defined(CYGWIN)
 FROB (WM_IME_SETCONTEXT)
@@ -3910,6 +3912,7 @@ FROB (WM_IME_KEYDOWN)
 FROB (WM_IME_KEYUP)
 #endif /* WINVER >= 0x0400 */
 
+#endif /* WM_IME_SETCONTEXT */
 
 #if(_WIN32_WINNT >= 0x0400)
 FROB (WM_MOUSEHOVER)