Skip to content

x/exp/shiny: windriver: client windows cannot be closed #25587

Closed
@ktye

Description

@ktye

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.9.2 windows/amd64

Does this issue reproduce with the latest release?

It should be unrelated

What operating system and processor architecture are you using (go env)?

windows/amd64

What did you do?

  • create a second window using shiny.
  • try to close the second window by clicking the x button in the window manager.

What did you expect to see?

the window to disappear

What did you see instead?

  • it is still there but unusable

Is it still the right place to create issues and to send patches for shiny?

The solution to the issue is:

  • DefWindowProc has to be called after WM_CLOSE is received.

The MS docs say:
An application can prompt the user for confirmation, prior to destroying a window, by processing the WM_CLOSE message and calling the DestroyWindow function only if the user confirms the choice.

By default, the DefWindowProc function calls the DestroyWindow function to destroy the window.

I could send in a CL if this is the right place.
The fix would be in:
x/exp/shiny/driver/internal/win32/win32.go: in func windowWndProc:

if uMsg == _WM_CLOSE {
fn(hwnd, uMsg, wParam, lParam) // This calls sendClose
return _DefWindowProc(hwnd, uMsg, wParam, lParam) // We have to run DefWindowProc after it and not just return
}

Of course this closes the window immediately without possible interception, which isn't supported by shiny at this stage anyway.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions