Mercurial > emacs
comparison src/macterm.c @ 56278:3d525d0266de
macterm.c (do_window_activate, do_window_deactivate): Remove.
(XTread_socket): Fix activation/focus problems by only handling
emacs windows and passing mouse events to the event chain regardless.
author | Steven Tamm <steventamm@mac.com> |
---|---|
date | Tue, 29 Jun 2004 06:39:03 +0000 |
parents | fd126130c3cd |
children | 550df8e67006 e8df1878cfd1 59dcbfe97385 |
comparison
equal
deleted
inserted
replaced
56277:fd126130c3cd | 56278:3d525d0266de |
---|---|
7235 | 7235 |
7236 return 0; | 7236 return 0; |
7237 } | 7237 } |
7238 | 7238 |
7239 static void | 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 } | |
7272 | |
7273 static void | |
7274 do_app_resume () | 7240 do_app_resume () |
7275 { | 7241 { |
7276 WindowPtr wp; | 7242 WindowPtr wp; |
7277 struct frame *f; | 7243 struct frame *f; |
7278 | 7244 |
8152 { | 8118 { |
8153 WindowPtr window_ptr; | 8119 WindowPtr window_ptr; |
8154 SInt16 part_code; | 8120 SInt16 part_code; |
8155 int tool_bar_p = 0; | 8121 int tool_bar_p = 0; |
8156 | 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 | |
8157 if (dpyinfo->grabbed && last_mouse_frame | 8131 if (dpyinfo->grabbed && last_mouse_frame |
8158 && FRAME_LIVE_P (last_mouse_frame)) | 8132 && FRAME_LIVE_P (last_mouse_frame)) |
8159 { | 8133 { |
8160 window_ptr = FRAME_MAC_WINDOW (last_mouse_frame); | 8134 window_ptr = FRAME_MAC_WINDOW (last_mouse_frame); |
8161 part_code = inContent; | 8135 part_code = inContent; |
8167 { | 8141 { |
8168 HideWindow (tip_window); | 8142 HideWindow (tip_window); |
8169 window_ptr = FrontWindow (); | 8143 window_ptr = FrontWindow (); |
8170 } | 8144 } |
8171 | 8145 |
8172 #if USE_CARBON_EVENTS | |
8173 /* This is needed to send mouse events like aqua | |
8174 window buttons to the correct handler. */ | |
8175 if (SendEventToEventTarget (eventRef, toolbox_dispatcher) | |
8176 != eventNotHandledErr) | |
8177 break; | |
8178 | |
8179 if (!is_emacs_window (window_ptr)) | 8146 if (!is_emacs_window (window_ptr)) |
8180 break; | 8147 break; |
8181 #endif | 8148 |
8182 part_code = FindWindow (er.where, &window_ptr); | 8149 part_code = FindWindow (er.where, &window_ptr); |
8183 } | 8150 } |
8184 | 8151 |
8185 switch (part_code) | 8152 switch (part_code) |
8186 { | 8153 { |
8422 { | 8389 { |
8423 HideWindow (tip_window); | 8390 HideWindow (tip_window); |
8424 break; | 8391 break; |
8425 } | 8392 } |
8426 | 8393 |
8394 if (!is_emacs_window (window_ptr)) | |
8395 break; | |
8396 | |
8397 f = mac_window_to_frame (window_ptr); | |
8398 | |
8427 if ((er.modifiers & activeFlag) != 0) | 8399 if ((er.modifiers & activeFlag) != 0) |
8428 { | 8400 { |
8401 /* A window has been activated */ | |
8429 Point mouse_loc = er.where; | 8402 Point mouse_loc = er.where; |
8430 | 8403 |
8431 do_window_activate (window_ptr); | 8404 x_new_focus_frame (dpyinfo, f); |
8405 activate_scroll_bars (f); | |
8432 | 8406 |
8433 SetPortWindowPort (window_ptr); | 8407 SetPortWindowPort (window_ptr); |
8434 GlobalToLocal (&mouse_loc); | 8408 GlobalToLocal (&mouse_loc); |
8435 /* activateEvt counts as mouse movement, | 8409 /* Window-activated event counts as mouse movement, |
8436 so update things that depend on mouse position. */ | 8410 so update things that depend on mouse position. */ |
8437 note_mouse_movement (mac_window_to_frame (window_ptr), | 8411 note_mouse_movement (mac_window_to_frame (window_ptr), |
8438 &mouse_loc); | 8412 &mouse_loc); |
8439 } | 8413 } |
8440 else | 8414 else |
8441 { | 8415 { |
8442 do_window_deactivate (window_ptr); | 8416 /* A window has been deactivated */ |
8443 | 8417 dpyinfo->grabbed = 0; |
8444 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 | |
8445 if (f == dpyinfo->mouse_face_mouse_frame) | 8426 if (f == dpyinfo->mouse_face_mouse_frame) |
8446 { | 8427 { |
8447 /* If we move outside the frame, then we're | 8428 /* If we move outside the frame, then we're |
8448 certainly no longer on any text in the | 8429 certainly no longer on any text in the |
8449 frame. */ | 8430 frame. */ |