floem icon indicating copy to clipboard operation
floem copied to clipboard

Chaos when a new window is opened during a drag operation

Open timboudreau opened this issue 8 months ago • 2 comments

Given:

  • A view which has had draggable() called on it
  • which opens a new window in its drag start handler (and will close it on mouse-up)

things start to go very wrong:

  • Events are not delivered to the newly created window until the mouse-up over it that should end the drag operation
  • The drag operation, as far as the main window and drag-start view is concerned, never ends - any future mouse motion event over it will generate new drag events, but no mouse-up over the view will end the drag operation

It looks like the root problem here is that a distinct AppState is created for each WindowHandle - it isn't really "application state" (though it should be). So the tests of fields of cx.app_state in WindowHandle.event don't get the truth of the application's state, just what one window's handler's have been able to learn about the application's state.

It seems like a fix would start with AppState being shared in some fashion between windows and owned by the Application or ApplicationHandle instead of being created in isolation in WindowHandle.new().

timboudreau avatar May 27 '24 07:05 timboudreau