Karsten Hopp da1ac4
To: vim-dev@vim.org
Karsten Hopp da1ac4
Subject: patch 7.1.007 (extra)
Karsten Hopp da1ac4
Fcc: outbox
Karsten Hopp da1ac4
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp da1ac4
Mime-Version: 1.0
Karsten Hopp da1ac4
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp da1ac4
Content-Transfer-Encoding: 8bit
Karsten Hopp da1ac4
------------
Karsten Hopp da1ac4
Karsten Hopp da1ac4
Patch 7.1.007 (extra)
Karsten Hopp da1ac4
Problem:    Mac: Context menu doesn't work on Intel Macs.
Karsten Hopp da1ac4
            Scrollbars are not dimmed when Vim is not the active application.
Karsten Hopp da1ac4
Solution:   Remove the test whether context menus are supported.  They are
Karsten Hopp da1ac4
            always there in OS/X.  Handle the dimming. (Nicolas Weber)
Karsten Hopp da1ac4
Files:      src/gui_mac.c, src/gui.h
Karsten Hopp da1ac4
Karsten Hopp da1ac4
Karsten Hopp da1ac4
*** ../vim-7.1.006/src/gui_mac.c	Thu May 10 20:07:25 2007
Karsten Hopp da1ac4
--- src/gui_mac.c	Sat Jun  9 14:19:25 2007
Karsten Hopp da1ac4
***************
Karsten Hopp da1ac4
*** 1676,1688 ****
Karsten Hopp da1ac4
  	/* TODO: NEEDED? */
Karsten Hopp da1ac4
  	clickIsPopup = FALSE;
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
! 	if ((gui.MacOSHaveCntxMenu) && (mouse_model_popup()))
Karsten Hopp da1ac4
! 	    if (IsShowContextualMenuClick(theEvent))
Karsten Hopp da1ac4
! 	    {
Karsten Hopp da1ac4
! 		vimMouseButton = MOUSE_RIGHT;
Karsten Hopp da1ac4
! 		vimModifiers &= ~MOUSE_CTRL;
Karsten Hopp da1ac4
! 		clickIsPopup = TRUE;
Karsten Hopp da1ac4
! 	    }
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
  	/* Is it a double click ? */
Karsten Hopp da1ac4
  	dblClick = ((theEvent->when - lastMouseTick) < GetDblTime());
Karsten Hopp da1ac4
--- 1676,1687 ----
Karsten Hopp da1ac4
  	/* TODO: NEEDED? */
Karsten Hopp da1ac4
  	clickIsPopup = FALSE;
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
! 	if (mouse_model_popup() && IsShowContextualMenuClick(theEvent))
Karsten Hopp da1ac4
! 	{
Karsten Hopp da1ac4
! 	    vimMouseButton = MOUSE_RIGHT;
Karsten Hopp da1ac4
! 	    vimModifiers &= ~MOUSE_CTRL;
Karsten Hopp da1ac4
! 	    clickIsPopup = TRUE;
Karsten Hopp da1ac4
! 	}
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
  	/* Is it a double click ? */
Karsten Hopp da1ac4
  	dblClick = ((theEvent->when - lastMouseTick) < GetDblTime());
Karsten Hopp da1ac4
***************
Karsten Hopp da1ac4
*** 1920,1943 ****
Karsten Hopp da1ac4
      WindowPtr	whichWindow;
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
      whichWindow = (WindowPtr) event->message;
Karsten Hopp da1ac4
!     if ((event->modifiers) & activeFlag)
Karsten Hopp da1ac4
! 	/* Activate */
Karsten Hopp da1ac4
! 	gui_focus_change(TRUE);
Karsten Hopp da1ac4
!     else
Karsten Hopp da1ac4
      {
Karsten Hopp da1ac4
! 	/* Deactivate */
Karsten Hopp da1ac4
! 	gui_focus_change(FALSE);
Karsten Hopp da1ac4
! /*	DON'T KNOW what the code below was doing
Karsten Hopp da1ac4
! 	found in the deactivate clause, but the
Karsten Hopp da1ac4
! 	clause writing TRUE into in_focus (BUG)
Karsten Hopp da1ac4
!  */
Karsten Hopp da1ac4
! 
Karsten Hopp da1ac4
! #if 0	/* Removed by Dany as per above June 2001 */
Karsten Hopp da1ac4
! 	a_bool = false;
Karsten Hopp da1ac4
! 	SetPreserveGlyph(a_bool);
Karsten Hopp da1ac4
! 	SetOutlinePreferred(a_bool);
Karsten Hopp da1ac4
! #endif
Karsten Hopp da1ac4
      }
Karsten Hopp da1ac4
  }
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
--- 1919,1937 ----
Karsten Hopp da1ac4
      WindowPtr	whichWindow;
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
      whichWindow = (WindowPtr) event->message;
Karsten Hopp da1ac4
!     /* Dim scrollbars */
Karsten Hopp da1ac4
!     if (whichWindow == gui.VimWindow)
Karsten Hopp da1ac4
      {
Karsten Hopp da1ac4
!         ControlRef rootControl;
Karsten Hopp da1ac4
!         GetRootControl(gui.VimWindow, &rootControl);
Karsten Hopp da1ac4
!         if ((event->modifiers) & activeFlag)
Karsten Hopp da1ac4
!             ActivateControl(rootControl);
Karsten Hopp da1ac4
!         else
Karsten Hopp da1ac4
!             DeactivateControl(rootControl);
Karsten Hopp da1ac4
      }
Karsten Hopp da1ac4
+ 
Karsten Hopp da1ac4
+     /* Activate */
Karsten Hopp da1ac4
+     gui_focus_change((event->modifiers) & activeFlag);
Karsten Hopp da1ac4
  }
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
***************
Karsten Hopp da1ac4
*** 2559,2574 ****
Karsten Hopp da1ac4
      OSErr	error;
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
      /* Handle contextual menu right now (if needed) */
Karsten Hopp da1ac4
!     if (gui.MacOSHaveCntxMenu)
Karsten Hopp da1ac4
! 	if (IsShowContextualMenuClick(event))
Karsten Hopp da1ac4
! 	{
Karsten Hopp da1ac4
  # if 0
Karsten Hopp da1ac4
! 	    gui_mac_handle_contextual_menu(event);
Karsten Hopp da1ac4
  # else
Karsten Hopp da1ac4
! 	    gui_mac_doMouseDownEvent(event);
Karsten Hopp da1ac4
  # endif
Karsten Hopp da1ac4
! 	    return;
Karsten Hopp da1ac4
! 	}
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
      /* Handle normal event */
Karsten Hopp da1ac4
      switch (event->what)
Karsten Hopp da1ac4
--- 2553,2567 ----
Karsten Hopp da1ac4
      OSErr	error;
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
      /* Handle contextual menu right now (if needed) */
Karsten Hopp da1ac4
!     if (IsShowContextualMenuClick(event))
Karsten Hopp da1ac4
!     {
Karsten Hopp da1ac4
  # if 0
Karsten Hopp da1ac4
!         gui_mac_handle_contextual_menu(event);
Karsten Hopp da1ac4
  # else
Karsten Hopp da1ac4
!         gui_mac_doMouseDownEvent(event);
Karsten Hopp da1ac4
  # endif
Karsten Hopp da1ac4
!         return;
Karsten Hopp da1ac4
!     }
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
      /* Handle normal event */
Karsten Hopp da1ac4
      switch (event->what)
Karsten Hopp da1ac4
***************
Karsten Hopp da1ac4
*** 2782,2795 ****
Karsten Hopp da1ac4
      (void) InstallAEHandlers();
Karsten Hopp da1ac4
  #endif
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
-     if (Gestalt(gestaltContextualMenuAttr, &gestalt_rc) == noErr)
Karsten Hopp da1ac4
- 	gui.MacOSHaveCntxMenu = BitTst(&gestalt_rc, 31-gestaltContextualMenuTrapAvailable);
Karsten Hopp da1ac4
-     else
Karsten Hopp da1ac4
- 	gui.MacOSHaveCntxMenu = false;
Karsten Hopp da1ac4
- 
Karsten Hopp da1ac4
-     if (gui.MacOSHaveCntxMenu)
Karsten Hopp da1ac4
- 	gui.MacOSHaveCntxMenu = (InitContextualMenus()==noErr);
Karsten Hopp da1ac4
- 
Karsten Hopp da1ac4
      pomme = NewMenu(256, "\p\024"); /* 0x14= = Apple Menu */
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
      AppendMenu(pomme, "\pAbout VIM");
Karsten Hopp da1ac4
--- 2775,2780 ----
Karsten Hopp da1ac4
***************
Karsten Hopp da1ac4
*** 2941,2946 ****
Karsten Hopp da1ac4
--- 2926,2932 ----
Karsten Hopp da1ac4
  #ifdef USE_CARBONKEYHANDLER
Karsten Hopp da1ac4
      EventHandlerRef keyEventHandlerRef;
Karsten Hopp da1ac4
  #endif
Karsten Hopp da1ac4
+     ControlRef rootControl;
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
      if (Gestalt(gestaltSystemVersion, &gMacSystemVersion) != noErr)
Karsten Hopp da1ac4
  	gMacSystemVersion = 0x1000; /* TODO: Default to minimum sensible value */
