emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/macterm.c


From: Andrew Choi
Subject: [Emacs-diffs] Changes to emacs/src/macterm.c
Date: Mon, 12 Aug 2002 00:34:00 -0400

Index: emacs/src/macterm.c
diff -c emacs/src/macterm.c:1.15 emacs/src/macterm.c:1.16
*** emacs/src/macterm.c:1.15    Sat Aug 10 20:26:24 2002
--- emacs/src/macterm.c Mon Aug 12 00:33:59 2002
***************
*** 475,480 ****
--- 475,482 ----
  static void activate_scroll_bars (FRAME_PTR);
  static void deactivate_scroll_bars (FRAME_PTR);
  
+ static int is_emacs_window (WindowPtr);
+ 
  extern int image_ascent (struct image *, struct face *);
  void x_set_offset (struct frame *, int, int, int);
  int x_bitmap_icon (struct frame *, Lisp_Object);
***************
*** 8251,8259 ****
    Point mouse_pos;
    int ignore1, ignore2;
    WindowPtr wp = FrontWindow ();
!   struct frame *f = ((mac_output *) GetWRefCon (wp))->mFP;            
    Lisp_Object frame, tail;
  
    BLOCK_INPUT;
  
    if (! NILP (last_mouse_scroll_bar) && insist == 0)
--- 8253,8264 ----
    Point mouse_pos;
    int ignore1, ignore2;
    WindowPtr wp = FrontWindow ();
!   struct frame *f;
    Lisp_Object frame, tail;
  
+   if (is_emacs_window(wp))
+     f = ((mac_output *) GetWRefCon (wp))->mFP;         
+ 
    BLOCK_INPUT;
  
    if (! NILP (last_mouse_scroll_bar) && insist == 0)
***************
*** 11497,11502 ****
--- 11502,11515 ----
  /* True if the mouse wheel button (i.e. button 4) should map to
     mouse-2, instead of mouse-3.  */
  Lisp_Object Vmac_wheel_button_is_mouse_2;
