2 Subject: patch 7.1.007 (extra)
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Mac: Context menu doesn't work on Intel Macs.
12 Scrollbars are not dimmed when Vim is not the active application.
13 Solution: Remove the test whether context menus are supported. They are
14 always there in OS/X. Handle the dimming. (Nicolas Weber)
15 Files: src/gui_mac.c, src/gui.h
18 *** ../vim-7.1.006/src/gui_mac.c Thu May 10 20:07:25 2007
19 --- src/gui_mac.c Sat Jun 9 14:19:25 2007
25 ! if ((gui.MacOSHaveCntxMenu) && (mouse_model_popup()))
26 ! if (IsShowContextualMenuClick(theEvent))
28 ! vimMouseButton = MOUSE_RIGHT;
29 ! vimModifiers &= ~MOUSE_CTRL;
30 ! clickIsPopup = TRUE;
33 /* Is it a double click ? */
34 dblClick = ((theEvent->when - lastMouseTick) < GetDblTime());
39 ! if (mouse_model_popup() && IsShowContextualMenuClick(theEvent))
41 ! vimMouseButton = MOUSE_RIGHT;
42 ! vimModifiers &= ~MOUSE_CTRL;
43 ! clickIsPopup = TRUE;
46 /* Is it a double click ? */
47 dblClick = ((theEvent->when - lastMouseTick) < GetDblTime());
50 WindowPtr whichWindow;
52 whichWindow = (WindowPtr) event->message;
53 ! if ((event->modifiers) & activeFlag)
55 ! gui_focus_change(TRUE);
59 ! gui_focus_change(FALSE);
60 ! /* DON'T KNOW what the code below was doing
61 ! found in the deactivate clause, but the
62 ! clause writing TRUE into in_focus (BUG)
65 ! #if 0 /* Removed by Dany as per above June 2001 */
67 ! SetPreserveGlyph(a_bool);
68 ! SetOutlinePreferred(a_bool);
75 WindowPtr whichWindow;
77 whichWindow = (WindowPtr) event->message;
78 ! /* Dim scrollbars */
79 ! if (whichWindow == gui.VimWindow)
81 ! ControlRef rootControl;
82 ! GetRootControl(gui.VimWindow, &rootControl);
83 ! if ((event->modifiers) & activeFlag)
84 ! ActivateControl(rootControl);
86 ! DeactivateControl(rootControl);
90 + gui_focus_change((event->modifiers) & activeFlag);
98 /* Handle contextual menu right now (if needed) */
99 ! if (gui.MacOSHaveCntxMenu)
100 ! if (IsShowContextualMenuClick(event))
103 ! gui_mac_handle_contextual_menu(event);
105 ! gui_mac_doMouseDownEvent(event);
110 /* Handle normal event */
115 /* Handle contextual menu right now (if needed) */
116 ! if (IsShowContextualMenuClick(event))
119 ! gui_mac_handle_contextual_menu(event);
121 ! gui_mac_doMouseDownEvent(event);
126 /* Handle normal event */
130 (void) InstallAEHandlers();
133 - if (Gestalt(gestaltContextualMenuAttr, &gestalt_rc) == noErr)
134 - gui.MacOSHaveCntxMenu = BitTst(&gestalt_rc, 31-gestaltContextualMenuTrapAvailable);
136 - gui.MacOSHaveCntxMenu = false;
138 - if (gui.MacOSHaveCntxMenu)
139 - gui.MacOSHaveCntxMenu = (InitContextualMenus()==noErr);
141 pomme = NewMenu(256, "\p\024"); /* 0x14= = Apple Menu */
143 AppendMenu(pomme, "\pAbout VIM");
148 #ifdef USE_CARBONKEYHANDLER
149 EventHandlerRef keyEventHandlerRef;
151 + ControlRef rootControl;
153 if (Gestalt(gestaltSystemVersion, &gMacSystemVersion) != noErr)
154 gMacSystemVersion = 0x1000; /* TODO: Default to minimum sensible value */
157 (void) InstallAEHandlers();
161 - if (Gestalt(gestaltContextualMenuAttr, &gestalt_rc) == noErr)
162 - gui.MacOSHaveCntxMenu = BitTst(&gestalt_rc, 31-gestaltContextualMenuTrapAvailable);
164 - gui.MacOSHaveCntxMenu = false;
166 - if (gui.MacOSHaveCntxMenu)
167 - gui.MacOSHaveCntxMenu = (InitContextualMenus()==noErr);
169 pomme = NewMenu(256, "\p\024"); /* 0x14= = Apple Menu */
171 AppendMenu(pomme, "\pAbout VIM");
176 gui.VimWindow = NewCWindow(nil, &windRect, "\pgVim on Macintosh", true,
178 (WindowPtr)-1L, true, 0);
179 + CreateRootControl(gui.VimWindow, &rootControl);
180 InstallReceiveHandler((DragReceiveHandlerUPP)receiveHandler,
181 gui.VimWindow, NULL);
182 SetPortWindowPort(gui.VimWindow);
183 *** ../vim-7.1.006/src/gui.h Thu May 10 19:18:46 2007
184 --- src/gui.h Sat Jun 9 14:10:34 2007
188 MenuHandle MacOSHelpMenu; /* Help menu provided by the MacOS */
189 int MacOSHelpItems; /* Nr of help-items supplied by MacOS */
190 - int MacOSHaveCntxMenu; /* Contextual menu available */
191 WindowPtr wid; /* Window id of text area */
192 int visibility; /* Is window partially/fully obscured? */
195 *** ../vim-7.1.006/src/version.c Tue Jun 19 15:40:51 2007
196 --- src/version.c Tue Jun 19 15:44:15 2007
200 { /* Add new patch number below this line */
206 When danger reared its ugly head,
207 He bravely turned his tail and fled
208 Yes, Brave Sir Robin turned about
209 And gallantly he chickened out
210 Bravely taking to his feet
211 He beat a very brave retreat
212 Bravest of the brave Sir Robin
213 Petrified of being dead
214 Soiled his pants then brave Sir Robin
215 Turned away and fled.
216 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
218 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
219 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
220 \\\ download, build and distribute -- http://www.A-A-P.org ///
221 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///