/[emacs]/emacs/src/w32term.c
ViewVC logotype

Diff of /emacs/src/w32term.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.223 by kfstorm, Thu Jan 27 22:33:39 2005 UTC revision 1.224 by jasonr, Sat Mar 26 00:19:53 2005 UTC
# Line 255  static void frame_highlight P_ ((struct Line 255  static void frame_highlight P_ ((struct
255  static void frame_unhighlight P_ ((struct frame *));  static void frame_unhighlight P_ ((struct frame *));
256  static void x_new_focus_frame P_ ((struct w32_display_info *,  static void x_new_focus_frame P_ ((struct w32_display_info *,
257                                     struct frame *));                                     struct frame *));
258    static void x_focus_changed P_ ((int, int, struct w32_display_info *,
259                                      struct frame *, struct input_event *));
260    static void w32_detect_focus_change P_ ((struct w32_display_info *,
261                                           W32Msg *, struct input_event *));
262  static void w32_frame_rehighlight P_ ((struct frame *));  static void w32_frame_rehighlight P_ ((struct frame *));
263  static void x_frame_rehighlight P_ ((struct w32_display_info *));  static void x_frame_rehighlight P_ ((struct w32_display_info *));
264  static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *));  static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *));
# Line 2816  x_new_focus_frame (dpyinfo, frame) Line 2820  x_new_focus_frame (dpyinfo, frame)
2820    x_frame_rehighlight (dpyinfo);    x_frame_rehighlight (dpyinfo);
2821  }  }
2822    
2823    
2824    /* Handle FocusIn and FocusOut state changes for FRAME.
2825       If FRAME has focus and there exists more than one frame, puts
2826       a FOCUS_IN_EVENT into *BUFP.  */
2827    
2828    static void
2829    x_focus_changed (type, state, dpyinfo, frame, bufp)
2830         int type;
2831         int state;
2832         struct w32_display_info *dpyinfo;
2833         struct frame *frame;
2834         struct input_event *bufp;
2835    {
2836      if (type == WM_SETFOCUS)
2837        {
2838          if (dpyinfo->w32_focus_event_frame != frame)
2839            {
2840              x_new_focus_frame (dpyinfo, frame);
2841              dpyinfo->w32_focus_event_frame = frame;
2842    
2843              /* Don't stop displaying the initial startup message
2844                 for a switch-frame event we don't need.  */
2845              if (GC_NILP (Vterminal_frame)
2846                  && GC_CONSP (Vframe_list)
2847                  && !GC_NILP (XCDR (Vframe_list)))
2848                {
2849                  bufp->kind = FOCUS_IN_EVENT;
2850                  XSETFRAME (bufp->frame_or_window, frame);
2851                }
2852            }
2853    
2854          frame->output_data.x->focus_state |= state;
2855    
2856          /* TODO: IME focus?  */
2857        }
2858      else if (type == WM_KILLFOCUS)
2859        {
2860          frame->output_data.x->focus_state &= ~state;
2861    
2862          if (dpyinfo->w32_focus_event_frame == frame)
2863            {
2864              dpyinfo->w32_focus_event_frame = 0;
2865              x_new_focus_frame (dpyinfo, 0);
2866            }
2867    
2868          /* TODO: IME focus?  */
2869        }
2870    }
2871    
2872    
2873    /* The focus may have changed.  Figure out if it is a real focus change,
2874       by checking both FocusIn/Out and Enter/LeaveNotify events.
2875    
2876       Returns FOCUS_IN_EVENT event in *BUFP. */
2877    
2878    static void
2879    w32_detect_focus_change (dpyinfo, event, bufp)
2880         struct w32_display_info *dpyinfo;
2881         W32Msg *event;
2882         struct input_event *bufp;
2883    {
2884      struct frame *frame;
2885    
2886      frame = x_any_window_to_frame (dpyinfo, event->msg.hwnd);
2887      if (! frame)
2888        return;
2889    
2890      /* On w32, this is only called from focus events, so no switch needed.  */
2891      x_focus_changed (event->msg.message,
2892                       (event->msg.message == WM_KILLFOCUS ?
2893                        FOCUS_IMPLICIT : FOCUS_EXPLICIT),
2894                       dpyinfo, frame, bufp);
2895    }
2896    
2897    
2898  /* Handle an event saying the mouse has moved out of an Emacs frame.  */  /* Handle an event saying the mouse has moved out of an Emacs frame.  */
2899    
2900  void  void
# Line 4660  w32_read_socket (sd, expected, hold_quit Line 4739  w32_read_socket (sd, expected, hold_quit
4739            break;            break;
4740    
4741          case WM_SETFOCUS:          case WM_SETFOCUS:
4742            /* TODO: Port this change:            w32_detect_focus_change (dpyinfo, &msg, &inev);
              2002-06-28  Jan D.  <jan.h.d@swipnet.se>  
              * xterm.h (struct x_output): Add focus_state.  
              * xterm.c (x_focus_changed): New function.  
              (x_detect_focus_change): New function.  
              (XTread_socket): Call x_detect_focus_change for FocusIn/FocusOut  
              EnterNotify and LeaveNotify to track X focus changes.  
           */  
           f = x_any_window_to_frame (dpyinfo, msg.msg.hwnd);  
   
           dpyinfo->w32_focus_event_frame = f;  
   
           if (f)  
             x_new_focus_frame (dpyinfo, f);  
4743    
4744            dpyinfo->grabbed = 0;            dpyinfo->grabbed = 0;
4745            check_visibility = 1;            check_visibility = 1;
4746            break;            break;
4747    
4748          case WM_KILLFOCUS:          case WM_KILLFOCUS:
           /* TODO: some of this belongs in MOUSE_LEAVE */  
4749            f = x_top_window_to_frame (dpyinfo, msg.msg.hwnd);            f = x_top_window_to_frame (dpyinfo, msg.msg.hwnd);
4750    
4751            if (f)            if (f)

Legend:
Removed from v.1.223  
changed lines
  Added in v.1.224

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26