+ 
+ /* If Non-nil, the Mac "Command" key is passed on to the Mac Toolbox
+    for processing before Emacs sees it.  */
+ Lisp_Object Vmac_pass_command_to_system;
+ 
+ /* If Non-nil, the Mac "Control" key is passed on to the Mac Toolbox
+    for processing before Emacs sees it.  */
+ Lisp_Object Vmac_pass_control_to_system;
  #endif
  
  /* convert input from Mac keyboard (assumed to be in Mac Roman coding)
***************
*** 11840,11856 ****
  do_mouse_moved (Point mouse_pos)
  {
    WindowPtr wp = FrontWindow ();
!   struct frame *f = ((mac_output *) GetWRefCon (wp))->mFP;            
  
  #if TARGET_API_MAC_CARBON
        SetPort (GetWindowPort (wp));
  #else
        SetPort (wp);
  #endif
  
!   GlobalToLocal (&mouse_pos);
! 
!   note_mouse_movement (f, &mouse_pos);
  }
  
  
--- 11853,11874 ----
  do_mouse_moved (Point mouse_pos)
  {
    WindowPtr wp = FrontWindow ();
!   struct frame *f;
  
+   if (is_emacs_window (wp)) 
+     {
+       f = ((mac_output *) GetWRefCon (wp))->mFP;            
+       
  #if TARGET_API_MAC_CARBON
        SetPort (GetWindowPort (wp));
  #else
        SetPort (wp);
  #endif
  
!       GlobalToLocal (&mouse_pos);
!       
!       note_mouse_movement (f, &mouse_pos);
!     }
  }
  
  
***************
*** 12626,12632 ****
              {
                SInt32 delta;
                Point point;
!               WindowPtr window_ptr = FrontWindow ();
                struct mac_output *mwp = (mac_output *) GetWRefCon (window_ptr);
                GetEventParameter(eventRef, kEventParamMouseWheelDelta,
                                  typeSInt32, NULL, sizeof (SInt32),
--- 12644,12650 ----
              {
                SInt32 delta;
                Point point;
!               WindowPtr window_ptr = FrontNonFloatingWindow ();
                struct mac_output *mwp = (mac_output *) GetWRefCon (window_ptr);
                GetEventParameter(eventRef, kEventParamMouseWheelDelta,
                                  typeSInt32, NULL, sizeof (SInt32),
***************
*** 12666,12673 ****
          SInt16 part_code;
  
  #if USE_CARBON_EVENTS
!         /* This is needed to correctly */
!         SendEventToEventTarget (eventRef, GetEventDispatcherTarget ());
  #endif
  
            if (mouse_tracking_in_progress == mouse_tracking_scroll_bar
--- 12684,12697 ----
          SInt16 part_code;
  
  #if USE_CARBON_EVENTS
!         /* This is needed to send mouse events like aqua window buttons
!            to the correct handler.  */
!         if (eventNotHandledErr != SendEventToEventTarget (eventRef, 
GetEventDispatcherTarget ())) {
!           break;
!         }
! 
!         if (!is_emacs_window(window_ptr))
!           break;
  #endif
  
            if (mouse_tracking_in_progress == mouse_tracking_scroll_bar
***************
*** 12861,12867 ****
        case osEvt:
        case activateEvt:
  #if USE_CARBON_EVENTS
!       SendEventToEventTarget (eventRef, GetEventDispatcherTarget ());
  #endif        
        do_events (&er);
        break;
--- 12885,12891 ----
        case osEvt:
        case activateEvt:
  #if USE_CARBON_EVENTS
!       if (eventNotHandledErr == SendEventToEventTarget (eventRef, 
GetEventDispatcherTarget ()))
  #endif        
        do_events (&er);
        break;
***************
*** 12872,12877 ****
--- 12896,12919 ----
          int keycode = (er.message & keyCodeMask) >> 8;
          int xkeysym;
          
+ #if USE_CARBON_EVENTS
+         /* When using Carbon Events, we need to pass raw keyboard events
+            to the TSM ourselves.  If TSM handles it, it will pass back
+            noErr, otherwise it will pass back "eventNotHandledErr" and
+            we can process it normally.   */
+         if ((!NILP (Vmac_pass_command_to_system)
+              || !(er.modifiers & cmdKey))
+             && (!NILP (Vmac_pass_control_to_system)
+                 || !(er.modifiers & controlKey)))
+           {
+             OSStatus err;
+             err = SendEventToEventTarget (eventRef,
+                                           GetEventDispatcherTarget ());
+             if (err != eventNotHandledErr)
+               break;
+           }
+ #endif
+ 
          if (!IsValidWindowPtr (FrontNonFloatingWindow ()))
            {
              SysBeep (1);
***************
*** 13011,13026 ****
             constuct_drag_n_drop in w32term.c.  */
          if (!NILP (drag_and_drop_file_list))
            {
!             struct frame *f;
              WindowPtr wp;
              Lisp_Object frame;
  
!             wp = FrontWindow ();
!             if (!wp)
!               f = NULL;
!             else
!               f = ((mac_output *) GetWRefCon (wp))->mFP;            
!             
              bufp->kind = DRAG_N_DROP_EVENT;
              bufp->code = 0;
              bufp->timestamp = er.when * (1000 / 60);
--- 13053,13066 ----
             constuct_drag_n_drop in w32term.c.  */
          if (!NILP (drag_and_drop_file_list))
            {
!             struct frame *f = NULL;
              WindowPtr wp;
              Lisp_Object frame;
  
!             wp = FrontNonFloatingWindow ();
!             if (wp && is_emacs_window(wp))
!               f = ((mac_output *) GetWRefCon (wp))->mFP;            
! 
              bufp->kind = DRAG_N_DROP_EVENT;
              bufp->code = 0;
              bufp->timestamp = er.when * (1000 / 60);
***************
*** 13610,13615 ****
--- 13650,13665 ----
  the right click will be mouse-3.
  Otherwise, the right click will be mouse-2 and the wheel button mouse-3.*/);
    Vmac_wheel_button_is_mouse_2 = Qt;
+ 
+   DEFVAR_LISP ("mac-pass-command-to-system", &Vmac_pass_command_to_system,
+    doc: /* If non-nil, the Mac \"Command\" key is passed on to the Mac
+ Toolbox for processing before Emacs sees it.  */);
+   Vmac_pass_command_to_system = Qt;
+ 
+   DEFVAR_LISP ("mac-pass-control-to-system", &Vmac_pass_control_to_system,
+    doc: /* If non-nil, the Mac \"Control\" key is passed on to the Mac
+ Toolbox for processing before Emacs sees it.  */);
+   Vmac_pass_control_to_system = Qt;
  #endif
  
    DEFVAR_INT ("mac-keyboard-text-encoding", &mac_keyboard_text_encoding,




reply via email to

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