Fix wxOverlay leaving phantoms in Mission Control under macOS Add a call to orderOut on the overlay window before destroying it to prevent this from happening. Fixes #26380. Closes #26384.
Don't show hidden TLWs in wxMSW when parent is restored The default Windows behaviour is to show the children of a hidden window when this window is restored from the taskbar, but we don't want this to happen as this is rather unexpected and, worse, breaks the relationship between the internal state of the window (m_isShown) and its actual visibility. We could fix the latter problem by calling Show() explicitly ourselves, but it seems better to just not show the children. See #26381. Closes #23997. Co-Authored-By: Vadim Zeitlin <va...@wxwidgets.org>
Honour WX_APPNAME_DATA_DIR environment variable in all ports Telling the program where to find its data/resource files can be useful under Windows too, so return the value of this variable if it is defined there too instead of always return the directory where the executable is located. See ##26383.
Don't generate wxEVT_PAINT for windows being destroyed in wxMSW This ensures that the event handler is not called for an already half-destroyed object. Normally this shouldn't happen, but it already did a couple of times in the past and also happens when using wxPropertyGrid, see #26385, so try to make sure it doesn't happen again.
Mark wxPropertyGrid as being deleted in its dtor Together with the fix of the parent commit this fixes a crash during destruction as wxPropertyGrid wxEVT_PAINT handler is not called any more for a half-destructed object. Closes #26385.
| ... | ... | @@ -279,7 +279,7 @@ public: |
| 279 | 279 | - Windows: the directory where the executable file is located
|
| 280 | 280 | - Mac: @c appinfo.app/Contents/SharedSupport bundle subdirectory
|
| 281 | 281 | |
| 282 | - Under Unix (only) it is possible to override the default value returned
|
|
| 282 | + Note that it is possible to override the default value returned
|
|
| 283 | 283 | from this function by setting the value of @c WX_APPNAME_DATA_DIR
|
| 284 | 284 | environment variable to the directory to use (where @c APPNAME is the
|
| 285 | 285 | upper-cased value of wxApp::GetAppName()). This is useful in order to
|
| ... | ... | @@ -26,6 +26,7 @@ |
| 26 | 26 | |
| 27 | 27 | #include "wx/filename.h"
|
| 28 | 28 | #include "wx/stdpaths.h"
|
| 29 | +#include "wx/utils.h"
|
|
| 29 | 30 | |
| 30 | 31 | // ----------------------------------------------------------------------------
|
| 31 | 32 | // module globals
|
| ... | ... | @@ -98,6 +99,18 @@ wxStandardPathsBase::~wxStandardPathsBase() |
| 98 | 99 | // nothing to do here
|
| 99 | 100 | }
|
| 100 | 101 | |
| 102 | +wxString wxStandardPathsBase::GetDataDir() const
|
|
| 103 | +{
|
|
| 104 | + // allow to override the location of the data directory by setting
|
|
| 105 | + // WX_APPNAME_DATA_DIR environment variable: this is very useful in
|
|
| 106 | + // practice for running well-written (and so using wxStandardPaths to find
|
|
| 107 | + // their files) wx applications without installing them
|
|
| 108 | + wxString envOverride;
|
|
| 109 | + wxGetEnv("WX_" + wxTheApp->GetAppName().Upper() + "_DATA_DIR", &envOverride);
|
|
| 110 | + |
|
| 111 | + return envOverride;
|
|
| 112 | +}
|
|
| 113 | + |
|
| 101 | 114 | wxString wxStandardPathsBase::GetLocalDataDir() const
|
| 102 | 115 | {
|
| 103 | 116 | return GetDataDir();
|
| ... | ... | @@ -255,6 +255,14 @@ WXLRESULT wxNonOwnedWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPA |
| 255 | 255 | wxRectFromRECT(*prcNewWindow));
|
| 256 | 256 | }
|
| 257 | 257 | break;
|
| 258 | + |
|
| 259 | + case WM_SHOWWINDOW:
|
|
| 260 | + // Default handling of this message in Windows restores the TLW
|
|
| 261 | + // even if it had been hidden before, and we don't want this to
|
|
| 262 | + // happen, so suppress the default behaviour and simply ignore it.
|
|
| 263 | + if ( lParam == SW_PARENTOPENING && !IsShown() )
|
|
| 264 | + processed = true;
|
|
| 265 | + break;
|
|
| 258 | 266 | }
|
| 259 | 267 | |
| 260 | 268 | if (!processed)
|
| ... | ... | @@ -316,6 +316,10 @@ wxString wxStandardPaths::GetUserConfigDir() const |
| 316 | 316 | |
| 317 | 317 | wxString wxStandardPaths::GetDataDir() const
|
| 318 | 318 | {
|
| 319 | + const wxString& envOverride = wxStandardPathsBase::GetDataDir();
|
|
| 320 | + if ( !envOverride.empty() )
|
|
| 321 | + return envOverride;
|
|
| 322 | + |
|
| 319 | 323 | // under Windows each program is usually installed in its own directory and
|
| 320 | 324 | // so its datafiles are in the same directory as its main executable
|
| 321 | 325 | return GetAppDir();
|
| ... | ... | @@ -5381,6 +5381,17 @@ wxStack<wxMSWImpl::PaintData> wxMSWImpl::paintStack; |
| 5381 | 5381 | |
| 5382 | 5382 | bool wxWindowMSW::HandlePaint()
|
| 5383 | 5383 | {
|
| 5384 | + // Don't bother painting a window that is being destroyed: this is more
|
|
| 5385 | + // than optimization, as its state may be partially torn down and event
|
|
| 5386 | + // handlers may crash.
|
|
| 5387 | + if ( IsBeingDeleted() )
|
|
| 5388 | + {
|
|
| 5389 | + // Validate the window so that Windows doesn't send WM_PAINT again (and
|
|
| 5390 | + // again...).
|
|
| 5391 | + ::ValidateRect(GetHwnd(), nullptr);
|
|
| 5392 | + return true;
|
|
| 5393 | + }
|
|
| 5394 | + |
|
| 5384 | 5395 | HRGN hRegion = ::CreateRectRgn(0, 0, 0, 0); // Dummy call to get a handle
|
| 5385 | 5396 | if ( !hRegion )
|
| 5386 | 5397 | {
|
| ... | ... | @@ -309,6 +309,7 @@ void wxOverlayImpl::Reset() |
| 309 | 309 | |
| 310 | 310 | // todo : don't dispose, only hide and reposition on next run
|
| 311 | 311 | [m_overlayParentWindow removeChildWindow:m_overlayWindow];
|
| 312 | + [m_overlayWindow orderOut:nil];
|
|
| 312 | 313 | [m_overlayWindow release];
|
| 313 | 314 | m_overlayWindow = nullptr ;
|
| 314 | 315 | }
|
| ... | ... | @@ -518,6 +518,8 @@ void wxPropertyGrid::Init2() |
| 518 | 518 | |
| 519 | 519 | wxPropertyGrid::~wxPropertyGrid()
|
| 520 | 520 | {
|
| 521 | + SendDestroyEvent();
|
|
| 522 | + |
|
| 521 | 523 | #if wxUSE_THREADS
|
| 522 | 524 | wxCriticalSectionLocker lock(wxPGGlobalVars->m_critSect);
|
| 523 | 525 | #endif
|
| ... | ... | @@ -212,17 +212,7 @@ wxString wxStandardPaths::GetConfigDir() const |
| 212 | 212 | |
| 213 | 213 | wxString wxStandardPaths::GetDataDir() const
|
| 214 | 214 | {
|
| 215 | - // allow to override the location of the data directory by setting
|
|
| 216 | - // WX_APPNAME_DATA_DIR environment variable: this is very useful in
|
|
| 217 | - // practice for running well-written (and so using wxStandardPaths to find
|
|
| 218 | - // their files) wx applications without installing them
|
|
| 219 | - static const wxString
|
|
| 220 | - envOverride(
|
|
| 221 | - getenv(
|
|
| 222 | - ("WX_" + wxTheApp->GetAppName().Upper() + "_DATA_DIR").c_str()
|
|
| 223 | - )
|
|
| 224 | - );
|
|
| 225 | - |
|
| 215 | + const wxString& envOverride = wxStandardPathsBase::GetDataDir();
|
|
| 226 | 216 | if ( !envOverride.empty() )
|
| 227 | 217 | return envOverride;
|
| 228 | 218 |
—
View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help