Changeset 4032

Show
Ignore:
Timestamp:
2006年02月13日 03時25分50秒 (3 years ago)
Author:
horiguti
Message:

Fixes bugs of synchronization between main-thread and message-thread.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/mw32fns.c

    r4010 r4032  
    16911691#endif /* IME_CONTROL */ 
    16921692 
    1693 static void 
    1694 mw32m_new_focus_frame (struct mw32_display_info *dpyinfo, FRAME_PTR f) 
    1695 { 
    1696   HDC hdc1, hdc2; 
    1697   FRAME_PTR fold = dpyinfo->mw32_highlight_frame; 
    1698  
    1699   if (f) 
    1700     { 
    1701       hdc1 = GetDC (FRAME_MW32_WINDOW (f)); 
    1702       mw32_setup_default_hdc (hdc1); 
    1703       f->output_data.mw32->hdc = hdc1; 
    1704     } 
    1705   else 
    1706     hdc1 = INVALID_HANDLE_VALUE; 
    1707  
    1708   if (fold) 
    1709     { 
    1710       hdc2 = GetDC (FRAME_MW32_WINDOW (fold)); 
    1711       mw32_setup_default_hdc (hdc2); 
    1712       fold->output_data.mw32->hdc = hdc2; 
    1713     } 
    1714   else 
    1715     hdc2 = INVALID_HANDLE_VALUE; 
    1716  
    1717   mw32_new_focus_frame (dpyinfo, f); 
    1718  
    1719   if (hdc1 != INVALID_HANDLE_VALUE) 
    1720     { 
    1721       f->output_data.mw32->hdc = INVALID_HANDLE_VALUE; 
    1722       ReleaseDC (FRAME_MW32_WINDOW (f), hdc1); 
    1723     } 
    1724   if (hdc2 != INVALID_HANDLE_VALUE) 
    1725     { 
    1726       fold->output_data.mw32->hdc = INVALID_HANDLE_VALUE; 
    1727       ReleaseDC (FRAME_MW32_WINDOW (fold), hdc2); 
    1728     } 
    1729 } 
    1730  
    17311693#ifndef W32_VER4 
    17321694static HANDLE 
     
    20061968  case WM_SETFOCUS: 
    20071969 
    2008     mw32m_new_focus_frame (dpyinfo, f); 
     1970    mw32_new_focus_frame (dpyinfo, f); 
    20091971 
    20101972    /* This code is for switching selected-frame.  In order to 
     
    20422004 
    20432005    if (f == FRAME_MW32_DISPLAY_INFO (f)->mw32_focus_frame) 
    2044       mw32m_new_focus_frame (dpyinfo, NULL); 
     2006      mw32_new_focus_frame (dpyinfo, NULL); 
    20452007 
    20462008    /* reset mouse face and help echo.  */ 
     
    29612923  f->output_data.mw32->hdc = INVALID_HANDLE_VALUE; 
    29622924  f->output_data.mw32->hdc_nestlevel = 0; 
     2925  f->output_data.mw32->pending_clear_mouse_face = 0; 
    29632926  f->output_data.mw32->frame_moving_or_sizing = 0; 
    29642927  f->output_data.mw32->setcaret_event = CreateEvent (NULL, TRUE, FALSE, NULL); 
     
    40374000  f->output_data.mw32->hdc = INVALID_HANDLE_VALUE; 
    40384001  f->output_data.mw32->hdc_nestlevel = 0; 
     4002  f->output_data.mw32->pending_clear_mouse_face = 0; 
    40394003  InitializeCriticalSection (&(f->output_data.mw32->hdc_critsec)); 
    40404004 
  • trunk/src/mw32term.c

    r4023 r4032  
    668668        } 
    669669           
    670       if (*pcount > 1) 
    671         { 
    672           (*pcount)--; 
    673           return; 
    674         } 
     670      (*pcount)--; 
     671      if (*pcount > 0) 
     672        return; 
    675673 
    676674      MW32_UNBLOCK_CARET (f); 
     
    28242822                      struct frame *frame) 
    28252823{ 
    2826   struct frame *old_focus = dpyinfo->mw32_focus_frame; 
    2827  
    28282824  dpyinfo->mw32_focus_message_frame = frame; 
    28292825 
     
    28332829         the correct value of x_focus_frame.  */ 
    28342830      dpyinfo->mw32_focus_frame = frame; 
    2835  
    2836 #if 0  /* We shouldn't concern on lowering and raising the frame 
    2837           because the system automatically operate them. */ 
    2838       if (old_focus && old_focus->auto_lower) 
    2839         mw32_lower_frame (old_focus); 
    2840 #endif 
    2841  
    2842 #if 0 
    2843       selected_frame = frame; 
    2844       XSETFRAME (XWINDOW (selected_frame->selected_window)->frame, 
    2845                  selected_frame); 
    2846       Fselect_window (selected_frame->selected_window); 
    2847       choose_minibuf_frame (); 
    2848 #endif /* ! 0 */ 
    28492831 
    28502832      /* Only registering.  */ 
     
    28832865mw32_frame_rehighlight_1 (struct mw32_display_info *dpyinfo) 
    28842866{ 
    2885   struct frame *old_highlight = dpyinfo->mw32_highlight_frame; 
    2886  
    28872867  if (dpyinfo->mw32_focus_frame) 
    28882868    { 
     
    28992879  else 
    29002880    dpyinfo->mw32_highlight_frame = 0; 
    2901  
    2902   if (dpyinfo->mw32_highlight_frame != old_highlight) 
    2903     { 
    2904       if (old_highlight) 
    2905         frame_unhighlight (old_highlight); 
    2906       if (dpyinfo->mw32_highlight_frame) 
    2907         frame_highlight (dpyinfo->mw32_highlight_frame); 
    2908     } 
    2909 
    2910  
     2881
    29112882 
    29122883  
     
    42734244} 
    42744245 
     4246 
     4247static void 
     4248mw32_clear_mouse_face (struct frame *f) 
     4249{ 
     4250  struct mw32_display_info  *dpyinfo = FRAME_MW32_DISPLAY_INFO (f); 
     4251   
     4252  EnterCriticalSection (&(f->output_data.mw32->hdc_critsec)); 
     4253  if (main_thread_hdc == INVALID_HANDLE_VALUE) 
     4254    { 
     4255      GET_FRAME_HDC (f); 
     4256      clear_mouse_face (dpyinfo); 
     4257      RELEASE_FRAME_HDC (f); 
     4258      f->output_data.mw32->pending_clear_mouse_face = FALSE; 
     4259    } 
     4260  else 
     4261    f->output_data.mw32->pending_clear_mouse_face = TRUE; 
     4262  /* Pending process will be donw in mw32_message_loop */ 
     4263 
     4264  LeaveCriticalSection (&(f->output_data.mw32->hdc_critsec)); 
     4265   
     4266} 
     4267 
    42754268int mw32_inhibit_hide_mouse = 0; 
    42764269 
     
    42954288        { 
    42964289          dpyinfo->mouse_face_hidden = 0; 
    4297           WITH_MESSAGE_THREAD_HDC (f, clear_mouse_face (dpyinfo)); 
     4290          mw32_clear_mouse_face (f); 
    42984291        } 
    42994292 
     
    43544347                { 
    43554348                  dpyinfo->mouse_face_hidden = 0; 
    4356                   WITH_MESSAGE_THREAD_HDC (f, clear_mouse_face (dpyinfo)); 
     4349                  mw32_clear_mouse_face (f); 
    43574350                } 
    43584351            } 
     
    44014394                      && INTEGERP (Vmouse_highlight)) 
    44024395                    { 
    4403                       WITH_MESSAGE_THREAD_HDC (f, clear_mouse_face (dpyinfo)); 
     4396                      mw32_clear_mouse_face (f); 
    44044397                      dpyinfo->mouse_face_hidden = 1; 
    44054398                    } 
     
    44354428        { 
    44364429          dpyinfo->mouse_face_hidden = 0; 
    4437           WITH_MESSAGE_THREAD_HDC (f, clear_mouse_face (dpyinfo)); 
     4430          mw32_clear_mouse_face (f); 
    44384431        } 
    44394432 
     
    44594452        { 
    44604453          dpyinfo->mouse_face_hidden = 0; 
    4461           WITH_MESSAGE_THREAD_HDC (f, clear_mouse_face (dpyinfo)); 
     4454          mw32_clear_mouse_face (f); 
    44624455        } 
    44634456 
     
    44784471          if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) 
    44794472            { 
    4480               WITH_MESSAGE_THREAD_HDC (f, clear_mouse_face (dpyinfo)); 
     4473              mw32_clear_mouse_face (f); 
    44814474              dpyinfo->mouse_face_hidden = 1; 
    44824475            } 
     
    45074500              if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) 
    45084501                { 
    4509                   WITH_MESSAGE_THREAD_HDC (f, clear_mouse_face (dpyinfo)); 
     4502                  mw32_clear_mouse_face (f); 
    45104503                  dpyinfo->mouse_face_hidden = 1; 
    45114504                } 
     
    45844577 
    45854578          if (f) 
    4586             show_or_hide_mouse_cursor (f, msg); 
     4579            { 
     4580              if (f->output_data.mw32->pending_clear_mouse_face) 
     4581                mw32_clear_mouse_face (f); 
     4582              show_or_hide_mouse_cursor (f, msg); 
     4583            } 
    45874584 
    45884585          if ((!f) && (!IS_EMACS_PRIVATE_MESSAGE (msg.message))) 
     
    47754772 
    47764773        case WM_NCMOUSEMOVE: 
    4777           WITH_MESSAGE_THREAD_HDC (f, clear_mouse_face (dpyinfo)); 
     4774          mw32_clear_mouse_face (f); 
    47784775          dpyinfo->mouse_face_mouse_frame = NULL; 
    47794776          last_mouse_motion_frame = Qnil; 
     
    48024799                  /* If we move outside the frame, then we're 
    48034800                     certainly no longer on any text in the frame.  */ 
    4804                   WITH_MESSAGE_THREAD_HDC (f, clear_mouse_face (dpyinfo)); 
     4801                  mw32_clear_mouse_face (f); 
    48054802                  dpyinfo->mouse_face_mouse_frame = 0; 
    48064803                  last_mouse_motion_frame = Qnil; 
     
    49694966          */ 
    49704967        case WM_EMACS_CLEAR_MOUSE_FACE: 
    4971           WITH_MESSAGE_THREAD_HDC (f, clear_mouse_face (dpyinfo)); 
     4968          mw32_clear_mouse_face (f); 
    49724969 
    49734970          /* Generate a nil HELP_EVENT to cancel a help-echo. 
  • trunk/src/mw32term.h

    r4023 r4032  
    390390  /* Nesting level of hdc. */ 
    391391  int hdc_nestlevel; 
     392 
     393  /* If there is pending clear_mouse_face. */ 
     394  int pending_clear_mouse_face; 
    392395 
    393396  /* Critical section to synchronize processces using hdc for this 
     
    603606  } 
    604607 
    605  
    606 #define WITH_MESSAGE_THREAD_HDC(f, proc)                \ 
    607   {update_begin_hook (f);(proc);update_end_hook (f);} 
    608608 
    609609#define MW32_BLOCK_CARET(f)                             \ 
  • trunk/src/xfaces.c

    r4020 r4032  
    54965496         current matrix still references freed faces.  */ 
    54975497      BLOCK_INPUT; 
    5498  
     5498#ifdef MEADOW 
     5499      GET_FRAME_HDC (f); 
     5500#endif 
    54995501      for (i = 0; i < c->used; ++i) 
    55005502        { 
     
    55175519        } 
    55185520 
     5521#ifdef MEADOW 
     5522      RELEASE_FRAME_HDC (f); 
     5523#endif 
    55195524      UNBLOCK_INPUT; 
    55205525    }