aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2017-04-23 10:52:56 +0200
committerMartin Rudalics2017-04-23 10:52:56 +0200
commita02885a37031ec0e199dcb38ff9cb93e65e7b7cb (patch)
tree2f16e167e3244deeddbf4ee407906fd4a2242e5e
parentb20d05c6d76ddaf7e70da1430c9aac56ef1d6b31 (diff)
downloademacs-a02885a37031ec0e199dcb38ff9cb93e65e7b7cb.tar.gz
emacs-a02885a37031ec0e199dcb38ff9cb93e65e7b7cb.zip
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,
3427 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, 3427 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
3428 Time *time) 3428 Time *time)
3429{ 3429{
3430 struct frame *f1;
3431 struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (*fp); 3430 struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (*fp);
3432 3431
3433 block_input (); 3432 block_input ();
@@ -3444,8 +3443,8 @@ w32_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
3444 else 3443 else
3445 { 3444 {
3446 POINT pt; 3445 POINT pt;
3447
3448 Lisp_Object frame, tail; 3446 Lisp_Object frame, tail;
3447 struct frame *f1 = NULL;
3449 3448
3450 /* Clear the mouse-moved flag for every frame on this display. */ 3449 /* Clear the mouse-moved flag for every frame on this display. */
3451 FOR_EACH_FRAME (tail, frame) 3450 FOR_EACH_FRAME (tail, frame)
@@ -3465,17 +3464,26 @@ w32_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
3465 f1 = dpyinfo->last_mouse_frame; 3464 f1 = dpyinfo->last_mouse_frame;
3466 else 3465 else
3467 { 3466 {
3468 HWND wfp = WindowFromPoint (pt); 3467 /* Try to check for a child window first. */
3468 HWND wfp = ChildWindowFromPoint (wfp, pt);
3469 3469
3470 if (wfp && (f1 = x_any_window_to_frame (dpyinfo, wfp))) 3470 if (wfp)
3471 { 3471 {
3472 HWND cwfp = ChildWindowFromPoint (wfp, pt); 3472 struct frame *f2 = x_any_window_to_frame (dpyinfo, wfp);
3473 struct frame *f2;
3474 3473
3475 /* If cwfp exists it should be one of our windows ... */ 3474 /* If f2 is one of our frames, make sure it's a child
3476 if (cwfp && (f2 = x_any_window_to_frame (dpyinfo, cwfp))) 3475 frame (Bug#26615, maybe). */
3476 if (f2 && FRAME_PARENT_FRAME (f2))
3477 f1 = f2; 3477 f1 = f2;
3478 } 3478 }
3479
3480 if (!f1)
3481 {
3482 /* Check for a top-level window second. */
3483 wfp = WindowFromPoint (pt);
3484 if (wfp)
3485 f1 = x_any_window_to_frame (dpyinfo, wfp);
3486 }
3479 } 3487 }
3480 3488
3481 /* If not, is it one of our scroll bars? */ 3489 /* If not, is it one of our scroll bars? */