diff options
author | Sascha Woo <sascha.woo@gmail.com> | 2015-07-13 22:42:09 +0200 |
---|---|---|
committer | Sascha Woo <sascha.woo@gmail.com> | 2015-07-13 22:42:09 +0200 |
commit | 6e04fdf86d73c4f1fb1bf9e77b704e04f7fc3f3b (patch) | |
tree | 23cd9a9005d69f0a3ae450d99e80cceb0a519835 | |
parent | 1a8753d5cd93890dc6a9f9d4b2ce8848066ea5d0 (diff) | |
parent | 97e73f9d6ac76bcac749d72141bbf5b293f23b14 (diff) |
Merge pull request #7492 from xhaggi/fix-render-order-for-addon-dialogs
[interfaces] fix render order of addon dialogs
-rw-r--r-- | xbmc/interfaces/legacy/Window.h | 5 | ||||
-rw-r--r-- | xbmc/interfaces/legacy/WindowDialog.cpp | 5 | ||||
-rw-r--r-- | xbmc/interfaces/legacy/WindowInterceptor.h | 6 | ||||
-rw-r--r-- | xbmc/interfaces/legacy/WindowXML.cpp | 15 | ||||
-rw-r--r-- | xbmc/interfaces/legacy/WindowXML.h | 2 |
5 files changed, 31 insertions, 2 deletions
diff --git a/xbmc/interfaces/legacy/Window.h b/xbmc/interfaces/legacy/Window.h index addf922dd8..d2e7394038 100644 --- a/xbmc/interfaces/legacy/Window.h +++ b/xbmc/interfaces/legacy/Window.h @@ -31,6 +31,11 @@ namespace XBMCAddon { namespace xbmcgui { + enum RenderOrder { + WINDOW = 0, + DIALOG = 1 + }; + // Forward declare the interceptor as the AddonWindowInterceptor.h // file needs to include the Window class because of the template class InterceptorBase; diff --git a/xbmc/interfaces/legacy/WindowDialog.cpp b/xbmc/interfaces/legacy/WindowDialog.cpp index 492cd02d72..5beab164cf 100644 --- a/xbmc/interfaces/legacy/WindowDialog.cpp +++ b/xbmc/interfaces/legacy/WindowDialog.cpp @@ -32,7 +32,10 @@ namespace XBMCAddon Window(true), WindowDialogMixin(this) { CSingleLock lock(g_graphicsContext); - setWindow(new Interceptor<CGUIWindow>("CGUIWindow",this,getNextAvailableWindowId())); + InterceptorBase* interceptor = new Interceptor<CGUIWindow>("CGUIWindow", this, getNextAvailableWindowId()); + // set the render order to the dialog's default because this dialog is mapped to CGUIWindow instead of CGUIDialog + interceptor->SetRenderOrder(RenderOrder::DIALOG); + setWindow(interceptor); } WindowDialog::~WindowDialog() { deallocating(); } diff --git a/xbmc/interfaces/legacy/WindowInterceptor.h b/xbmc/interfaces/legacy/WindowInterceptor.h index 6fefac0fcb..0a004b688c 100644 --- a/xbmc/interfaces/legacy/WindowInterceptor.h +++ b/xbmc/interfaces/legacy/WindowInterceptor.h @@ -67,7 +67,9 @@ namespace XBMCAddon virtual CGUIWindow* get() = 0; - virtual void setActive(bool active) { } ; + virtual void SetRenderOrder(int renderOrder) { } + + virtual void setActive(bool active) { } virtual bool isActive() { return false; } friend class ref; @@ -174,6 +176,8 @@ namespace XBMCAddon virtual bool IsDialog() const { XBMC_TRACE; return checkedb(IsDialog()); }; virtual bool IsMediaWindow() const { XBMC_TRACE; return checkedb(IsMediaWindow());; }; + virtual void SetRenderOrder(int renderOrder) { XBMC_TRACE; P::m_renderOrder = renderOrder; } + virtual void setActive(bool active) { XBMC_TRACE; P::m_active = active; } virtual bool isActive() { XBMC_TRACE; return P::m_active; } }; diff --git a/xbmc/interfaces/legacy/WindowXML.cpp b/xbmc/interfaces/legacy/WindowXML.cpp index 4edcecfdd9..29f60100e7 100644 --- a/xbmc/interfaces/legacy/WindowXML.cpp +++ b/xbmc/interfaces/legacy/WindowXML.cpp @@ -494,6 +494,21 @@ namespace XBMCAddon g_windowManager.RemoveDialog(interceptor->GetID()); WindowXML::OnDeinitWindow(nextWindowID); } + + bool WindowXMLDialog::LoadXML(const String &strPath, const String &strLowerPath) + { + XBMC_TRACE; + if (WindowXML::LoadXML(strPath, strLowerPath)) + { + // Set the render order to the dialog's default in case it's not specified in the skin xml + // because this dialog is mapped to CGUIMediaWindow instead of CGUIDialog. + // This must be done here, because the render order will be reset before loading the skin xml. + if (ref(window)->GetRenderOrder() == RenderOrder::WINDOW) + window->SetRenderOrder(RenderOrder::DIALOG); + return true; + } + return false; + } } diff --git a/xbmc/interfaces/legacy/WindowXML.h b/xbmc/interfaces/legacy/WindowXML.h index 9c1cc9b246..334a1e69cf 100644 --- a/xbmc/interfaces/legacy/WindowXML.h +++ b/xbmc/interfaces/legacy/WindowXML.h @@ -238,6 +238,8 @@ namespace XBMCAddon SWIGHIDDENVIRTUAL bool OnAction(const CAction &action); SWIGHIDDENVIRTUAL void OnDeinitWindow(int nextWindowID); + SWIGHIDDENVIRTUAL bool LoadXML(const String &strPath, const String &strPathLower); + SWIGHIDDENVIRTUAL inline void show() { XBMC_TRACE; WindowDialogMixin::show(); } SWIGHIDDENVIRTUAL inline void close() { XBMC_TRACE; WindowDialogMixin::close(); } |