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: YAMAMOTO Mitsuharu
Subject: [Emacs-diffs] Changes to emacs/src/macterm.c
Date: Fri, 04 Mar 2005 06:11:16 -0500

Index: emacs/src/macterm.c
diff -c emacs/src/macterm.c:1.102 emacs/src/macterm.c:1.103
*** emacs/src/macterm.c:1.102   Thu Feb  3 11:57:36 2005
--- emacs/src/macterm.c Fri Mar  4 11:11:16 2005
***************
*** 34,45 ****
  #include <alloca.h>
  #endif
  
! #ifdef MAC_OSX
  /* USE_CARBON_EVENTS determines if the Carbon Event Manager is used to
     obtain events from the event queue.  If set to 0, WaitNextEvent is
     used instead.  */
  #define USE_CARBON_EVENTS 1
! #else /* not MAC_OSX */
  #include <Quickdraw.h>
  #include <ToolUtils.h>
  #include <Sound.h>
--- 34,45 ----
  #include <alloca.h>
  #endif
  
! #if TARGET_API_MAC_CARBON
  /* USE_CARBON_EVENTS determines if the Carbon Event Manager is used to
     obtain events from the event queue.  If set to 0, WaitNextEvent is
     used instead.  */
  #define USE_CARBON_EVENTS 1
! #else /* not TARGET_API_MAC_CARBON */
  #include <Quickdraw.h>
  #include <ToolUtils.h>
  #include <Sound.h>
***************
*** 58,64 ****
  #if __profile__
  #include <profiler.h>
  #endif
! #endif /* not MAC_OSX */
  
  #include "systty.h"
  #include "systime.h"
--- 58,64 ----
  #if __profile__
  #include <profiler.h>
  #endif
! #endif /* not TARGET_API_MAC_CARBON */
  
  #include "systty.h"
  #include "systime.h"
***************
*** 245,251 ****
  
  extern int inhibit_window_system;
  
! #if __MRC__
  QDGlobals qd;  /* QuickDraw global information structure.  */
  #endif
  
--- 245,251 ----
  
  extern int inhibit_window_system;
  
! #if __MRC__ && !TARGET_API_MAC_CARBON
  QDGlobals qd;  /* QuickDraw global information structure.  */
  #endif
  
***************
*** 5574,5579 ****
--- 5574,5582 ----
  
    BLOCK_INPUT;
  
+   if (wp != tip_window)
+     remove_window_handler (wp);
+ 
    DisposeWindow (wp);
    if (wp == tip_window)
      /* Neither WaitNextEvent nor ReceiveNextEvent receives `window
***************
*** 7078,7084 ****
  
  /* The Mac Event loop code */
  
! #ifndef MAC_OSX
  #include <Events.h>
  #include <Quickdraw.h>
  #include <Balloons.h>
--- 7081,7087 ----
  
  /* The Mac Event loop code */
  
! #if !TARGET_API_MAC_CARBON
  #include <Events.h>
  #include <Quickdraw.h>
  #include <Balloons.h>
***************
*** 7099,7105 ****
  #if __MWERKS__
  #include <unix.h>
  #endif
! #endif /* ! MAC_OSX */
  
  #define M_APPLE 128
  #define I_ABOUT 1
--- 7102,7108 ----
  #if __MWERKS__
  #include <unix.h>
  #endif
! #endif /* ! TARGET_API_MAC_CARBON */
  
  #define M_APPLE 128
  #define I_ABOUT 1
***************
*** 7200,7211 ****
--- 7203,7218 ----
  /* Drag and Drop */
  static pascal OSErr mac_do_track_drag (DragTrackingMessage, WindowPtr, void*, 
DragReference);
  static pascal OSErr mac_do_receive_drag (WindowPtr, void*, DragReference);
+ static DragTrackingHandlerUPP mac_do_track_dragUPP = NULL;
+ static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL;
  #endif
  
  #if USE_CARBON_EVENTS
+ #ifdef MAC_OSX
  /* Preliminary Support for the OSX Services Menu */
  static OSStatus mac_handle_service_event (EventHandlerCallRef,EventRef,void*);
  static void init_service_handler ();
+ #endif
  /* Window Event Handler */
  static pascal OSStatus mac_handle_window_event (EventHandlerCallRef,
                                                EventRef, void *);
***************
*** 7844,7850 ****
  }
  
  #if USE_CARBON_EVENTS
