Phoenix icon indicating copy to clipboard operation
Phoenix copied to clipboard

Fail to close a page of wx.lib.agw.aui.AuiNotebook on macOS

Open tianzhuqiao opened this issue 1 year ago • 0 comments

Operating system: macOS 13.2.1 wxPython version & source: 4.2.0 Python version & source: 3.9.5 Description of the problem:

On macOS, sometimes it will fail to close a page of wx.lib.agw.aui.AuiNotebook (instead it triggers dragging operation).

aui_close_notebook_page_fail

Looks like the problem comes from the following line to determine if it is dragging: on macOS, such value may be -1 (see #2344)

https://github.com/wxWidgets/Phoenix/blob/2f2624b17dbff0ed30402733c553f35a2af9e1b1/wx/lib/agw/aui/auibook.py#L2398

Can't reproduce the issue with the following change.

drag_x_threshold = max(4, wx.SystemSettings.GetMetric(wx.SYS_DRAG_X))
drag_y_threshold = max(4, wx.SystemSettings.GetMetric(wx.SYS_DRAG_Y))

tianzhuqiao avatar Apr 11 '23 20:04 tianzhuqiao