diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/api/wnd/wndclass/svcwndhold.cpp | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/Wasabi/api/wnd/wndclass/svcwndhold.cpp')
-rw-r--r-- | Src/Wasabi/api/wnd/wndclass/svcwndhold.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Src/Wasabi/api/wnd/wndclass/svcwndhold.cpp b/Src/Wasabi/api/wnd/wndclass/svcwndhold.cpp new file mode 100644 index 00000000..9620ce4d --- /dev/null +++ b/Src/Wasabi/api/wnd/wndclass/svcwndhold.cpp @@ -0,0 +1,53 @@ +#include <precomp.h> + +#include "svcwndhold.h" + +#include <bfc/common.h> + +#include <api/service/svcs/svc_wndcreate.h> + +#include <api/wnd/wndclass/blankwnd.h> + +ServiceWndHolder::ServiceWndHolder(ifc_window *_child, svc_windowCreate *_svc) : + child(NULL), svc(NULL) + { + setChild(_child, _svc); +} + +ServiceWndHolder::~ServiceWndHolder() +{ + if (svc != NULL) + { + svc->destroyWindow(child); + if (!svc->refcount()) + WASABI_API_SVC->service_release(svc); + } else { + delete static_cast<BaseWnd*>(child); + } +} + +int ServiceWndHolder::setChild(ifc_window *_child, svc_windowCreate *_svc) +{ + if (child == _child && svc == _svc) return 0; + + if (child != NULL) { + if (svc != NULL) { + svc->destroyWindow(child); + if (!svc->refcount()) + WASABI_API_SVC->service_release(svc); + svc = NULL; + } else { + delete static_cast<BaseWnd*>(child); + } + child = NULL; + } + + child = _child; + svc = _svc; + + return 1; +} + +ifc_window *ServiceWndHolder::rootwndholder_getRootWnd() { + return child ? child : SERVICEWNDHOLDER_PARENT::rootwndholder_getRootWnd(); +} |