Release and move child window by dragging it - macos

I am trying to implement an edge-docking feature between two NSWindows. When the user moves the window I that can be docked just below the main window I snap it into position and add it as a child window to tha main window. This works very well.
However, I am unable to move the docked window away by simply dragging it. Currently I listen for the NSLeftMouseDragged event and when it starts I undock the window by removing it as child from the main window. This works, but the window is not getting moved. You have to release the mouse button and start a new dragging action to move the window away. I am guessing this happens because when the first drag is initiated the window is sat as a child window and therfore cannot be moved by that drag, even thought it gets released in the mean time.
Is there any way around this?
Thank you

Related

How can I move a window that's unselectable behind a dialog?

I have an application (executable) where it displays an update dialog upon launch in front of the parent window. The dialog, of course, maintains the focus and top of the Z order for the application.
The parent window is therefore unselectable and cannot be moved or dragged etc.
Is there a way to modify the position of windows without focus in an external application?

MacOS clicking in unactivated window causes it to move

I have a window in my mac app, and when I click on any control in it, the window moves. This only happens when the window is not activated (focused?). If the window is already the main window, it works fine.
What would cause this? I'm thinking I'm not returning some kind of 'handled' value so that the mouse event is getting passed back to the window's move routine, even though I am not over the move bar.
Thanks for any suggestions!

Why don't background windows receive mouse events when I drag off the foreground window?

When I click on a non-reactive area of a win32 window in the foreground (for example, a blank space on a menu bar) and drag the mouse off, background windows do not receive mouse events. Buttons don't got into hover state, the cursor doesn't change, etc. The mouse is "captured" by the foreground window, although it doesn't receive messages either unless the mouse is over it. This state persists until I release the mouse button. Why is this, and how can I get out of this state programmatically without releasing the mouse button?
Researching this issue, I thought at first it was related to the concept of mouse capture, but it appears it is not. GetCapture() returns NULL during this state, whatever it is.
Clarification Edit: This is easy to see in the simplest of applications. Create a new Win32 project in Visual Studio with the default project template, which makes an empty window. Run it, and click and hold the blank inside of the window. Drag the mouse outside the window, and note that no buttons in background windows light up or otherwise respond to mouse-over events. Even if I stick ReleaseCapture() in the WndProc so that it fires after every message, the result is the same. It really seems like this has nothing to do with mouse capture in the Get/SetCapture sense.

Dragging just after Gaining Window Focus

When a window gains focus via a mouse click (left, right, or middle button), and the button is held, Windows seems to automatically send a mouse released event to the newly focused window after about 0.5 seconds, regardless of whether or not the button is held for longer.
A very easy way to see this bug is to focus on another window (that is not your browser...), and then middle click on this window (it will gain focus), and scroll to the left or right without letting go. It will automatically stop scrolling for you after about 0.5 seconds, as you can tell by the cursor change.
It is annoying because oftentimes I don't realize that a window has lost focus, and I make mistakes by not dragging items as far as I intended, etc. Of course I can just click once to gain focus or alt-tab and then drag, but I'd rather not.
Is there a way such that:
The mouse released event is sent immediately to the window, to stop the drag event from happening in the first place, or
Windows doesn't automatically send a window a mouse released event?
Interestingly enough, Windows Explorer circumvents this issue by never gaining focus when you click on a draggable item. It seems that the folks over at Windows certainly know about it.
Well, I posted this same question on the Microsoft forums and the representative suggested I make a new user account. For whatever reason, this solved the problem.
EDIT: It had nothing to do with the user account, and everything to do with background processes stealing my window focus. In my case, it was the Logitech Gaming Software that came with my mouse, which stole the focus for a split second to determine what new window had been clicked on, and if necessary, change the mouse button profile. Pesky mouse.

JavaFX 2: Passing mouse events through to other windows?

I created a PopUp which is draggable across the screen, like a photoshop palette independent of the main window.
However, I would like the main window to react when I drag this PopUp over it, i.e. receive the mouse events from the drag.
The problem seems to be that since the PopUp is a Window itself, it consumes the dragging mouse events, and the main window never gets them.
I tried making the main windows the owner of the PopUp, however it still doesn't get them.
Is there any way to get around this ? Thanks

Resources