void combine_updates_for_frame (struct frame *f, bool inhibit_id_p);
void tty_raise_lower_frame (struct frame *f, bool raise);
int max_child_z_order (struct frame *parent);
+void frame_pos_abs (struct frame *f, int *x, int *y);
+bool is_frame_ancestor (struct frame *f1, struct frame *f2);
INLINE_HEADER_END
/* Return the absolute position of frame F in *X and *Y. */
-static void
+void
frame_pos_abs (struct frame *f, int *x, int *y)
{
*x = *y = 0;
/* Return true if F1 is an ancestor of F2. */
-static bool
+bool
is_frame_ancestor (struct frame *f1, struct frame *f2)
{
for (struct frame *f = FRAME_PARENT_FRAME (f2); f; f = FRAME_PARENT_FRAME (f))
static void
mouse_get_xy (int *x, int *y)
{
- Lisp_Object lmx = Qnil, lmy = Qnil;
Lisp_Object mouse = mouse_position (tty_menu_calls_mouse_position_function);
- if (EQ (selected_frame, XCAR (mouse)))
- {
- lmx = XCAR (XCDR (mouse));
- lmy = XCDR (XCDR (mouse));
- }
-
- if (!NILP (lmx))
+ struct frame *f = XFRAME (XCAR (mouse));
+ struct frame *sf = SELECTED_FRAME ();
+ if (f == sf || is_frame_ancestor (sf, f))
{
- *x = XFIXNUM (lmx);
- *y = XFIXNUM (lmy);
+ int fx, fy;
+ frame_pos_abs (f, &fx, &fy);
+ *x = fx + XFIXNUM (XCAR (XCDR (mouse)));
+ *y = fy + XFIXNUM (XCDR (XCDR (mouse)));
}
}