changeset 1391:32272ecfc6c2

Drilled a hole through the abstractions to be able to match an SdlViewport with its SDL window ID to support dispatching event loop SDL events as viewport/controller/compositor method calls.
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 28 Apr 2020 13:26:41 +0200
parents 57e06087d357
children ffdb82850e98
files Framework/Viewport/SdlViewport.cpp Framework/Viewport/SdlViewport.h
diffstat 2 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Viewport/SdlViewport.cpp	Tue Apr 28 11:28:00 2020 +0200
+++ b/Framework/Viewport/SdlViewport.cpp	Tue Apr 28 13:26:41 2020 +0200
@@ -95,6 +95,14 @@
     return that;
   }
 
+  uint32_t SdlOpenGLViewport::GetSdlWindowId()
+  {
+    SdlWindow& sdlWindowWrapper = context_.GetWindow();
+    SDL_Window* sdlWindow = sdlWindowWrapper.GetObject();
+    Uint32 sdlWindowId = SDL_GetWindowID(sdlWindow);
+    return sdlWindowId;
+  }
+
   SdlOpenGLViewport::~SdlOpenGLViewport()
   {
     // Make sure that the "OpenGLCompositor" is destroyed BEFORE the
@@ -146,6 +154,13 @@
     }
   }
   
+  uint32_t SdlCairoViewport::GetSdlWindowId()
+  {
+    SDL_Window* sdlWindow = window_.GetObject();
+    Uint32 sdlWindowId = SDL_GetWindowID(sdlWindow);
+    return sdlWindowId;
+  }
+
   void SdlCairoViewport::Paint()
   {
     SdlLock lock(*this);
--- a/Framework/Viewport/SdlViewport.h	Tue Apr 28 11:28:00 2020 +0200
+++ b/Framework/Viewport/SdlViewport.h	Tue Apr 28 13:26:41 2020 +0200
@@ -119,6 +119,8 @@
       return new SdlLock(*this);
     }
 
+    virtual uint32_t GetSdlWindowId() = 0;
+
     virtual void UpdateSize(unsigned int width,
                             unsigned int height) = 0;
 
@@ -148,6 +150,8 @@
 
     virtual ~SdlOpenGLViewport();
 
+    virtual uint32_t GetSdlWindowId() ORTHANC_OVERRIDE;
+
     virtual void Paint() ORTHANC_OVERRIDE;
 
     virtual void UpdateSize(unsigned int width, 
@@ -179,6 +183,8 @@
 
     virtual ~SdlCairoViewport();
 
+    virtual uint32_t GetSdlWindowId() ORTHANC_OVERRIDE;
+
     virtual void Paint() ORTHANC_OVERRIDE;
 
     virtual void UpdateSize(unsigned int width,