! 
  void
  init_service_handler ()
  {
--- 7851,7857 ----
  }
  
  #if USE_CARBON_EVENTS
! #ifdef MAC_OSX
  void
  init_service_handler ()
  {
***************
*** 7940,7946 ****
      }
    return err;
  }
! 
  
  static pascal OSStatus
  mac_handle_window_event (next_handler, event, data)
--- 7947,7953 ----
      }
    return err;
  }
! #endif
  
  static pascal OSStatus
  mac_handle_window_event (next_handler, event, data)
***************
*** 8037,8050 ****
                                   NULL, NULL);
  #endif
  #if TARGET_API_MAC_CARBON
    if (err == noErr)
!     err = InstallTrackingHandler (mac_do_track_drag, window, NULL);
    if (err == noErr)
!     err = InstallReceiveHandler (mac_do_receive_drag, window, NULL);
  #endif
    return err;
  }
  
  
  /* Open Application Apple Event */
  static pascal OSErr
--- 8044,8073 ----
                                   NULL, NULL);
  #endif
  #if TARGET_API_MAC_CARBON
+   if (mac_do_track_dragUPP == NULL)
+     mac_do_track_dragUPP = NewDragTrackingHandlerUPP (mac_do_track_drag);
+   if (mac_do_receive_dragUPP == NULL)
+     mac_do_receive_dragUPP = NewDragReceiveHandlerUPP (mac_do_receive_drag);
+ 
    if (err == noErr)
!     err = InstallTrackingHandler (mac_do_track_dragUPP, window, NULL);
    if (err == noErr)
!     err = InstallReceiveHandler (mac_do_receive_dragUPP, window, NULL);
  #endif
    return err;
  }
  
+ void
+ remove_window_handler (window)
+      WindowPtr window;
+ {
+ #if TARGET_API_MAC_CARBON
+   if (mac_do_track_dragUPP)
+     RemoveTrackingHandler (mac_do_track_dragUPP, window);
+   if (mac_do_receive_dragUPP)
+     RemoveReceiveHandler (mac_do_receive_dragUPP, window);
+ #endif
+ }
  
  /* Open Application Apple Event */
  static pascal OSErr
