Mercurial > emacs
comparison src/macterm.c @ 83164:e8df1878cfd1
Merged in changes from CVS trunk.
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-427
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-428
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-429
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-430
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-431
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-432
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-433
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-434
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-435
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-436
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-204
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Sat, 03 Jul 2004 17:01:39 +0000 |
parents | dbcd0af66869 3d525d0266de |
children | 09bbf2fc80da |
comparison
equal
deleted
inserted
replaced
83163:8e4ea1e2c254 | 83164:e8df1878cfd1 |
---|---|
7016 mac_get_emulated_btn ( UInt32 modifiers ) | 7016 mac_get_emulated_btn ( UInt32 modifiers ) |
7017 { | 7017 { |
7018 int result = 0; | 7018 int result = 0; |
7019 if (!NILP (Vmac_emulate_three_button_mouse)) { | 7019 if (!NILP (Vmac_emulate_three_button_mouse)) { |
7020 int cmdIs3 = !EQ (Vmac_emulate_three_button_mouse, Qreverse); | 7020 int cmdIs3 = !EQ (Vmac_emulate_three_button_mouse, Qreverse); |
7021 if (modifiers & controlKey) | 7021 if (modifiers & cmdKey) |
7022 result = cmdIs3 ? 2 : 1; | 7022 result = cmdIs3 ? 2 : 1; |
7023 else if (modifiers & optionKey) | 7023 else if (modifiers & optionKey) |
7024 result = cmdIs3 ? 1 : 2; | 7024 result = cmdIs3 ? 1 : 2; |
7025 } | 7025 } |
7026 return result; | 7026 return result; |
7036 GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL, | 7036 GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL, |
7037 sizeof (UInt32), NULL, &mods); | 7037 sizeof (UInt32), NULL, &mods); |
7038 if (!NILP (Vmac_emulate_three_button_mouse) && | 7038 if (!NILP (Vmac_emulate_three_button_mouse) && |
7039 GetEventClass(eventRef) == kEventClassMouse) | 7039 GetEventClass(eventRef) == kEventClassMouse) |
7040 { | 7040 { |
7041 mods &= ~(optionKey & cmdKey); | 7041 mods &= ~(optionKey | cmdKey); |
7042 } | 7042 } |
7043 return mac_to_emacs_modifiers (mods); | 7043 return mac_to_emacs_modifiers (mods); |
7044 } | 7044 } |
7045 | 7045 |
7046 /* Given an event ref, return the code to use for the mouse button | 7046 /* Given an event ref, return the code to use for the mouse button |
7232 if (FRAME_MAC_P (XFRAME (frame))) | 7232 if (FRAME_MAC_P (XFRAME (frame))) |
7233 if (FRAME_MAC_WINDOW (XFRAME (frame)) == win) | 7233 if (FRAME_MAC_WINDOW (XFRAME (frame)) == win) |
7234 return 1; | 7234 return 1; |
7235 | 7235 |
7236 return 0; | 7236 return 0; |
7237 } | |
7238 | |
7239 static void | |
7240 do_window_activate (WindowPtr win) | |
7241 { | |
7242 struct frame *f; | |
7243 | |
7244 if (is_emacs_window (win)) | |
7245 { | |
7246 f = mac_window_to_frame (win); | |
7247 | |
7248 if (f) | |
7249 { | |
7250 x_new_focus_frame (FRAME_MAC_DISPLAY_INFO (f), f); | |
7251 activate_scroll_bars (f); | |
7252 } | |
7253 } | |
7254 } | |
7255 | |
7256 static void | |
7257 do_window_deactivate (WindowPtr win) | |
7258 { | |
7259 struct frame *f; | |
7260 | |
7261 if (is_emacs_window (win)) | |
7262 { | |
7263 f = mac_window_to_frame (win); | |
7264 | |
7265 if (f == FRAME_MAC_DISPLAY_INFO (f)->x_focus_frame) | |
7266 { | |
7267 x_new_focus_frame (FRAME_MAC_DISPLAY_INFO (f), 0); | |
7268 deactivate_scroll_bars (f); | |
7269 } | |
7270 } | |
7271 } | 7237 } |
7272 | 7238 |
7273 static void | 7239 static void |
7274 do_app_resume () | 7240 do_app_resume () |
7275 { | 7241 { |
8082 #if USE_CARBON_EVENTS | 8048 #if USE_CARBON_EVENTS |
8083 /* Handle new events */ | 8049 /* Handle new events */ |
8084 if (!mac_convert_event_ref (eventRef, &er)) | 8050 if (!mac_convert_event_ref (eventRef, &er)) |
8085 switch (GetEventClass (eventRef)) | 8051 switch (GetEventClass (eventRef)) |
8086 { | 8052 { |
8053 case kEventClassWindow: | |
8054 if (GetEventKind (eventRef) == kEventWindowBoundsChanged) | |
8055 { | |
8056 WindowPtr window_ptr; | |
8057 GetEventParameter(eventRef, kEventParamDirectObject, | |
8058 typeWindowRef, NULL, sizeof(WindowPtr), | |
8059 NULL, &window_ptr); | |
8060 f = mac_window_to_frame (window_ptr); | |
8061 if (f && !f->async_iconified) | |
8062 { | |
8063 int x, y; | |
8064 | |
8065 x_real_positions (f, &x, &y); | |
8066 f->left_pos = x; | |
8067 f->top_pos = y; | |
8068 } | |
8069 SendEventToEventTarget (eventRef, toolbox_dispatcher); | |
8070 } | |
8071 break; | |
8087 case kEventClassMouse: | 8072 case kEventClassMouse: |
8088 if (GetEventKind (eventRef) == kEventMouseWheelMoved) | 8073 if (GetEventKind (eventRef) == kEventMouseWheelMoved) |
8089 { | 8074 { |
8090 SInt32 delta; | 8075 SInt32 delta; |
8091 Point point; | 8076 Point point; |
8133 { | 8118 { |
8134 WindowPtr window_ptr; | 8119 WindowPtr window_ptr; |
8135 SInt16 part_code; | 8120 SInt16 part_code; |
8136 int tool_bar_p = 0; | 8121 int tool_bar_p = 0; |
8137 | 8122 |
8123 #if USE_CARBON_EVENTS | |
8124 /* This is needed to send mouse events like aqua window | |
8125 buttons to the correct handler. */ | |
8126 if (SendEventToEventTarget (eventRef, toolbox_dispatcher) | |
8127 != eventNotHandledErr) | |
8128 break; | |
8129 #endif | |
8130 | |
8138 if (dpyinfo->grabbed && last_mouse_frame | 8131 if (dpyinfo->grabbed && last_mouse_frame |
8139 && FRAME_LIVE_P (last_mouse_frame)) | 8132 && FRAME_LIVE_P (last_mouse_frame)) |
8140 { | 8133 { |
8141 window_ptr = FRAME_MAC_WINDOW (last_mouse_frame); | 8134 window_ptr = FRAME_MAC_WINDOW (last_mouse_frame); |
8142 part_code = inContent; | 8135 part_code = inContent; |
8148 { | 8141 { |
8149 HideWindow (tip_window); | 8142 HideWindow (tip_window); |
8150 window_ptr = FrontWindow (); | 8143 window_ptr = FrontWindow (); |
8151 } | 8144 } |
8152 | 8145 |
8153 #if USE_CARBON_EVENTS | |
8154 /* This is needed to send mouse events like aqua | |
8155 window buttons to the correct handler. */ | |
8156 if (SendEventToEventTarget (eventRef, toolbox_dispatcher) | |
8157 != eventNotHandledErr) | |
8158 break; | |
8159 | |
8160 if (!is_emacs_window (window_ptr)) | 8146 if (!is_emacs_window (window_ptr)) |
8161 break; | 8147 break; |
8162 #endif | 8148 |
8163 part_code = FindWindow (er.where, &window_ptr); | 8149 part_code = FindWindow (er.where, &window_ptr); |
8164 } | 8150 } |
8165 | 8151 |
8166 switch (part_code) | 8152 switch (part_code) |
8167 { | 8153 { |
8304 DragWindow (window_ptr, er.where, &bm.bounds); | 8290 DragWindow (window_ptr, er.where, &bm.bounds); |
8305 } | 8291 } |
8306 #else /* not TARGET_API_MAC_CARBON */ | 8292 #else /* not TARGET_API_MAC_CARBON */ |
8307 DragWindow (window_ptr, er.where, &qd.screenBits.bounds); | 8293 DragWindow (window_ptr, er.where, &qd.screenBits.bounds); |
8308 #endif /* not TARGET_API_MAC_CARBON */ | 8294 #endif /* not TARGET_API_MAC_CARBON */ |
8295 /* Update the frame parameters. */ | |
8296 { | |
8297 struct frame *f = mac_window_to_frame (window_ptr); | |
8298 if (f && !f->async_iconified) | |
8299 { | |
8300 int x, y; | |
8301 | |
8302 x_real_positions (f, &x, &y); | |
8303 f->left_pos = x; | |
8304 f->top_pos = y; | |
8305 } | |
8306 } | |
8309 break; | 8307 break; |
8310 | 8308 |
8311 case inGoAway: | 8309 case inGoAway: |
8312 if (TrackGoAway (window_ptr, er.where)) | 8310 if (TrackGoAway (window_ptr, er.where)) |
8313 { | 8311 { |
8391 { | 8389 { |
8392 HideWindow (tip_window); | 8390 HideWindow (tip_window); |
8393 break; | 8391 break; |
8394 } | 8392 } |
8395 | 8393 |
8394 if (!is_emacs_window (window_ptr)) | |
8395 break; | |
8396 | |
8397 f = mac_window_to_frame (window_ptr); | |
8398 | |
8396 if ((er.modifiers & activeFlag) != 0) | 8399 if ((er.modifiers & activeFlag) != 0) |
8397 { | 8400 { |
8401 /* A window has been activated */ | |
8398 Point mouse_loc = er.where; | 8402 Point mouse_loc = er.where; |
8399 | 8403 |
8400 do_window_activate (window_ptr); | 8404 x_new_focus_frame (dpyinfo, f); |
8405 activate_scroll_bars (f); | |
8401 | 8406 |
8402 SetPortWindowPort (window_ptr); | 8407 SetPortWindowPort (window_ptr); |
8403 GlobalToLocal (&mouse_loc); | 8408 GlobalToLocal (&mouse_loc); |
8404 /* activateEvt counts as mouse movement, | 8409 /* Window-activated event counts as mouse movement, |
8405 so update things that depend on mouse position. */ | 8410 so update things that depend on mouse position. */ |
8406 note_mouse_movement (mac_window_to_frame (window_ptr), | 8411 note_mouse_movement (mac_window_to_frame (window_ptr), |
8407 &mouse_loc); | 8412 &mouse_loc); |
8408 } | 8413 } |
8409 else | 8414 else |
8410 { | 8415 { |
8411 do_window_deactivate (window_ptr); | 8416 /* A window has been deactivated */ |
8412 | 8417 dpyinfo->grabbed = 0; |
8413 f = mac_window_to_frame (window_ptr); | 8418 |
8419 if (f == dpyinfo->x_focus_frame) | |
8420 { | |
8421 x_new_focus_frame (dpyinfo, 0); | |
8422 deactivate_scroll_bars (f); | |
8423 } | |
8424 | |
8425 | |
8414 if (f == dpyinfo->mouse_face_mouse_frame) | 8426 if (f == dpyinfo->mouse_face_mouse_frame) |
8415 { | 8427 { |
8416 /* If we move outside the frame, then we're | 8428 /* If we move outside the frame, then we're |
8417 certainly no longer on any text in the | 8429 certainly no longer on any text in the |
8418 frame. */ | 8430 frame. */ |