emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Focus on MAC OS/X with carbon


From: YAMAMOTO Mitsuharu
Subject: Re: Focus on MAC OS/X with carbon
Date: Sat, 26 Jun 2004 16:09:07 +0900
User-agent: Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.6 Emacs/21.3.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Mon, 21 Jun 2004 19:59:13 +0900, YAMAMOTO Mitsuharu <address@hidden> 
>>>>> said:

>> Symptoms: It happens often that the focusing of frames gets
>> brokens.

> I also sometimes (but not often) experience the similar phenomenon.
> Could you try and see what occurs if macterm.c is reverted to the
> one just before the tooltip support?

>   
> http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/emacs/emacs/src/macterm.c?rev=1.69

> If the focus problem go away with this, it is due to the change
> between 1.69 and 1.70.

Thanks to the help of Gian Uberto Lauri, some problems are found in
mouse grabbing.  The following patch also addresses the problem that a
crash occurs when an input method (such as Kotoeri) creates a window.

                                     YAMAMOTO Mitsuharu
                                address@hidden

2004-06-26  YAMAMOTO Mitsuharu  <address@hidden>
        
        * macterm.c (do_window_activate, do_window_deactivate): Remove.
        (XTread_socket): Send mouse button events to the toolbox
        dispatcher even when the mouse is grabbed.  Don't process window
        activate events for non-Emacs windows.  Replace function calls to
        do_window_activate and do_window_deactivate with their contents.
        Reset mouse grabbing status when a window is deactivated.
        
Index: src/macterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/macterm.c,v
retrieving revision 1.71
diff -c -r1.71 macterm.c
*** src/macterm.c       17 Jun 2004 13:04:09 -0000      1.71
--- src/macterm.c       26 Jun 2004 06:21:32 -0000
***************
*** 7237,7276 ****
  }
  
  static void
- do_window_activate (WindowPtr win)
- {
-   struct frame *f;
- 
-   if (is_emacs_window (win))
-     {
-       f = mac_window_to_frame (win);
- 
-       if (f)
-       {
-         x_new_focus_frame (FRAME_MAC_DISPLAY_INFO (f), f);
-         activate_scroll_bars (f);
-       }
-     }
- }
- 
- static void
- do_window_deactivate (WindowPtr win)
- {
-   struct frame *f;
- 
-   if (is_emacs_window (win))
-     {
-       f = mac_window_to_frame (win);
- 
-       if (f == FRAME_MAC_DISPLAY_INFO (f)->x_focus_frame)
-       {
-         x_new_focus_frame (FRAME_MAC_DISPLAY_INFO (f), 0);
-         deactivate_scroll_bars (f);
-       }
-     }
- }
- 
- static void
  do_app_resume ()
  {
    WindowPtr wp;
--- 7237,7242 ----
***************
*** 8135,8140 ****
--- 8101,8113 ----
            SInt16 part_code;
            int tool_bar_p = 0;
  
+ #if USE_CARBON_EVENTS
+           /* This is needed to send mouse events like aqua window
+              buttons to the correct handler.  */
+           if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
+               != eventNotHandledErr)
+             break;
+ #endif
            if (dpyinfo->grabbed && last_mouse_frame
                && FRAME_LIVE_P (last_mouse_frame))
              {
***************
*** 8150,8165 ****
                    window_ptr = FrontWindow ();
                  }
  
- #if USE_CARBON_EVENTS
-               /* This is needed to send mouse events like aqua
-                  window buttons to the correct handler.  */
-               if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
-                   != eventNotHandledErr)
-                 break;
- 
                if (!is_emacs_window (window_ptr))
                  break;
! #endif
                part_code = FindWindow (er.where, &window_ptr);
              }
  
--- 8123,8131 ----
                    window_ptr = FrontWindow ();
                  }
  
                if (!is_emacs_window (window_ptr))
                  break;
! 
                part_code = FindWindow (er.where, &window_ptr);
              }
  
***************
*** 8393,8416 ****
                break;
              }
  
            if ((er.modifiers & activeFlag) != 0)
              {
                Point mouse_loc = er.where;
  
!               do_window_activate (window_ptr);
  
                SetPortWindowPort (window_ptr);
                GlobalToLocal (&mouse_loc);
!               /* activateEvt counts as mouse movement,
                   so update things that depend on mouse position.  */
                note_mouse_movement (mac_window_to_frame (window_ptr),
                                     &mouse_loc);
              }
            else
              {
!               do_window_deactivate (window_ptr);
  
!               f = mac_window_to_frame (window_ptr);
                if (f == dpyinfo->mouse_face_mouse_frame)
                  {
                    /* If we move outside the frame, then we're
--- 8359,8395 ----
                break;
              }
  
+           if (!is_emacs_window (window_ptr))
+             break;
+ 
+           f = mac_window_to_frame (window_ptr);
+ 
            if ((er.modifiers & activeFlag) != 0)
+             /* A window has been activated.  */
              {
                Point mouse_loc = er.where;
  
!               x_new_focus_frame (dpyinfo, f);
!               activate_scroll_bars (f);
  
                SetPortWindowPort (window_ptr);
                GlobalToLocal (&mouse_loc);
!               /* Window-activated event counts as mouse movement,
                   so update things that depend on mouse position.  */
                note_mouse_movement (mac_window_to_frame (window_ptr),
                                     &mouse_loc);
              }
            else
+             /* A window has been deactivated.  */
              {
!               dpyinfo->grabbed = 0;
  
!               if (f == dpyinfo->x_focus_frame)
!                 {
!                   x_new_focus_frame (dpyinfo, 0);
!                   deactivate_scroll_bars (f);
!                 }
!               
                if (f == dpyinfo->mouse_face_mouse_frame)
                  {
                    /* If we move outside the frame, then we're




reply via email to

[Prev in Thread] Current Thread [Next in Thread]