- {
- struct scroll_bar *bar = (struct scroll_bar *)
- GetControlReference (ch);
- x_scroll_bar_handle_click (bar, control_part_code, &er,
- &inev);
- if (er.what == mouseDown
- && control_part_code == kControlIndicatorPart)
- {
- mouse_tracking_in_progress
- = mouse_tracking_scroll_bar;
- tracked_scroll_bar = bar;
- }
- else
- {
- mouse_tracking_in_progress = mouse_tracking_none;
- tracked_scroll_bar = NULL;
- }
- }
- else
- {
- Lisp_Object window;
-
- XSETFRAME (inev.frame_or_window, mwp->mFP);
- if (er.what == mouseDown)
- mouse_tracking_in_progress
- = mouse_tracking_mouse_movement;
- else
- mouse_tracking_in_progress = mouse_tracking_none;
- window = window_from_coordinates (mwp->mFP, inev.x, inev.y, 0, 0, 0, 1);
-
- if (EQ (window, mwp->mFP->tool_bar_window))
- {
- if (er.what == mouseDown)
- handle_tool_bar_click (mwp->mFP, inev.x, inev.y, 1, 0);
- else
- handle_tool_bar_click (mwp->mFP, inev.x, inev.y, 0,
+ )
+ {
+ struct scroll_bar *bar;
+
+ if (dpyinfo->grabbed && tracked_scroll_bar)
+ {
+ bar = tracked_scroll_bar;
+ control_part_code = kControlIndicatorPart;
+ }
+ else
+ bar = (struct scroll_bar *) GetControlReference (ch);
+ x_scroll_bar_handle_click (bar, control_part_code,
+ &er, &inev);
+ if (er.what == mouseDown
+ && control_part_code == kControlIndicatorPart)
+ tracked_scroll_bar = bar;
+ else
+ tracked_scroll_bar = NULL;
+ }
+ else
+ {
+ Lisp_Object window;
+ int x = mouse_loc.h;
+ int y = mouse_loc.v;
+
+ window = window_from_coordinates (f, x, y, 0, 0, 0, 1);
+ if (EQ (window, f->tool_bar_window))
+ {
+ if (er.what == mouseDown)
+ handle_tool_bar_click (f, x, y, 1, 0);
+ else
+ handle_tool_bar_click (f, x, y, 0,
+ inev.modifiers);
+ tool_bar_p = 1;
+ }
+ else
+ {
+ XSETFRAME (inev.frame_or_window, f);
+ inev.kind = MOUSE_CLICK_EVENT;
+ }
+ }
+
+ if (er.what == mouseDown)
+ {
+ dpyinfo->grabbed |= (1 << inev.code);
+ last_mouse_frame = f;
+ /* Ignore any mouse motion that happened
+ before this event; any subsequent
+ mouse-movement Emacs events should reflect
+ only motion after the ButtonPress. */
+ if (f != 0)
+ f->mouse_moved = 0;
+
+ if (!tool_bar_p)
+ last_tool_bar_item = -1;
+ }
+ else
+ {
+ if ((dpyinfo->grabbed & (1 << inev.code)) == 0)
+ /* If a button is released though it was not
+ previously pressed, that would be because
+ of multi-button emulation. */
+ dpyinfo->grabbed = 0;
+ else
+ dpyinfo->grabbed &= ~(1 << inev.code);
+ }
+
+ switch (er.what)
+ {
+ case mouseDown:
+ inev.modifiers |= down_modifier;
+ break;
+ case mouseUp:
+ inev.modifiers |= up_modifier;
+ break;
+ }
+ }
+ break;
+
+ case inDrag:
+#if TARGET_API_MAC_CARBON
+ DragWindow (window_ptr, er.where, NULL);
+#else /* not TARGET_API_MAC_CARBON */
+ DragWindow (window_ptr, er.where, &qd.screenBits.bounds);
+#endif /* not TARGET_API_MAC_CARBON */
+ /* Update the frame parameters. */
+ {
+ struct frame *f = mac_window_to_frame (window_ptr);
+
+ if (f && !f->async_iconified)
+ x_real_positions (f, &f->left_pos, &f->top_pos);
+ }
+ break;
+
+ case inGoAway:
+ if (TrackGoAway (window_ptr, er.where))
+ {
+ inev.kind = DELETE_WINDOW_EVENT;
+ XSETFRAME (inev.frame_or_window,
+ mac_window_to_frame (window_ptr));
+ }
+ break;
+
+ /* window resize handling added --ben */
+ case inGrow:
+ do_grow_window (window_ptr, &er);
+ break;
+
+ /* window zoom handling added --ben */
+ case inZoomIn:
+ case inZoomOut:
+ if (TrackBox (window_ptr, er.where, part_code))
+ do_zoom_window (window_ptr, part_code);
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
+
+ case updateEvt: