How to create a topmost overlay which ignores mouse clicks, etc - cocoa

I'd like to know how to setup a transparent overlay windown in Cocoa which can ignore mouse clicks (so that they pass through to whatever window is below). The user should not be able to interact with the window with their mouse.

Tell it to ignore mouse events.

Related

Intercepting the mouse coordinates and modifying it

I would like to create an app that intercepts the mouse coordinates and modify them.
I want to build an app that runs in the background and intercepts the mouse movement, filtering it, for all apps running on macOS.
Suppose the mouse is scrolling freely but if the user presses a global shortcut, like CMD ALT X, the vertical scrolling is filtered and just the horizontal scrolling passes to macOS.
First question: what should I use to do that? Just point me in the right direction if the topic is too extensive.
Second question: is that possible to do for a sandbox app?

Create a window that never catches focus but stays on top of zorder

I am trying to come up with my own on screen keyboard.
I know how to keep a window on top of the zorder, but for a keyboard, I want to keep the focus on the other apps.
Is there any way to prevent a window to catch focus? I tried to use SetWindowPos() but it flickers.

How to implement this ejecting and withdrawing portion of a window like a drawer?

How to implement following effect with Cocoa:
<->
User can eject and withdraw right portion of window with a button.
Update: How to draw the vertical line in the tool bar?
This is actually part of the window. When you click the button, the window and view just resize into their appropriate positions.
Check out NSViewAnimation.

combobox dropdown window can show beyond the combobox window,how?

in windows, how can make a 'child' window beyond the parent window, and the parent window always in active status (GetActiveWindow() return parent), just like the combobox dropdown window.
I think these are the main points when trying to do this:
The pop-up is a top-level window which has the same parent as the control. (i.e. The pop-up is not a child of the control. It's not a child-window at all; it's a top-level window, but one without a thick window border etc. so it doesn't look like a normal top-level window.) That's why it can extend outside of the control's boundaries.
When the pop-up is created it is shown using ShowWindow(hWndPopup, SW_SHOWNA) so that it does not take the input focus. This prevents the parent window from going inactive.
When the pop-up is created you capture the mouse using SetCapture. You then track where the mouse is and highlight items within the pop-up when the mouse overlaps them. When the mouse button is clicked you act on whatever is under the mouse (or cancel the pop-up if the mouse isn't over it at all). Remember to respond to WM_CAPTURECHANGED, in case something else captures the mouse. And remember to ReleaseCapture when you are done.
The popup should handle WM_MOUSEACTIVATE by returning MA_NOACTIVATEANDEAT.

How to tell if a a mouse button has been released outside the window?

Usually, when a user holds the mouse pressed over a button, moves the mouse away from the window, and then releases it, the button can tell that the mouse has been released even though the release has actually occured outside the window.
When I inspect mouse clicks in my window, how can I imitate the same behavior?
When a mouse button being pushed down over the window I get the WM_XBUTTONDOWN message, but Windows don't treat it as if anything is logically being "clicked", so after the mouse leaves the window, no further messages will arrive at the window, which results in a "lost" WM_XBUTTONUP message.
When you receive the button down, you capture the mouse. That means that all the mouse events until releasing the capture will be reported to the window that captured the mouse.
See the documentation here. You also have a link to an example from that page.
Use the DragDetect() function.
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-dragdetect?redirectedfrom=MSDN

Resources