avmedia/source/gstreamer/gstplayer.cxx |    9 +++------
 include/vcl/sysdata.hxx                |   11 +++++++----
 vcl/qt5/Qt5Frame.cxx                   |    6 +++---
 vcl/qt5/Qt5Instance.cxx                |    3 +--
 vcl/qt5/Qt5Object.cxx                  |    8 ++++----
 vcl/unx/gtk3/gtk3gtkframe.cxx          |    6 +++---
 vcl/unx/gtk3/gtk3gtkobject.cxx         |    6 +++---
 7 files changed, 24 insertions(+), 25 deletions(-)

New commits:
commit ac87cfdf263d2abd97b32857534d0f749b7c4479
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Sun Oct 6 09:17:48 2019 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Sun Oct 6 12:05:28 2019 +0200

    Replace SystemEnvData pToolkit/pPlatformName strings with enums
    
    (and streamline those data members' names)
    
    Change-Id: Ifdd596c7a54dd507045d412c30b463468c2f798b
    Reviewed-on: https://gerrit.libreoffice.org/80313
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/avmedia/source/gstreamer/gstplayer.cxx 
b/avmedia/source/gstreamer/gstplayer.cxx
index 44e7a04dedf1..4612c1053998 100644
--- a/avmedia/source/gstreamer/gstplayer.cxx
+++ b/avmedia/source/gstreamer/gstplayer.cxx
@@ -850,13 +850,10 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL 
Player::createPlayerWindow( co
         if (!pEnvData)
             return nullptr;
 
-        OUString aToolkit = OUString::createFromAscii(pEnvData->pToolkit);
-        OUString aPlatform = 
OUString::createFromAscii(pEnvData->pPlatformName);
-
         // tdf#124027: the position of embedded window is identical w/ the 
position
         // of media object in all other vclplugs (kf5, gen), in gtk3 w/o 
gtksink it
         // needs to be translated
-        if (aToolkit == "gtk3")
+        if (pEnvData->toolkit == SystemEnvData::Toolkit::Gtk3)
         {
             Point aPoint = pParentWindow->GetPosPixel();
             maArea.X = aPoint.getX();
@@ -868,12 +865,12 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL 
Player::createPlayerWindow( co
         GstElement *pVideosink = 
static_cast<GstElement*>(pParentWindow->CreateGStreamerSink());
         if (pVideosink)
         {
-            if (aToolkit == "gtk3")
+            if (pEnvData->toolkit == SystemEnvData::Toolkit::Gtk3)
                 mbUseGtkSink = true;
         }
         else
         {
-            if (aPlatform == "wayland")
+            if (pEnvData->platform == SystemEnvData::Platform::Wayland)
                 pVideosink = gst_element_factory_make("waylandsink", 
"video-output");
             else
                 pVideosink = gst_element_factory_make("autovideosink", 
"video-output");
diff --git a/include/vcl/sysdata.hxx b/include/vcl/sysdata.hxx
index e7a8f5d2df55..393116d98c70 100644
--- a/include/vcl/sysdata.hxx
+++ b/include/vcl/sysdata.hxx
@@ -61,6 +61,9 @@ struct SystemEnvData
 #elif defined( IOS )
     // Nothing
 #elif defined( UNX )
+    enum class Toolkit { Gtk3, Qt5 };
+    enum class Platform { Wayland, Xcb };
+
     void*               pDisplay;       // the relevant display connection
     unsigned long       aWindow;        // the window of the object
     void*               pSalFrame;      // contains a salframe, if object has 
one
@@ -70,8 +73,8 @@ struct SystemEnvData
     // note: this is a "long" in Xlib *but* in the protocol it's only 32-bit
     // however, the GTK3 vclplug wants to store pointers in here!
     sal_IntPtr          aShellWindow;   // the window of the frame's shell
-    const char*         pToolkit;       // the toolkit in use (gtk2 vs gtk3)
-    const char*         pPlatformName; // the windowing system in use (xcb vs 
wayland)
+    Toolkit             toolkit;        // the toolkit in use
+    Platform            platform;       // the windowing system in use
 #endif
 
     SystemEnvData()
@@ -90,8 +93,8 @@ struct SystemEnvData
         , pVisual(nullptr)
         , nScreen(0)
         , aShellWindow(0)
-        , pToolkit(nullptr)
-        , pPlatformName(nullptr)
+        , toolkit(Toolkit())
+        , platform(Platform())
 #endif
     {
     }
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 01e501ab1ba4..7803a7ebd4eb 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -187,11 +187,11 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
     //m_aSystemData.pSalFrame = this;
     m_aSystemData.pWidget = m_pQWidget;
     //m_aSystemData.nScreen = m_nXScreen.getXScreen();
-    m_aSystemData.pToolkit = "qt5";
+    m_aSystemData.toolkit = SystemEnvData::Toolkit::Qt5;
     if (!bWayland)
-        m_aSystemData.pPlatformName = "xcb";
+        m_aSystemData.platform = SystemEnvData::Platform::Xcb;
     else
-        m_aSystemData.pPlatformName = "wayland";
+        m_aSystemData.platform = SystemEnvData::Platform::Wayland;
 
     SetIcon(SV_ICON_ID_OFFICE);
 }
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 129eb8e5c221..eae41ad9a2bd 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -515,8 +515,7 @@ void* Qt5Instance::CreateGStreamerSink(const 
SystemChildWindow* pWindow)
     if (!pEnvData)
         return nullptr;
 
-    OUString aPlatform = OUString::createFromAscii(pEnvData->pPlatformName);
-    if (aPlatform != "wayland")
+    if (pEnvData->platform != SystemEnvData::Platform::Wayland)
         return nullptr;
 
     GstElement* pVideosink = pSymbol("qwidget5videosink", "qwidget5videosink");
diff --git a/vcl/qt5/Qt5Object.cxx b/vcl/qt5/Qt5Object.cxx
index 4deffda7d18e..5bbfef5a5870 100644
--- a/vcl/qt5/Qt5Object.cxx
+++ b/vcl/qt5/Qt5Object.cxx
@@ -45,17 +45,17 @@ Qt5Object::Qt5Object(Qt5Frame* pParent, bool bShow)
     //m_aSystemData.pSalFrame = this;
     m_aSystemData.pWidget = m_pQWidget;
     //m_aSystemData.nScreen = m_nXScreen.getXScreen();
-    m_aSystemData.pToolkit = "qt5";
-    m_aSystemData.pPlatformName = "xcb";
+    m_aSystemData.toolkit = SystemEnvData::Toolkit::Qt5;
+    m_aSystemData.platform = SystemEnvData::Platform::Xcb;
     const bool bWayland = QGuiApplication::platformName() == "wayland";
     if (!bWayland)
     {
-        m_aSystemData.pPlatformName = "xcb";
+        m_aSystemData.platform = SystemEnvData::Platform::Xcb;
         m_aSystemData.aWindow = m_pQWindow->winId(); // ID of the embedded 
window
     }
     else
     {
-        m_aSystemData.pPlatformName = "wayland";
+        m_aSystemData.platform = SystemEnvData::Platform::Wayland;
         // TODO implement as needed for Wayland,
         // s.a. commit c0d4f3ad3307c which did this for gtk3
         // QPlatformNativeInterface* native = 
QGuiApplication::platformNativeInterface();
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 164699768496..5eb9cfa951e3 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -968,14 +968,14 @@ void GtkSalFrame::InitCommon()
     m_aSystemData.pSalFrame     = this;
     m_aSystemData.pWidget       = m_pWindow;
     m_aSystemData.nScreen       = m_nXScreen.getXScreen();
-    m_aSystemData.pToolkit      = "gtk3";
+    m_aSystemData.toolkit       = SystemEnvData::Toolkit::Gtk3;
 
 #if defined(GDK_WINDOWING_X11)
     GdkDisplay *pDisplay = getGdkDisplay();
     if (DLSYM_GDK_IS_X11_DISPLAY(pDisplay))
     {
         m_aSystemData.pDisplay = gdk_x11_display_get_xdisplay(pDisplay);
-        m_aSystemData.pPlatformName = "xcb";
+        m_aSystemData.platform = SystemEnvData::Platform::Xcb;
         if (GTK_IS_WINDOW(m_pWindow))
         {
             GdkScreen* pScreen = gtk_window_get_screen(GTK_WINDOW(m_pWindow));
@@ -988,7 +988,7 @@ void GtkSalFrame::InitCommon()
     if (DLSYM_GDK_IS_WAYLAND_DISPLAY(pDisplay))
     {
         m_aSystemData.pDisplay = gdk_wayland_display_get_wl_display(pDisplay);
-        m_aSystemData.pPlatformName = "wayland";
+        m_aSystemData.platform = SystemEnvData::Platform::Wayland;
     }
 #endif
 
diff --git a/vcl/unx/gtk3/gtk3gtkobject.cxx b/vcl/unx/gtk3/gtk3gtkobject.cxx
index a4c7fb5864dc..400f82ad47a3 100644
--- a/vcl/unx/gtk3/gtk3gtkobject.cxx
+++ b/vcl/unx/gtk3/gtk3gtkobject.cxx
@@ -53,7 +53,7 @@ GtkSalObject::GtkSalObject( GtkSalFrame* pParent, bool bShow )
     m_aSystemData.pSalFrame     = nullptr;
     m_aSystemData.pWidget       = m_pSocket;
     m_aSystemData.nScreen       = pParent->getXScreenNumber().getXScreen();
-    m_aSystemData.pToolkit      = "gtk3";
+    m_aSystemData.toolkit       = SystemEnvData::Toolkit::Gtk3;
     GdkScreen* pScreen = 
gtk_window_get_screen(GTK_WINDOW(pParent->getWindow()));
     GdkVisual* pVisual = gdk_screen_get_system_visual(pScreen);
 
@@ -63,14 +63,14 @@ GtkSalObject::GtkSalObject( GtkSalFrame* pParent, bool 
bShow )
     {
         m_aSystemData.pDisplay = gdk_x11_display_get_xdisplay(pDisplay);
         m_aSystemData.pVisual = gdk_x11_visual_get_xvisual(pVisual);
-        m_aSystemData.pPlatformName = "xcb";
+        m_aSystemData.platform = SystemEnvData::Platform::Xcb;
     }
 #endif
 #if defined(GDK_WINDOWING_WAYLAND)
     if (DLSYM_GDK_IS_WAYLAND_DISPLAY(pDisplay))
     {
         m_aSystemData.pDisplay = gdk_wayland_display_get_wl_display(pDisplay);
-        m_aSystemData.pPlatformName = "wayland";
+        m_aSystemData.platform = SystemEnvData::Platform::Wayland;
     }
 #endif
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to