wxFindWindowAtPoint with specified window exclusion (PR #26268)

33 views
Skip to first unread message

sulakm

unread,
Mar 6, 2026, 12:16:46 AM (12 days ago) Mar 6
to wx-...@googlegroups.com, Subscribed

Hi,

I added overloaded wxFindWindowAtPoint with extra parameter for dragged wxWindow to be excluded from the search.
On MSW it uses httransparent in nchittest temporarily during search. On other platforms it simply continue iterating windows.

regards, Martin


You can view, comment on, or merge this pull request online at:

  https://github.com/wxWidgets/wxWidgets/pull/26268

Commit Summary

  • b851d80 wxFindWindowAtPoint with specified window exclusion

File Changes

(8 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26268@github.com>

sulakm

unread,
Mar 6, 2026, 1:10:12 AM (12 days ago) Mar 6
to wx-...@googlegroups.com, Push

@sulakm pushed 1 commit.

  • 60ce1c5 wxFindWindowAtPoint fixes


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26268/before/b851d80459bf4b6bcdfe56a3908974efcf2021b3/after/60ce1c50851c3cb3ac9e46c27429c6a40e225133@github.com>

sulakm

unread,
Mar 6, 2026, 1:51:55 AM (12 days ago) Mar 6
to wx-...@googlegroups.com, Subscribed
sulakm left a comment (wxWidgets/wxWidgets#26268)

That Unix build does not show particular error in code. It looks like APT related problem. Error: retrieving gpg key timed out.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26268/c4009945267@github.com>

VZ

unread,
Mar 6, 2026, 8:48:19 AM (12 days ago) Mar 6
to wx-...@googlegroups.com, Subscribed

@vadz commented on this pull request.

Thanks for your contribution, but it's not clear why exactly is this needed/useful, could you please explain it? It would also need to be explained in the documentation (to be added to interface/wx/utils.h).


In include/wx/msw/window.h:

> @@ -744,6 +744,9 @@ class WXDLLIMPEXP_CORE wxWindowMSW : public wxWindowBase
     }
 
 private:
+    friend WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPoint(const wxPoint& pt, wxWindow* skip);
+    bool m_hideFromFind;

I don't like the idea of adding a new bool to all window objects just to support one particular function which may not even be called at all.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26268/review/3903806911@github.com>

sulakm

unread,
Mar 6, 2026, 9:42:09 AM (12 days ago) Mar 6
to wx-...@googlegroups.com, Subscribed

@sulakm commented on this pull request.


In include/wx/msw/window.h:

> @@ -744,6 +744,9 @@ class WXDLLIMPEXP_CORE wxWindowMSW : public wxWindowBase
     }
 
 private:
+    friend WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPoint(const wxPoint& pt, wxWindow* skip);
+    bool m_hideFromFind;

The use-case is drag&drop of a toplevel window. wxFindWindowAtPoint is not useful for finding drop destination because it return the dragged window. Similar problem was discussed on stackoverflow: https://stackoverflow.com/questions/37446702/find-all-windows-beneath-a-point.

Initially I planned to rewrite wxAuiNotebook for undocking pages like in popular web browser. It is not however to redock undocked window by interception onMoving, especially on older versions of MacOS. This feature is ready half way through and not commited on github. Now I aiming at dragging just a hint transparent rectangle in a temporary window. For this I still need wxFindWindowAtPoint with option to skip a dragged window.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26268/review/3904111551@github.com>

VZ

unread,
Mar 6, 2026, 10:15:43 AM (12 days ago) Mar 6
to wx-...@googlegroups.com, Subscribed

@vadz commented on this pull request.


In include/wx/msw/window.h:

> @@ -744,6 +744,9 @@ class WXDLLIMPEXP_CORE wxWindowMSW : public wxWindowBase
     }
 
 private:
+    friend WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPoint(const wxPoint& pt, wxWindow* skip);
+    bool m_hideFromFind;

This is another thing which is going to be unimplementable with Wayland... Not sure if we want to encourage doing it. It definitely would be better to have a high level window dragging API instead, as discussed elsewhere.