***************
*** 8123,8131 ****
          /* AE file list is one based so just use that for indexing here.  */
          for (i = 1; i <= num_files_to_open; i++)
          {
  #ifdef MAC_OSX
            FSRef fref;
-           char unix_path_name[MAXPATHLEN];
  
            err = AEGetNthPtr (&the_desc, i, typeFSRef, &keyword,
                               &actual_type, &fref, sizeof (FSRef),
--- 8146,8154 ----
          /* AE file list is one based so just use that for indexing here.  */
          for (i = 1; i <= num_files_to_open; i++)
          {
+           char unix_path_name[MAXPATHLEN];
  #ifdef MAC_OSX
            FSRef fref;
  
            err = AEGetNthPtr (&the_desc, i, typeFSRef, &keyword,
                               &actual_type, &fref, sizeof (FSRef),
***************
*** 8137,8151 ****
                == noErr)
  #else
            FSSpec fs;
-           Str255 path_name, unix_path_name;
  
            err = AEGetNthPtr(&the_desc, i, typeFSS, &keyword, &actual_type,
                              (Ptr) &fs, sizeof (fs), &actual_size);
            if (err != noErr) continue;
  
!           if (path_from_vol_dir_name (path_name, 255, fs.vRefNum, fs.parID,
!                                       fs.name) &&
!               mac_to_posix_pathname (path_name, unix_path_name, 255))
  #endif
              /* x-dnd functions expect undecoded filenames.  */
              drag_and_drop_file_list =
--- 8160,8172 ----
                == noErr)
  #else
            FSSpec fs;
  
            err = AEGetNthPtr(&the_desc, i, typeFSS, &keyword, &actual_type,
                              (Ptr) &fs, sizeof (fs), &actual_size);
            if (err != noErr) continue;
  
!           if (fsspec_to_posix_pathname (&fs, unix_path_name,
!                                         sizeof (unix_path_name) - 1) == noErr)
  #endif
              /* x-dnd functions expect undecoded filenames.  */
              drag_and_drop_file_list =
***************
*** 8264,8273 ****
        {
  #ifdef MAC_OSX
          FSRef fref;
-         char unix_path_name[MAXPATHLEN];
- #else
-         Str255 path_name, unix_path_name;
  #endif
          GetFlavorData (theDrag, theItem, flavorTypeHFS, &data, &size, 0L);
  #ifdef MAC_OSX
          /* Use Carbon routines, otherwise it converts the file name
--- 8285,8293 ----
        {
  #ifdef MAC_OSX
          FSRef fref;
  #endif
+         char unix_path_name[MAXPATHLEN];
+ 
          GetFlavorData (theDrag, theItem, flavorTypeHFS, &data, &size, 0L);
  #ifdef MAC_OSX
          /* Use Carbon routines, otherwise it converts the file name
***************
*** 8275,8283 ****
          FSpMakeFSRef (&data.fileSpec, &fref);
          if (! FSRefMakePath (&fref, unix_path_name, sizeof (unix_path_name)));
  #else
!         if (path_from_vol_dir_name (path_name, 255, data.fileSpec.vRefNum,
!                                     data.fileSpec.parID, data.fileSpec.name) 
&&
!             mac_to_posix_pathname (path_name, unix_path_name, 255))
  #endif
            /* x-dnd functions expect undecoded filenames.  */
              drag_and_drop_file_list =
--- 8295,8302 ----
          FSpMakeFSRef (&data.fileSpec, &fref);
          if (! FSRefMakePath (&fref, unix_path_name, sizeof (unix_path_name)));
  #else
!         if (fsspec_to_posix_pathname (&data.fileSpec, unix_path_name,
!                                       sizeof (unix_path_name) - 1) == noErr)
  #endif
            /* x-dnd functions expect undecoded filenames.  */
              drag_and_drop_file_list =
***************
*** 8374,8380 ****
     hints and prompts in the minibuffer after the user stops typing for
     a wait, etc.  */
  
! #if !TARGET_API_MAC_CARBON
  #undef main
  int
  main (void)
--- 8393,8399 ----
     hints and prompts in the minibuffer after the user stops typing for
     a wait, etc.  */
  
! #ifdef MAC_OS8
  #undef main
  int
  main (void)
***************
*** 8956,8962 ****
            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
--- 8975,8981 ----
            int keycode = (er.message & keyCodeMask) >> 8;
            int xkeysym;
  
! #if USE_CARBON_EVENTS && defined (MAC_OSX)
            /* 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
***************
*** 9265,9276 ****
--- 9284,9304 ----
    f->output_data.mac->mouse_pixel = 0xff00ff;
    f->output_data.mac->cursor_foreground_pixel = 0x0000ff;
  
+ #if TARGET_API_MAC_CARBON
+   f->output_data.mac->text_cursor = kThemeIBeamCursor;
+   f->output_data.mac->nontext_cursor = kThemeArrowCursor;
+   f->output_data.mac->modeline_cursor = kThemeArrowCursor;
+   f->output_data.mac->hand_cursor = kThemePointingHandCursor;
+   f->output_data.mac->hourglass_cursor = kThemeWatchCursor;
+   f->output_data.mac->horizontal_drag_cursor = kThemeResizeLeftRightCursor;
+ #else
    f->output_data.mac->text_cursor = GetCursor (iBeamCursor);
    f->output_data.mac->nontext_cursor = &arrow_cursor;
    f->output_data.mac->modeline_cursor = &arrow_cursor;
    f->output_data.mac->hand_cursor = &arrow_cursor;
    f->output_data.mac->hourglass_cursor = GetCursor (watchCursor);
    f->output_data.mac->horizontal_drag_cursor = &arrow_cursor;
+ #endif
  
    FRAME_FONTSET (f) = -1;
    f->output_data.mac->explicit_parent = 0;
***************
*** 9805,9811 ****
  #if TARGET_API_MAC_CARBON
    init_required_apple_events ();
  
! #if USE_CARBON_EVENTS
    init_service_handler ();
  
    init_quit_char_handler ();
--- 9833,9839 ----
  #if TARGET_API_MAC_CARBON
    init_required_apple_events ();
  
! #if USE_CARBON_EVENTS && defined (MAC_OSX)
    init_service_handler ();
  
    init_quit_char_handler ();
***************
*** 9813,9821 ****
--- 9841,9851 ----
  
    DisableMenuCommand (NULL, kHICommandQuit);
  
+ #ifdef MAC_OSX
    if (!inhibit_window_system)
      MakeMeTheFrontProcess ();
  #endif
+ #endif
    UNBLOCK_INPUT;
  }
  




reply via email to

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