comparison src/macterm.c @ 55583:21f88361795c

Various fixes to support USE_LSB_TAG with carbon emacs. Mostly fixing prototypes and confusions between pointers and lisp objects
author Steven Tamm <steventamm@mac.com>
date Fri, 14 May 2004 03:07:12 +0000
parents db942c4b4345
children f1d6a507dcfd ad01ab3c6f4d
comparison
equal deleted inserted replaced
55582:289388d8464e 55583:21f88361795c
7031 7031
7032 static int 7032 static int
7033 mac_get_emulated_btn ( UInt32 modifiers ) 7033 mac_get_emulated_btn ( UInt32 modifiers )
7034 { 7034 {
7035 int result = 0; 7035 int result = 0;
7036 if (Vmac_emulate_three_button_mouse != Qnil) { 7036 if (!NILP (Vmac_emulate_three_button_mouse)) {
7037 int cmdIs3 = (Vmac_emulate_three_button_mouse != Qreverse); 7037 int cmdIs3 = !EQ (Vmac_emulate_three_button_mouse, Qreverse);
7038 if (modifiers & controlKey) 7038 if (modifiers & controlKey)
7039 result = cmdIs3 ? 2 : 1; 7039 result = cmdIs3 ? 2 : 1;
7040 else if (modifiers & optionKey) 7040 else if (modifiers & optionKey)
7041 result = cmdIs3 ? 1 : 2; 7041 result = cmdIs3 ? 1 : 2;
7042 } 7042 }
7050 mac_event_to_emacs_modifiers (EventRef eventRef) 7050 mac_event_to_emacs_modifiers (EventRef eventRef)
7051 { 7051 {
7052 UInt32 mods = 0; 7052 UInt32 mods = 0;
7053 GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL, 7053 GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL,
7054 sizeof (UInt32), NULL, &mods); 7054 sizeof (UInt32), NULL, &mods);
7055 if (Vmac_emulate_three_button_mouse != Qnil && 7055 if (!NILP (Vmac_emulate_three_button_mouse) &&
7056 GetEventClass(eventRef) == kEventClassMouse) 7056 GetEventClass(eventRef) == kEventClassMouse)
7057 { 7057 {
7058 mods &= ~(optionKey & cmdKey); 7058 mods &= ~(optionKey & cmdKey);
7059 } 7059 }
7060 return mac_to_emacs_modifiers (mods); 7060 return mac_to_emacs_modifiers (mods);
7069 GetEventParameter (ref, kEventParamMouseButton, typeMouseButton, NULL, 7069 GetEventParameter (ref, kEventParamMouseButton, typeMouseButton, NULL,
7070 sizeof (EventMouseButton), NULL, &result); 7070 sizeof (EventMouseButton), NULL, &result);
7071 switch (result) 7071 switch (result)
7072 { 7072 {
7073 case kEventMouseButtonPrimary: 7073 case kEventMouseButtonPrimary:
7074 if (Vmac_emulate_three_button_mouse == Qnil) 7074 if (NILP (Vmac_emulate_three_button_mouse))
7075 return 0; 7075 return 0;
7076 else { 7076 else {
7077 UInt32 mods = 0; 7077 UInt32 mods = 0;
7078 GetEventParameter (ref, kEventParamKeyModifiers, typeUInt32, NULL, 7078 GetEventParameter (ref, kEventParamKeyModifiers, typeUInt32, NULL,
7079 sizeof (UInt32), NULL, &mods); 7079 sizeof (UInt32), NULL, &mods);
8225 #endif 8225 #endif
8226 inev.modifiers |= up_modifier; 8226 inev.modifiers |= up_modifier;
8227 inev.timestamp = er.when * (1000 / 60); 8227 inev.timestamp = er.when * (1000 / 60);
8228 /* ticks to milliseconds */ 8228 /* ticks to milliseconds */
8229 8229
8230 XSETINT (inev.x, tracked_scroll_bar->left + 2); 8230 XSETINT (inev.x, XFASTINT (tracked_scroll_bar->left) + 2);
8231 XSETINT (inev.y, mouse_loc.v - 24); 8231 XSETINT (inev.y, mouse_loc.v - 24);
8232 tracked_scroll_bar->dragging = Qnil; 8232 tracked_scroll_bar->dragging = Qnil;
8233 mouse_tracking_in_progress = mouse_tracking_none; 8233 mouse_tracking_in_progress = mouse_tracking_none;
8234 tracked_scroll_bar = NULL; 8234 tracked_scroll_bar = NULL;
8235 break; 8235 break;
8310 } 8310 }
8311 } 8311 }
8312 else 8312 else
8313 { 8313 {
8314 Lisp_Object window; 8314 Lisp_Object window;
8315 int x = mouse_loc.h;
8316 int y = mouse_loc.v;
8315 8317
8316 XSETFRAME (inev.frame_or_window, mwp->mFP); 8318 XSETFRAME (inev.frame_or_window, mwp->mFP);
8317 if (er.what == mouseDown) 8319 if (er.what == mouseDown)
8318 mouse_tracking_in_progress 8320 mouse_tracking_in_progress
8319 = mouse_tracking_mouse_movement; 8321 = mouse_tracking_mouse_movement;
8320 else 8322 else
8321 mouse_tracking_in_progress = mouse_tracking_none; 8323 mouse_tracking_in_progress = mouse_tracking_none;
8322 window = window_from_coordinates (mwp->mFP, inev.x, inev.y, 0, 0, 0, 1); 8324 window = window_from_coordinates (mwp->mFP, x, y, 0, 0, 0, 1);
8323 8325
8324 if (EQ (window, mwp->mFP->tool_bar_window)) 8326 if (EQ (window, mwp->mFP->tool_bar_window))
8325 { 8327 {
8326 if (er.what == mouseDown) 8328 if (er.what == mouseDown)
8327 handle_tool_bar_click (mwp->mFP, inev.x, inev.y, 1, 0); 8329 handle_tool_bar_click (mwp->mFP, x, y, 1, 0);
8328 else 8330 else
8329 handle_tool_bar_click (mwp->mFP, inev.x, inev.y, 0, 8331 handle_tool_bar_click (mwp->mFP, x, y, 0,
8330 #if USE_CARBON_EVENTS 8332 #if USE_CARBON_EVENTS
8331 mac_event_to_emacs_modifiers (eventRef) 8333 mac_event_to_emacs_modifiers (eventRef)
8332 #else 8334 #else
8333 er.modifiers 8335 er.modifiers
8334 #endif 8336 #endif
9022 (mac_output *) GetWRefCon (FrontNonFloatingWindow ()); 9024 (mac_output *) GetWRefCon (FrontNonFloatingWindow ());
9023 /* Use an input_event to emulate what the interrupt handler does. */ 9025 /* Use an input_event to emulate what the interrupt handler does. */
9024 EVENT_INIT (e); 9026 EVENT_INIT (e);
9025 e.kind = ASCII_KEYSTROKE_EVENT; 9027 e.kind = ASCII_KEYSTROKE_EVENT;
9026 e.code = quit_char; 9028 e.code = quit_char;
9027 e.arg = NULL; 9029 e.arg = Qnil;
9028 e.modifiers = NULL; 9030 e.modifiers = NULL;
9029 e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60); 9031 e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60);
9030 XSETFRAME (e.frame_or_window, mwp->mFP); 9032 XSETFRAME (e.frame_or_window, mwp->mFP);
9031 /* Remove event from queue to prevent looping. */ 9033 /* Remove event from queue to prevent looping. */
9032 RemoveEventFromQueue (GetMainEventQueue (), event); 9034 RemoveEventFromQueue (GetMainEventQueue (), event);