summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2017-04-23 10:52:56 +0200
committerMartin Rudalics <rudalics@gmx.at>2017-04-23 10:52:56 +0200
commita02885a37031ec0e199dcb38ff9cb93e65e7b7cb (patch)
tree2f16e167e3244deeddbf4ee407906fd4a2242e5e
parentb20d05c6d76ddaf7e70da1430c9aac56ef1d6b31 (diff)
downloademacs-a02885a37031ec0e199dcb38ff9cb93e65e7b7cb.tar.gz
Let w32_mouse_position pick a child window only if it has a child frame
* src/w32term.c (w32_mouse_position): When using a frame found by ChildWindowFromPoint make sure it's a child frame (Bug#26615, maybe).
-rw-r--r--src/w32term.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/w32term.c b/src/w32term.c
index 36dc6364ae3..f02201c9d76 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -3427,7 +3427,6 @@ w32_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
Time *time)
{
- struct frame *f1;
struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (*fp);
block_input ();
@@ -3444,8 +3443,8 @@ w32_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
else
{
POINT pt;
-
Lisp_Object frame, tail;
+ struct frame *f1 = NULL;
/* Clear the mouse-moved flag for every frame on this display. */
FOR_EACH_FRAME (tail, frame)
@@ -3465,17 +3464,26 @@ w32_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
f1 = dpyinfo->last_mouse_frame;
else
{
- HWND wfp = WindowFromPoint (pt);
+ /* Try to check for a child window first. */
+ HWND wfp = ChildWindowFromPoint (wfp, pt);
- if (wfp && (f1 = x_any_window_to_frame (dpyinfo, wfp)))
+ if (wfp)
{
- HWND cwfp = ChildWindowFromPoint (wfp, pt);
- struct frame *f2;
+ struct frame *f2 = x_any_window_to_frame (dpyinfo, wfp);
- /* If cwfp exists it should be one of our windows ... */
- if (cwfp && (f2 = x_any_window_to_frame (dpyinfo, cwfp)))
+ /* If f2 is one of our frames, make sure it's a child
+ frame (Bug#26615, maybe). */
+ if (f2 && FRAME_PARENT_FRAME (f2))
f1 = f2;
}
+
+ if (!f1)
+ {
+ /* Check for a top-level window second. */
+ wfp = WindowFromPoint (pt);
+ if (wfp)
+ f1 = x_any_window_to_frame (dpyinfo, wfp);
+ }
}
/* If not, is it one of our scroll bars? */