Thread-safety is not a concern because GUI functions can only be called from a GUI thread. But FWIW I think looking at the next window in Z-order after the window being dragged could be even simpler and not require any hacks at all.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26268/review/3904317781@github.com>

sulakm

unread,
Mar 6, 2026, 11:08:50 AM (12 days ago) Mar 6
to wx-...@googlegroups.com, Subscribed

@sulakm commented on this pull request.


In include/wx/msw/window.h:

> @@ -744,6 +744,9 @@ class WXDLLIMPEXP_CORE wxWindowMSW : public wxWindowBase
     }
 
 private:
+    friend WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPoint(const wxPoint& pt, wxWindow* skip);
+    bool m_hideFromFind;

Does not Wayland port use wxGenericFindWindowAtPoint ?

BTW why only MSW has native version ? Does generic function have wrong Z-order ?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26268/review/3904622562@github.com>

VZ

unread,
Mar 6, 2026, 11:15:46 AM (12 days ago) Mar 6
to wx-...@googlegroups.com, Subscribed

@vadz commented on this pull request.


In include/wx/msw/window.h:

> @@ -744,6 +744,9 @@ class WXDLLIMPEXP_CORE wxWindowMSW : public wxWindowBase
     }
 
 private:
+    friend WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPoint(const wxPoint& pt, wxWindow* skip);
+    bool m_hideFromFind;

Under Wayland you can't find the window under mouse when it's outside of your own window, so it doesn't matter what it uses, it's not going to work anyhow. The only way to make dragging windows work there is via the drag and drop protocol and this is what we need to wrap, in a higher level API.

I don't know/remember why MSW has a native version, but as long as it works I wouldn't change it as I'm not sure if ::WindowFromPoint() is exactly the same as that of our function.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26268/review/3904656553@github.com>

sulakm

unread,
Mar 6, 2026, 11:20:00 AM (12 days ago) Mar 6
to wx-...@googlegroups.com, Subscribed

@sulakm commented on this pull request.


In include/wx/msw/window.h:

> @@ -744,6 +744,9 @@ class WXDLLIMPEXP_CORE wxWindowMSW : public wxWindowBase
     }
 
 private:
+    friend WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPoint(const wxPoint& pt, wxWindow* skip);
+    bool m_hideFromFind;

wxGenericWindowFromPoint doesn't work on Wayland ? This function doesn't use any system API. It simply iterates all in-process top level windows created by wxWidgets. Am I wrong ?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26268/review/3904677601@github.com>

VZ

unread,
Mar 6, 2026, 11:26:10 AM (12 days ago) Mar 6
to wx-...@googlegroups.com, Subscribed

@vadz commented on this pull request.


In include/wx/msw/window.h:

> @@ -744,6 +744,9 @@ class WXDLLIMPEXP_CORE wxWindowMSW : public wxWindowBase
     }
 
 private:
+    friend WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPoint(const wxPoint& pt, wxWindow* skip);
+    bool m_hideFromFind;

I think it's broken because it doesn't take Z-order into account. And AFAIK there is no way to get it, even for your own windows.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26268/review/3904706670@github.com>

sulakm

unread,
Mar 6, 2026, 11:46:58 AM (12 days ago) Mar 6
to wx-...@googlegroups.com, Subscribed

@sulakm commented on this pull request.


In include/wx/msw/window.h:

> @@ -744,6 +744,9 @@ class WXDLLIMPEXP_CORE wxWindowMSW : public wxWindowBase
     }
 
 private:
+    friend WXDLLIMPEXP_CORE wxWindow* wxFindWindowAtPoint(const wxPoint& pt, wxWindow* skip);
+    bool m_hideFromFind;

You mean generic version is broken ? So wxFindWindowAtPoint only works on MSW ?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26268/review/3904834014@github.com>

VZ

unread,
Mar 16, 2026, 8:24:19 PM (2 days ago) Mar 16
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26268)

Returning to this, I'm tempted to reject this PR because of the considerations above. Does anyone else think that we should apply it instead?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26268/c4071494970@github.com>

Reply all
Reply to author
Forward
0 new messages