Karsten Hopp da1ac4
***************
Karsten Hopp da1ac4
*** 2954,2968 ****
Karsten Hopp da1ac4
      (void) InstallAEHandlers();
Karsten Hopp da1ac4
  #endif
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
-     /* Ctrl click */
Karsten Hopp da1ac4
-     if (Gestalt(gestaltContextualMenuAttr, &gestalt_rc) == noErr)
Karsten Hopp da1ac4
- 	gui.MacOSHaveCntxMenu = BitTst(&gestalt_rc, 31-gestaltContextualMenuTrapAvailable);
Karsten Hopp da1ac4
-     else
Karsten Hopp da1ac4
- 	gui.MacOSHaveCntxMenu = false;
Karsten Hopp da1ac4
- 
Karsten Hopp da1ac4
-     if (gui.MacOSHaveCntxMenu)
Karsten Hopp da1ac4
- 	gui.MacOSHaveCntxMenu = (InitContextualMenus()==noErr);
Karsten Hopp da1ac4
- 
Karsten Hopp da1ac4
      pomme = NewMenu(256, "\p\024"); /* 0x14= = Apple Menu */
Karsten Hopp da1ac4
  
Karsten Hopp da1ac4
      AppendMenu(pomme, "\pAbout VIM");
Karsten Hopp da1ac4
--- 2940,2945 ----
Karsten Hopp da1ac4
***************
Karsten Hopp da1ac4
*** 2981,2986 ****
Karsten Hopp da1ac4
--- 2958,2964 ----
Karsten Hopp da1ac4
      gui.VimWindow = NewCWindow(nil, &windRect, "\pgVim on Macintosh", true,
Karsten Hopp da1ac4
  			zoomDocProc,
Karsten Hopp da1ac4
  			(WindowPtr)-1L, true, 0);
Karsten Hopp da1ac4
+     CreateRootControl(gui.VimWindow, &rootControl);
Karsten Hopp da1ac4
      InstallReceiveHandler((DragReceiveHandlerUPP)receiveHandler,
Karsten Hopp da1ac4
  	    gui.VimWindow, NULL);
Karsten Hopp da1ac4
      SetPortWindowPort(gui.VimWindow);
Karsten Hopp da1ac4
*** ../vim-7.1.006/src/gui.h	Thu May 10 19:18:46 2007
Karsten Hopp da1ac4
--- src/gui.h	Sat Jun  9 14:10:34 2007
Karsten Hopp da1ac4
***************
Karsten Hopp da1ac4
*** 460,466 ****
Karsten Hopp da1ac4
      WindowPtr	VimWindow;
Karsten Hopp da1ac4
      MenuHandle	MacOSHelpMenu;	    /* Help menu provided by the MacOS */
Karsten Hopp da1ac4
      int		MacOSHelpItems;	    /* Nr of help-items supplied by MacOS */
Karsten Hopp da1ac4
-     int		MacOSHaveCntxMenu;  /* Contextual menu available */
Karsten Hopp da1ac4
      WindowPtr	wid;		    /* Window id of text area */
Karsten Hopp da1ac4
      int		visibility;	    /* Is window partially/fully obscured? */
Karsten Hopp da1ac4
  #endif
Karsten Hopp da1ac4
--- 460,465 ----
Karsten Hopp da1ac4
*** ../vim-7.1.006/src/version.c	Tue Jun 19 15:40:51 2007
Karsten Hopp da1ac4
--- src/version.c	Tue Jun 19 15:44:15 2007
Karsten Hopp da1ac4
***************
Karsten Hopp da1ac4
*** 668,669 ****
Karsten Hopp da1ac4
--- 668,671 ----
Karsten Hopp da1ac4
  {   /* Add new patch number below this line */
Karsten Hopp da1ac4
+ /**/
Karsten Hopp da1ac4
+     7,
Karsten Hopp da1ac4
  /**/
Karsten Hopp da1ac4
Karsten Hopp da1ac4
-- 
Karsten Hopp da1ac4
       When danger reared its ugly head,
Karsten Hopp da1ac4
       He bravely turned his tail and fled
Karsten Hopp da1ac4
       Yes, Brave Sir Robin turned about
Karsten Hopp da1ac4
       And gallantly he chickened out
Karsten Hopp da1ac4
       Bravely taking to his feet
Karsten Hopp da1ac4
       He beat a very brave retreat
Karsten Hopp da1ac4
       Bravest of the brave Sir Robin
Karsten Hopp da1ac4
       Petrified of being dead
Karsten Hopp da1ac4
       Soiled his pants then brave Sir Robin
Karsten Hopp da1ac4
       Turned away and fled.
Karsten Hopp da1ac4
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp da1ac4
Karsten Hopp da1ac4
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp da1ac4
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp da1ac4
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp da1ac4
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///