[Libreoffice-commits] core.git: configure.ac vcl/inc vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 7 15:58:32 UTC 2020


 configure.ac                              |    2 
 vcl/inc/unx/gtk/gtkframe.hxx              |    9 
 vcl/inc/unx/gtk/gtkgdi.hxx                |    6 
 vcl/unx/gtk3/gtk3gtkdata.cxx              |    7 
 vcl/unx/gtk3/gtk3gtkframe.cxx             |   45 
 vcl/unx/gtk3/gtk3gtkinst.cxx              |  108 -
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 1807 ++++++++----------------------
 7 files changed, 520 insertions(+), 1464 deletions(-)

New commits:
commit 0c9ccc7dbf6deb4d012e0d1e6eb934e54e0f19bc
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 2 21:21:45 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Oct 7 17:57:50 2020 +0200

    raise min version of gtk to 3.20.0
    
    Change-Id: I7e463f48dabbcc27b0d5533fa2c46610cbd7aa82
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103901
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/configure.ac b/configure.ac
index 9ec9527a6120..6c8ebcd58ebe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11179,7 +11179,7 @@ if test "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
     fi
     : ${with_system_cairo:=yes}
-    PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.18 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo)
+    PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.20 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo)
     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
     FilterLibs "${GTK3_LIBS}"
     GTK3_LIBS="${filteredlibs}"
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 9f82691026dd..c6eb3471f8d6 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -541,15 +541,6 @@ AtkObject* ooo_fixed_get_accessible(GtkWidget *obj);
 
 } // extern "C"
 
-#if !GTK_CHECK_VERSION(3, 20, 0)
-enum GdkDragCancelReason
-{
-  GDK_DRAG_CANCEL_NO_TARGET,
-  GDK_DRAG_CANCEL_USER_CANCELLED,
-  GDK_DRAG_CANCEL_ERROR
-};
-#endif
-
 #if !GTK_CHECK_VERSION(3, 22, 0)
 enum GdkAnchorHints
 {
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 745594877ac5..604bfeff9eaa 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -94,8 +94,6 @@ enum class GtkControlPart
     SeparatorMenuItemSeparator,
 };
 
-typedef void (*gtk_widget_path_iter_set_object_nameFunc)(GtkWidgetPath *, guint, const char*);
-
 class GtkSalGraphics : public SvpSalGraphics
 {
     GtkSalFrame * const mpFrame;
@@ -134,9 +132,7 @@ public:
 
     virtual OUString getRenderBackendName() const override { return "gtk3svp"; }
 
-    GtkStyleContext* createStyleContext(gtk_widget_path_iter_set_object_nameFunc set_object_name, GtkControlPart ePart);
-    GtkStyleContext* createNewContext(GtkControlPart ePart, gtk_widget_path_iter_set_object_nameFunc set_object_name);
-    GtkStyleContext* createOldContext(GtkControlPart ePart);
+    GtkStyleContext* createStyleContext(GtkControlPart ePart);
     GtkStyleContext* makeContext(GtkWidgetPath *pPath, GtkStyleContext *pParent);
 private:
     GtkWidget              *mpWindow;
diff --git a/vcl/unx/gtk3/gtk3gtkdata.cxx b/vcl/unx/gtk3/gtk3gtkdata.cxx
index cdded04ae8c2..619a57bb1d8b 100644
--- a/vcl/unx/gtk3/gtk3gtkdata.cxx
+++ b/vcl/unx/gtk3/gtk3gtkdata.cxx
@@ -528,12 +528,7 @@ void GtkSalData::Init()
           "min-height: 18px;"
           "min-width: 18px;"
           "}";
-        static const gchar olddata[] = "button.small-button, toolbar.small-button button { "
-          "padding: 0;"
-          "margin-left: 0px;"
-          "margin-right: 0px;"
-          "}";
-        gtk_css_provider_load_from_data(pSmallButtonProvider, gtk_check_version(3, 20, 0) == nullptr ? data : olddata, -1, nullptr);
+        gtk_css_provider_load_from_data(pSmallButtonProvider, data, -1, nullptr);
 
         gtk_style_context_add_provider_for_screen(pScreen, GTK_STYLE_PROVIDER(pSmallButtonProvider),
             GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index d97107d77375..e7e3f96eccfe 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2039,42 +2039,16 @@ void GtkSalFrame::grabPointer( bool bGrab, bool bKeyboardAlso, bool bOwnerEvents
     if (!m_pWindow)
         return;
 
-#if GTK_CHECK_VERSION(3, 20, 0)
-    if (gtk_check_version(3, 20, 0) == nullptr)
-    {
-        GdkSeat* pSeat = gdk_display_get_default_seat(getGdkDisplay());
-        if (bGrab)
-        {
-            GdkSeatCapabilities eCapability = bKeyboardAlso ? GDK_SEAT_CAPABILITY_ALL : GDK_SEAT_CAPABILITY_ALL_POINTING;
-            gdk_seat_grab(pSeat, gtk_widget_get_window(getMouseEventWidget()), eCapability,
-                          bOwnerEvents, nullptr, nullptr, nullptr, nullptr);
-        }
-        else
-        {
-            gdk_seat_ungrab(pSeat);
-        }
-        return;
-    }
-#endif
-
-    //else older gtk3
-    GdkDeviceManager* pDeviceManager = gdk_display_get_device_manager(getGdkDisplay());
-    GdkDevice* pPointer = gdk_device_manager_get_client_pointer(pDeviceManager);
-    GdkDevice* pKeyboard = bKeyboardAlso ? gdk_device_get_associated_device(pPointer) : nullptr;
-    GdkWindow* pWindow = gtk_widget_get_window(getMouseEventWidget());
-    guint32 nCurrentTime = gtk_get_current_event_time();
+    GdkSeat* pSeat = gdk_display_get_default_seat(getGdkDisplay());
     if (bGrab)
     {
-        gdk_device_grab(pPointer, pWindow, GDK_OWNERSHIP_NONE,
-                        bOwnerEvents, GDK_ALL_EVENTS_MASK, m_pCurrentCursor, nCurrentTime);
-        if (pKeyboard)
-            gdk_device_grab(pKeyboard, pWindow, GDK_OWNERSHIP_NONE, true, GDK_ALL_EVENTS_MASK, nullptr, nCurrentTime);
+        GdkSeatCapabilities eCapability = bKeyboardAlso ? GDK_SEAT_CAPABILITY_ALL : GDK_SEAT_CAPABILITY_ALL_POINTING;
+        gdk_seat_grab(pSeat, gtk_widget_get_window(getMouseEventWidget()), eCapability,
+                      bOwnerEvents, nullptr, nullptr, nullptr, nullptr);
     }
     else
     {
-        gdk_device_ungrab(pPointer, nCurrentTime);
-        if (pKeyboard)
-            gdk_device_ungrab(pKeyboard, nCurrentTime);
+        gdk_seat_ungrab(pSeat);
     }
 }
 
@@ -4612,13 +4586,8 @@ GdkEvent* GtkSalFrame::makeFakeKeyPress(GtkWidget* pWidget)
     GdkEvent *event = gdk_event_new(GDK_KEY_PRESS);
     event->key.window = GDK_WINDOW(g_object_ref(gtk_widget_get_window(pWidget)));
 
-#if GTK_CHECK_VERSION(3, 20, 0)
-    if (gtk_check_version(3, 20, 0) == nullptr)
-    {
-        GdkSeat *seat = gdk_display_get_default_seat(gtk_widget_get_display(pWidget));
-        gdk_event_set_device(event, gdk_seat_get_keyboard(seat));
-    }
-#endif
+    GdkSeat *seat = gdk_display_get_default_seat(gtk_widget_get_display(pWidget));
+    gdk_event_set_device(event, gdk_seat_get_keyboard(seat));
 
     event->key.send_event = 1 /* TRUE */;
     event->key.time = gtk_get_current_event_time();
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index ddea5a54a9aa..de24e8c98a75 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3337,29 +3337,20 @@ namespace
     GtkWidget* image_new_from_virtual_device(const VirtualDevice& rImageSurface)
     {
         GtkWidget* pImage = nullptr;
-        if (gtk_check_version(3, 20, 0) == nullptr)
-        {
-            cairo_surface_t* surface = get_underlying_cairo_surface(rImageSurface);
+        cairo_surface_t* surface = get_underlying_cairo_surface(rImageSurface);
 
-            Size aSize(rImageSurface.GetOutputSizePixel());
-            cairo_surface_t* target = cairo_surface_create_similar(surface,
-                                                                   cairo_surface_get_content(surface),
-                                                                   aSize.Width(),
-                                                                   aSize.Height());
+        Size aSize(rImageSurface.GetOutputSizePixel());
+        cairo_surface_t* target = cairo_surface_create_similar(surface,
+                                                               cairo_surface_get_content(surface),
+                                                               aSize.Width(),
+                                                               aSize.Height());
 
-            cairo_t* cr = cairo_create(target);
-            cairo_set_source_surface(cr, surface, 0, 0);
-            cairo_paint(cr);
-            cairo_destroy(cr);
-            pImage = gtk_image_new_from_surface(target);
-            cairo_surface_destroy(target);
-        }
-        else
-        {
-            GdkPixbuf* pixbuf = getPixbuf(rImageSurface);
-            pImage = gtk_image_new_from_pixbuf(pixbuf);
-            g_object_unref(pixbuf);
-        }
+        cairo_t* cr = cairo_create(target);
+        cairo_set_source_surface(cr, surface, 0, 0);
+        cairo_paint(cr);
+        cairo_destroy(cr);
+        pImage = gtk_image_new_from_surface(target);
+        cairo_surface_destroy(target);
         return pImage;
     }
 
@@ -6402,8 +6393,7 @@ public:
         GtkStyleContext *pNotebookContext = gtk_widget_get_style_context(GTK_WIDGET(m_pOverFlowNotebook));
         GtkCssProvider *pProvider = gtk_css_provider_new();
         static const gchar data[] = "header.top > tabs > tab:checked { box-shadow: none; padding: 0 0 0 0; margin: 0 0 0 0; border-image: none; border-image-width: 0 0 0 0; background-image: none; background-color: transparent; border-radius: 0 0 0 0; border-width: 0 0 0 0; border-style: none; border-color: transparent; opacity: 0; min-height: 0; min-width: 0; }";
-        static const gchar olddata[] = "tab.top:active { box-shadow: none; padding: 0 0 0 0; margin: 0 0 0 0; border-image: none; border-image-width: 0 0 0 0; background-image: none; background-color: transparent; border-radius: 0 0 0 0; border-width: 0 0 0 0; border-style: none; border-color: transparent; opacity: 0; }";
-        gtk_css_provider_load_from_data(pProvider, gtk_check_version(3, 20, 0) == nullptr ? data : olddata, -1, nullptr);
+        gtk_css_provider_load_from_data(pProvider, data, -1, nullptr);
         gtk_style_context_add_provider(pNotebookContext, GTK_STYLE_PROVIDER(pProvider),
                                        GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
     }
@@ -6980,43 +6970,16 @@ public:
 void do_grab(GtkWidget* pWidget)
 {
     GdkDisplay *pDisplay = gtk_widget_get_display(pWidget);
-#if GTK_CHECK_VERSION(3, 20, 0)
-    if (gtk_check_version(3, 20, 0) == nullptr)
-    {
-        GdkSeat* pSeat = gdk_display_get_default_seat(pDisplay);
-        gdk_seat_grab(pSeat, gtk_widget_get_window(pWidget),
-                      GDK_SEAT_CAPABILITY_ALL, true, nullptr, nullptr, nullptr, nullptr);
-        return;
-    }
-#endif
-    //else older gtk3
-    GdkDeviceManager* pDeviceManager = gdk_display_get_device_manager(pDisplay);
-    GdkDevice* pPointer = gdk_device_manager_get_client_pointer(pDeviceManager);
-    GdkWindow* pWindow = gtk_widget_get_window(pWidget);
-    guint32 nCurrentTime = gtk_get_current_event_time();
-    gdk_device_grab(pPointer, pWindow, GDK_OWNERSHIP_NONE, true, GDK_ALL_EVENTS_MASK, nullptr, nCurrentTime);
-    if (GdkDevice* pKeyboard = gdk_device_get_associated_device(pPointer))
-        gdk_device_grab(pKeyboard, pWindow, GDK_OWNERSHIP_NONE, true, GDK_ALL_EVENTS_MASK, nullptr, nCurrentTime);
+    GdkSeat* pSeat = gdk_display_get_default_seat(pDisplay);
+    gdk_seat_grab(pSeat, gtk_widget_get_window(pWidget),
+                  GDK_SEAT_CAPABILITY_ALL, true, nullptr, nullptr, nullptr, nullptr);
 }
 
 void do_ungrab(GtkWidget* pWidget)
 {
     GdkDisplay *pDisplay = gtk_widget_get_display(pWidget);
-#if GTK_CHECK_VERSION(3, 20, 0)
-    if (gtk_check_version(3, 20, 0) == nullptr)
-    {
-        GdkSeat* pSeat = gdk_display_get_default_seat(pDisplay);
-        gdk_seat_ungrab(pSeat);
-        return;
-    }
-#endif
-    //else older gtk3
-    GdkDeviceManager* pDeviceManager = gdk_display_get_device_manager(pDisplay);
-    GdkDevice* pPointer = gdk_device_manager_get_client_pointer(pDeviceManager);
-    guint32 nCurrentTime = gtk_get_current_event_time();
-    gdk_device_ungrab(pPointer, nCurrentTime);
-    if (GdkDevice* pKeyboard = gdk_device_get_associated_device(pPointer))
-        gdk_device_ungrab(pKeyboard, nCurrentTime);
+    GdkSeat* pSeat = gdk_display_get_default_seat(pDisplay);
+    gdk_seat_ungrab(pSeat);
 }
 
 GtkPositionType show_menu_older_gtk(GtkWidget* pMenuButton, GtkWindow* pMenu)
@@ -7376,16 +7339,7 @@ public:
     {
         ensure_image_widget();
         if (pDevice)
-        {
-            if (gtk_check_version(3, 20, 0) == nullptr)
-                gtk_image_set_from_surface(m_pImage, get_underlying_cairo_surface(*pDevice));
-            else
-            {
-                GdkPixbuf* pixbuf = getPixbuf(*pDevice);
-                gtk_image_set_from_pixbuf(m_pImage, pixbuf);
-                g_object_unref(pixbuf);
-            }
-        }
+            gtk_image_set_from_surface(m_pImage, get_underlying_cairo_surface(*pDevice));
         else
             gtk_image_set_from_surface(m_pImage, nullptr);
     }
@@ -7927,12 +7881,7 @@ private:
                       "margin-right: 0px;"
                       "min-width: 4px;"
                       "}";
-                    const gchar olddata[] = "* { "
-                      "padding: 0;"
-                      "margin-left: 0px;"
-                      "margin-right: 0px;"
-                      "}";
-                    gtk_css_provider_load_from_data(m_pMenuButtonProvider, gtk_check_version(3, 20, 0) == nullptr ? data : olddata, -1, nullptr);
+                    gtk_css_provider_load_from_data(m_pMenuButtonProvider, data, -1, nullptr);
                 }
 
                 gtk_style_context_add_provider(pButtonContext,
@@ -8501,19 +8450,10 @@ public:
 
     virtual void set_image(VirtualDevice* pDevice) override
     {
-        if (gtk_check_version(3, 20, 0) == nullptr)
-        {
-            if (pDevice)
-                gtk_image_set_from_surface(m_pImage, get_underlying_cairo_surface(*pDevice));
-            else
-                gtk_image_set_from_surface(m_pImage, nullptr);
-            return;
-        }
-
-        GdkPixbuf* pixbuf = pDevice ? getPixbuf(*pDevice) : nullptr;
-        gtk_image_set_from_pixbuf(m_pImage, pixbuf);
-        if (pixbuf)
-            g_object_unref(pixbuf);
+        if (pDevice)
+            gtk_image_set_from_surface(m_pImage, get_underlying_cairo_surface(*pDevice));
+        else
+            gtk_image_set_from_surface(m_pImage, nullptr);
     }
 
     virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 879e2a5bbc5c..c9cbf01e9ecb 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -263,8 +263,6 @@ tools::Rectangle GtkSalGraphics::NWGetScrollButtonRect( ControlPart nPart, tools
                                  "has-secondary-forward-stepper", &has_forward2,
                                  "has-backward-stepper", &has_backward,
                                  "has-secondary-backward-stepper", &has_backward2, nullptr );
-    gint       buttonWidth;
-    gint       buttonHeight;
 
     gint nFirst = 0;
     gint nSecond = 0;
@@ -274,103 +272,46 @@ tools::Rectangle GtkSalGraphics::NWGetScrollButtonRect( ControlPart nPart, tools
     if ( has_backward )  nFirst  += 1;
     if ( has_backward2 ) nSecond += 1;
 
-    if (gtk_check_version(3, 20, 0) == nullptr)
+    Size aSize;
+    if (nPart == ControlPart::ButtonLeft || nPart == ControlPart::ButtonRight)
     {
-        Size aSize;
-        if (nPart == ControlPart::ButtonLeft || nPart == ControlPart::ButtonRight)
-        {
-            QuerySize(mpHScrollbarStyle, aSize);
-            QuerySize(mpHScrollbarContentsStyle, aSize);
-            QuerySize(mpHScrollbarButtonStyle, aSize);
-        }
-        else
-        {
-            QuerySize(mpVScrollbarStyle, aSize);
-            QuerySize(mpVScrollbarContentsStyle, aSize);
-            QuerySize(mpVScrollbarButtonStyle, aSize);
-        }
-
-        if (nPart == ControlPart::ButtonUp)
-        {
-            aSize.setHeight( aSize.Height() * nFirst );
-            buttonRect.setX(aAreaRect.Left());
-            buttonRect.setY(aAreaRect.Top());
-        }
-        else if (nPart == ControlPart::ButtonLeft)
-        {
-            aSize.setWidth( aSize.Width() * nFirst );
-            buttonRect.setX(aAreaRect.Left());
-            buttonRect.setY(aAreaRect.Top());
-        }
-        else if (nPart == ControlPart::ButtonDown)
-        {
-            aSize.setHeight( aSize.Height() * nSecond );
-            buttonRect.setX(aAreaRect.Left());
-            buttonRect.setY(aAreaRect.Top() + aAreaRect.GetHeight() - aSize.Height());
-        }
-        else if (nPart == ControlPart::ButtonRight)
-        {
-            aSize.setWidth( aSize.Width() * nSecond );
-            buttonRect.setX(aAreaRect.Left() + aAreaRect.GetWidth() - aSize.Width());
-            buttonRect.setY(aAreaRect.Top());
-        }
-
-        buttonRect.SetSize(aSize);
-
-        return buttonRect;
-    }
-
-    gint slider_width;
-    gint stepper_size;
-    gint stepper_spacing;
-    gint trough_border;
-
-    // Grab some button style attributes
-    gtk_style_context_get_style( pScrollbarStyle,
-                                 "slider-width", &slider_width,
-                                 "stepper-size", &stepper_size,
-                                 "trough-border", &trough_border,
-                                 "stepper-spacing", &stepper_spacing, nullptr );
-
-    if ( ( nPart == ControlPart::ButtonUp ) || ( nPart == ControlPart::ButtonDown ) )
-    {
-        buttonWidth = slider_width + 2 * trough_border;
-        buttonHeight = stepper_size + trough_border + stepper_spacing;
+        QuerySize(mpHScrollbarStyle, aSize);
+        QuerySize(mpHScrollbarContentsStyle, aSize);
+        QuerySize(mpHScrollbarButtonStyle, aSize);
     }
     else
     {
-        buttonWidth = stepper_size + trough_border + stepper_spacing;
-        buttonHeight = slider_width + 2 * trough_border;
+        QuerySize(mpVScrollbarStyle, aSize);
+        QuerySize(mpVScrollbarContentsStyle, aSize);
+        QuerySize(mpVScrollbarButtonStyle, aSize);
     }
 
-    if ( nPart == ControlPart::ButtonUp )
+    if (nPart == ControlPart::ButtonUp)
     {
-        buttonHeight *= nFirst;
-        buttonHeight -= 1;
-        buttonRect.setX( aAreaRect.Left() );
-        buttonRect.setY( aAreaRect.Top() );
+        aSize.setHeight( aSize.Height() * nFirst );
+        buttonRect.setX(aAreaRect.Left());
+        buttonRect.setY(aAreaRect.Top());
     }
-    else if ( nPart == ControlPart::ButtonLeft )
+    else if (nPart == ControlPart::ButtonLeft)
     {
-        buttonWidth *= nFirst;
-        buttonWidth -= 1;
-        buttonRect.setX( aAreaRect.Left() );
-        buttonRect.setY( aAreaRect.Top() );
+        aSize.setWidth( aSize.Width() * nFirst );
+        buttonRect.setX(aAreaRect.Left());
+        buttonRect.setY(aAreaRect.Top());
     }
-    else if ( nPart == ControlPart::ButtonDown )
+    else if (nPart == ControlPart::ButtonDown)
     {
-        buttonHeight *= nSecond;
-        buttonRect.setX( aAreaRect.Left() );
-        buttonRect.setY( aAreaRect.Top() + aAreaRect.GetHeight() - buttonHeight );
+        aSize.setHeight( aSize.Height() * nSecond );
+        buttonRect.setX(aAreaRect.Left());
+        buttonRect.setY(aAreaRect.Top() + aAreaRect.GetHeight() - aSize.Height());
     }
-    else if ( nPart == ControlPart::ButtonRight )
+    else if (nPart == ControlPart::ButtonRight)
     {
-        buttonWidth *= nSecond;
-        buttonRect.setX( aAreaRect.Left() + aAreaRect.GetWidth() - buttonWidth );
-        buttonRect.setY( aAreaRect.Top() );
+        aSize.setWidth( aSize.Width() * nSecond );
+        buttonRect.setX(aAreaRect.Left() + aAreaRect.GetWidth() - aSize.Width());
+        buttonRect.setY(aAreaRect.Top());
     }
 
-    buttonRect.SetSize( Size( buttonWidth, buttonHeight ) );
+    buttonRect.SetSize(aSize);
 
     return buttonRect;
 }
@@ -381,9 +322,6 @@ static GtkWidget* gSpinBox;
 static GtkWidget* gEntryBox;
 static GtkWidget* gComboBox;
 static GtkWidget* gListBox;
-static GtkWidget* gMenuBarWidget;
-static GtkWidget* gMenuItemMenuBarWidget;
-static GtkWidget* gCheckMenuItemWidget;
 static GtkWidget* gTreeViewWidget;
 
 namespace
@@ -460,332 +398,7 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
                                     ControlPart nPart,
                                     const ImplControlValue& rValue )
 {
-    if (gtk_check_version(3, 20, 0) == nullptr)
-    {
-        assert(rValue.getType() == ControlType::Scrollbar);
-        const ScrollbarValue& rScrollbarVal = static_cast<const ScrollbarValue&>(rValue);
-        tools::Rectangle        scrollbarRect;
-        GtkStateFlags    stateFlags;
-        GtkOrientation    scrollbarOrientation;
-        tools::Rectangle        thumbRect = rScrollbarVal.maThumbRect;
-        tools::Rectangle        button11BoundRect = rScrollbarVal.maButton1Rect;   // backward
-        tools::Rectangle        button22BoundRect = rScrollbarVal.maButton2Rect;   // forward
-        tools::Rectangle        button12BoundRect = rScrollbarVal.maButton1Rect;   // secondary forward
-        tools::Rectangle        button21BoundRect = rScrollbarVal.maButton2Rect;   // secondary backward
-        gdouble          arrow1Angle;                                        // backward
-        gdouble          arrow2Angle;                                        // forward
-        tools::Rectangle        arrowRect;
-        gint            slider_width = 0;
-        gint            stepper_size = 0;
-
-        // make controlvalue rectangles relative to area
-        thumbRect.Move( -rControlRectangle.Left(), -rControlRectangle.Top() );
-        button11BoundRect.Move( -rControlRectangle.Left(), -rControlRectangle.Top() );
-        button22BoundRect.Move( -rControlRectangle.Left(), -rControlRectangle.Top() );
-        button12BoundRect.Move( -rControlRectangle.Left(), -rControlRectangle.Top() );
-        button21BoundRect.Move( -rControlRectangle.Left(), -rControlRectangle.Top() );
-
-        // Find the overall bounding rect of the control
-        scrollbarRect = rControlRectangle;
-        if (scrollbarRect.IsEmpty())
-            return;
-
-        gint slider_side;
-        Size aSize;
-        if (nPart == ControlPart::DrawBackgroundHorz)
-        {
-            QuerySize(mpHScrollbarStyle, aSize);
-            QuerySize(mpHScrollbarContentsStyle, aSize);
-            QuerySize(mpHScrollbarTroughStyle, aSize);
-            QuerySize(mpHScrollbarSliderStyle, aSize);
-            slider_side = aSize.Height();
-            gtk_style_context_get(mpHScrollbarButtonStyle,
-                                  gtk_style_context_get_state(mpHScrollbarButtonStyle),
-                                  "min-height", &slider_width,
-                                  "min-width", &stepper_size, nullptr);
-        }
-        else
-        {
-            QuerySize(mpVScrollbarStyle, aSize);
-            QuerySize(mpVScrollbarContentsStyle, aSize);
-            QuerySize(mpVScrollbarTroughStyle, aSize);
-            QuerySize(mpVScrollbarSliderStyle, aSize);
-            slider_side = aSize.Width();
-            gtk_style_context_get(mpVScrollbarButtonStyle,
-                                  gtk_style_context_get_state(mpVScrollbarButtonStyle),
-                                  "min-width", &slider_width,
-                                  "min-height", &stepper_size, nullptr);
-        }
-
-        gboolean has_forward;
-        gboolean has_forward2;
-        gboolean has_backward;
-        gboolean has_backward2;
-
-        gtk_style_context_get_style( context,
-                                     "has-forward-stepper", &has_forward,
-                                     "has-secondary-forward-stepper", &has_forward2,
-                                     "has-backward-stepper", &has_backward,
-                                     "has-secondary-backward-stepper", &has_backward2, nullptr );
-
-        if ( nPart == ControlPart::DrawBackgroundHorz )
-        {
-            // Center vertically in the track
-            scrollbarRect.Move( 0, (scrollbarRect.GetHeight() - slider_side) / 2 );
-            scrollbarRect.SetSize( Size( scrollbarRect.GetWidth(), slider_side ) );
-            thumbRect.Move( 0, (scrollbarRect.GetHeight() - slider_side) / 2 );
-            thumbRect.SetSize( Size( thumbRect.GetWidth(), slider_side ) );
-
-            scrollbarOrientation = GTK_ORIENTATION_HORIZONTAL;
-            arrow1Angle = G_PI * 3 / 2;
-            arrow2Angle = G_PI / 2;
-
-            if ( has_backward )
-            {
-                button12BoundRect.Move( stepper_size,
-                                        (scrollbarRect.GetHeight() - slider_width) / 2 );
-            }
-
-            button11BoundRect.Move( 0, (scrollbarRect.GetHeight() - slider_width) / 2 );
-            button11BoundRect.SetSize( Size( stepper_size, slider_width ) );
-            button12BoundRect.SetSize( Size( stepper_size, slider_width ) );
-
-            if ( has_backward2 )
-            {
-                button22BoundRect.Move( stepper_size, (scrollbarRect.GetHeight() - slider_width) / 2 );
-                button21BoundRect.Move( 0, (scrollbarRect.GetHeight() - slider_width) / 2 );
-            }
-            else
-            {
-                button22BoundRect.Move( 0, (scrollbarRect.GetHeight() - slider_width) / 2 );
-            }
-
-            button21BoundRect.SetSize( Size( stepper_size, slider_width ) );
-            button22BoundRect.SetSize( Size( stepper_size, slider_width ) );
-        }
-        else
-        {
-            // Center horizontally in the track
-            scrollbarRect.Move( (scrollbarRect.GetWidth() - slider_side) / 2, 0 );
-            scrollbarRect.SetSize( Size( slider_side, scrollbarRect.GetHeight() ) );
-            thumbRect.Move( (scrollbarRect.GetWidth() - slider_side) / 2, 0 );
-            thumbRect.SetSize( Size( slider_side, thumbRect.GetHeight() ) );
-
-            scrollbarOrientation = GTK_ORIENTATION_VERTICAL;
-            arrow1Angle = 0;
-            arrow2Angle = G_PI;
-
-            if ( has_backward )
-            {
-                button12BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2,
-                                        stepper_size );
-            }
-            button11BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, 0 );
-            button11BoundRect.SetSize( Size( slider_width, stepper_size ) );
-            button12BoundRect.SetSize( Size( slider_width, stepper_size ) );
-
-            if ( has_backward2 )
-            {
-                button22BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, stepper_size );
-                button21BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, 0 );
-            }
-            else
-            {
-                button22BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, 0 );
-            }
-
-            button21BoundRect.SetSize( Size( slider_width, stepper_size ) );
-            button22BoundRect.SetSize( Size( slider_width, stepper_size ) );
-        }
-
-        bool has_slider = !thumbRect.IsEmpty();
-
-        // ----------------- CONTENTS
-        GtkStyleContext* pScrollbarContentsStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
-                                                  mpVScrollbarContentsStyle : mpHScrollbarContentsStyle;
-
-        gtk_render_background(gtk_widget_get_style_context(gCacheWindow), cr, 0, 0,
-                              scrollbarRect.GetWidth(), scrollbarRect.GetHeight() );
-
-        gtk_render_background(context, cr, 0, 0,
-                              scrollbarRect.GetWidth(), scrollbarRect.GetHeight() );
-        gtk_render_frame(context, cr, 0, 0,
-                         scrollbarRect.GetWidth(), scrollbarRect.GetHeight() );
-
-        gtk_render_background(pScrollbarContentsStyle, cr, 0, 0,
-                              scrollbarRect.GetWidth(), scrollbarRect.GetHeight() );
-        gtk_render_frame(pScrollbarContentsStyle, cr, 0, 0,
-                         scrollbarRect.GetWidth(), scrollbarRect.GetHeight() );
-
-        bool backwardButtonInsensitive =
-            rScrollbarVal.mnCur == rScrollbarVal.mnMin;
-        bool forwardButtonInsensitive = rScrollbarVal.mnMax == 0 ||
-            rScrollbarVal.mnCur + rScrollbarVal.mnVisibleSize >= rScrollbarVal.mnMax;
-
-        // ----------------- BUTTON 1
-        if ( has_backward )
-        {
-            stateFlags = NWConvertVCLStateToGTKState(rScrollbarVal.mnButton1State);
-            if ( backwardButtonInsensitive )
-                stateFlags = GTK_STATE_FLAG_INSENSITIVE;
-
-            GtkStyleContext* pScrollbarButtonStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
-                                                     mpVScrollbarButtonStyle : mpHScrollbarButtonStyle;
-
-            gtk_style_context_set_state(pScrollbarButtonStyle, stateFlags);
-
-            gtk_render_background(pScrollbarButtonStyle, cr,
-                                  button11BoundRect.Left(), button11BoundRect.Top(),
-                                  button11BoundRect.GetWidth(), button11BoundRect.GetHeight() );
-            gtk_render_frame(pScrollbarButtonStyle, cr,
-                             button11BoundRect.Left(), button11BoundRect.Top(),
-                             button11BoundRect.GetWidth(), button11BoundRect.GetHeight() );
-
-            // ----------------- ARROW 1
-            NWCalcArrowRect( button11BoundRect, arrowRect );
-            gtk_render_arrow(pScrollbarButtonStyle, cr,
-                             arrow1Angle,
-                             arrowRect.Left(), arrowRect.Top(),
-                             MIN(arrowRect.GetWidth(), arrowRect.GetHeight()) );
-        }
-        if ( has_forward2 )
-        {
-            stateFlags = NWConvertVCLStateToGTKState(rScrollbarVal.mnButton2State);
-            if ( forwardButtonInsensitive )
-                stateFlags = GTK_STATE_FLAG_INSENSITIVE;
-
-            GtkStyleContext* pScrollbarButtonStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
-                                                     mpVScrollbarButtonStyle : mpHScrollbarButtonStyle;
-
-            gtk_style_context_set_state(pScrollbarButtonStyle, stateFlags);
-
-            gtk_render_background(pScrollbarButtonStyle, cr,
-                                  button12BoundRect.Left(), button12BoundRect.Top(),
-                                  button12BoundRect.GetWidth(), button12BoundRect.GetHeight() );
-            gtk_render_frame(pScrollbarButtonStyle, cr,
-                             button12BoundRect.Left(), button12BoundRect.Top(),
-                             button12BoundRect.GetWidth(), button12BoundRect.GetHeight() );
-
-            // ----------------- ARROW 1
-            NWCalcArrowRect( button12BoundRect, arrowRect );
-            gtk_render_arrow(pScrollbarButtonStyle, cr,
-                             arrow2Angle,
-                             arrowRect.Left(), arrowRect.Top(),
-                             MIN(arrowRect.GetWidth(), arrowRect.GetHeight()) );
-        }
-        // ----------------- BUTTON 2
-
-        if ( has_forward )
-        {
-            stateFlags = NWConvertVCLStateToGTKState(rScrollbarVal.mnButton2State);
-            if ( forwardButtonInsensitive )
-                stateFlags = GTK_STATE_FLAG_INSENSITIVE;
-
-            GtkStyleContext* pScrollbarButtonStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
-                                                     mpVScrollbarButtonStyle : mpHScrollbarButtonStyle;
-
-            gtk_style_context_set_state(pScrollbarButtonStyle, stateFlags);
-
-            gtk_render_background(pScrollbarButtonStyle, cr,
-                           button22BoundRect.Left(), button22BoundRect.Top(),
-                           button22BoundRect.GetWidth(), button22BoundRect.GetHeight() );
-            gtk_render_frame(pScrollbarButtonStyle, cr,
-                           button22BoundRect.Left(), button22BoundRect.Top(),
-                           button22BoundRect.GetWidth(), button22BoundRect.GetHeight() );
-
-            // ----------------- ARROW 2
-            NWCalcArrowRect( button22BoundRect, arrowRect );
-            gtk_render_arrow(pScrollbarButtonStyle, cr,
-                             arrow2Angle,
-                             arrowRect.Left(), arrowRect.Top(),
-                             MIN(arrowRect.GetWidth(), arrowRect.GetHeight()) );
-        }
-
-        if ( has_backward2 )
-        {
-            stateFlags = NWConvertVCLStateToGTKState(rScrollbarVal.mnButton1State);
-            if ( backwardButtonInsensitive )
-                stateFlags = GTK_STATE_FLAG_INSENSITIVE;
-
-            GtkStyleContext* pScrollbarButtonStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
-                                                     mpVScrollbarButtonStyle : mpHScrollbarButtonStyle;
-
-            gtk_style_context_set_state(pScrollbarButtonStyle, stateFlags);
-
-            gtk_render_background(pScrollbarButtonStyle, cr,
-                                  button21BoundRect.Left(), button21BoundRect.Top(),
-                                  button21BoundRect.GetWidth(), button21BoundRect.GetHeight() );
-            gtk_render_frame(pScrollbarButtonStyle, cr,
-                             button21BoundRect.Left(), button21BoundRect.Top(),
-                             button21BoundRect.GetWidth(), button21BoundRect.GetHeight() );
-
-            // ----------------- ARROW 2
-            NWCalcArrowRect( button21BoundRect, arrowRect );
-            gtk_render_arrow(pScrollbarButtonStyle, cr,
-                             arrow1Angle,
-                             arrowRect.Left(), arrowRect.Top(),
-                             MIN(arrowRect.GetWidth(), arrowRect.GetHeight()) );
-        }
-
-        // ----------------- TROUGH
-        // trackrect matches that of ScrollBar::ImplCalc
-        tools::Rectangle aTrackRect(Point(0, 0), scrollbarRect.GetSize());
-        if (nPart == ControlPart::DrawBackgroundHorz)
-        {
-            tools::Rectangle aBtn1Rect = NWGetScrollButtonRect(ControlPart::ButtonLeft, aTrackRect);
-            tools::Rectangle aBtn2Rect = NWGetScrollButtonRect(ControlPart::ButtonRight, aTrackRect);
-            if (!aBtn1Rect.IsWidthEmpty())
-                aTrackRect.SetLeft( aBtn1Rect.Right() );
-            if (!aBtn2Rect.IsWidthEmpty())
-                aTrackRect.SetRight( aBtn2Rect.Left() );
-        }
-        else
-        {
-            tools::Rectangle aBtn1Rect = NWGetScrollButtonRect(ControlPart::ButtonUp, aTrackRect);
-            tools::Rectangle aBtn2Rect = NWGetScrollButtonRect(ControlPart::ButtonDown, aTrackRect);
-            if (!aBtn1Rect.IsHeightEmpty())
-                aTrackRect.SetTop( aBtn1Rect.Bottom() + 1 );
-            if (!aBtn2Rect.IsHeightEmpty())
-                aTrackRect.SetBottom( aBtn2Rect.Top() );
-        }
-
-        GtkStyleContext* pScrollbarTroughStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
-                                                  mpVScrollbarTroughStyle : mpHScrollbarTroughStyle;
-        gtk_render_background(pScrollbarTroughStyle, cr, aTrackRect.Left(), aTrackRect.Top(),
-                              aTrackRect.GetWidth(), aTrackRect.GetHeight() );
-        gtk_render_frame(pScrollbarTroughStyle, cr, aTrackRect.Left(), aTrackRect.Top(),
-                         aTrackRect.GetWidth(), aTrackRect.GetHeight() );
-
-        // ----------------- THUMB
-        if ( has_slider )
-        {
-            stateFlags = NWConvertVCLStateToGTKState(rScrollbarVal.mnThumbState);
-            if ( rScrollbarVal.mnThumbState & ControlState::PRESSED )
-                stateFlags = static_cast<GtkStateFlags>(stateFlags | GTK_STATE_FLAG_PRELIGHT);
-
-            GtkStyleContext* pScrollbarSliderStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
-                                                      mpVScrollbarSliderStyle : mpHScrollbarSliderStyle;
-
-            gtk_style_context_set_state(pScrollbarSliderStyle, stateFlags);
-
-            GtkBorder margin;
-            gtk_style_context_get_margin(pScrollbarSliderStyle, stateFlags, &margin);
-
-            gtk_render_background(pScrollbarSliderStyle, cr,
-                              thumbRect.Left() + margin.left, thumbRect.Top() + margin.top,
-                              thumbRect.GetWidth() - margin.left - margin.right,
-                              thumbRect.GetHeight() - margin.top - margin.bottom);
-
-            gtk_render_frame(pScrollbarSliderStyle, cr,
-                              thumbRect.Left() + margin.left, thumbRect.Top() + margin.top,
-                              thumbRect.GetWidth() - margin.left - margin.right,
-                              thumbRect.GetHeight() - margin.top - margin.bottom);
-        }
-
-        return;
-    }
-
-    OSL_ASSERT( rValue.getType() == ControlType::Scrollbar );
+    assert(rValue.getType() == ControlType::Scrollbar);
     const ScrollbarValue& rScrollbarVal = static_cast<const ScrollbarValue&>(rValue);
     tools::Rectangle        scrollbarRect;
     GtkStateFlags    stateFlags;
@@ -800,7 +413,6 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
     tools::Rectangle        arrowRect;
     gint            slider_width = 0;
     gint            stepper_size = 0;
-    gint            trough_border = 0;
 
     // make controlvalue rectangles relative to area
     thumbRect.Move( -rControlRectangle.Left(), -rControlRectangle.Top() );
@@ -811,17 +423,36 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
 
     // Find the overall bounding rect of the control
     scrollbarRect = rControlRectangle;
-    scrollbarRect.SetSize( Size( scrollbarRect.GetWidth() + 1,
-                                 scrollbarRect.GetHeight() + 1 ) );
-
-    if ( (scrollbarRect.GetWidth() <= 1) || (scrollbarRect.GetHeight() <= 1) )
+    if (scrollbarRect.IsEmpty())
         return;
 
-    // Grab some button style attributes
-    gtk_style_context_get_style( context,
-                                 "slider_width", &slider_width,
-                                 "stepper_size", &stepper_size,
-                                 "trough_border", &trough_border, nullptr );
+    gint slider_side;
+    Size aSize;
+    if (nPart == ControlPart::DrawBackgroundHorz)
+    {
+        QuerySize(mpHScrollbarStyle, aSize);
+        QuerySize(mpHScrollbarContentsStyle, aSize);
+        QuerySize(mpHScrollbarTroughStyle, aSize);
+        QuerySize(mpHScrollbarSliderStyle, aSize);
+        slider_side = aSize.Height();
+        gtk_style_context_get(mpHScrollbarButtonStyle,
+                              gtk_style_context_get_state(mpHScrollbarButtonStyle),
+                              "min-height", &slider_width,
+                              "min-width", &stepper_size, nullptr);
+    }
+    else
+    {
+        QuerySize(mpVScrollbarStyle, aSize);
+        QuerySize(mpVScrollbarContentsStyle, aSize);
+        QuerySize(mpVScrollbarTroughStyle, aSize);
+        QuerySize(mpVScrollbarSliderStyle, aSize);
+        slider_side = aSize.Width();
+        gtk_style_context_get(mpVScrollbarButtonStyle,
+                              gtk_style_context_get_state(mpVScrollbarButtonStyle),
+                              "min-width", &slider_width,
+                              "min-height", &stepper_size, nullptr);
+    }
+
     gboolean has_forward;
     gboolean has_forward2;
     gboolean has_backward;
@@ -832,13 +463,14 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
                                  "has-secondary-forward-stepper", &has_forward2,
                                  "has-backward-stepper", &has_backward,
                                  "has-secondary-backward-stepper", &has_backward2, nullptr );
-    gint magic = trough_border ? 1 : 0;
-    gint slider_side = slider_width + (trough_border * 2);
 
     if ( nPart == ControlPart::DrawBackgroundHorz )
     {
+        // Center vertically in the track
         scrollbarRect.Move( 0, (scrollbarRect.GetHeight() - slider_side) / 2 );
         scrollbarRect.SetSize( Size( scrollbarRect.GetWidth(), slider_side ) );
+        thumbRect.Move( 0, (scrollbarRect.GetHeight() - slider_side) / 2 );
+        thumbRect.SetSize( Size( thumbRect.GetWidth(), slider_side ) );
 
         scrollbarOrientation = GTK_ORIENTATION_HORIZONTAL;
         arrow1Angle = G_PI * 3 / 2;
@@ -846,39 +478,34 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
 
         if ( has_backward )
         {
-            button12BoundRect.Move( stepper_size - trough_border,
+            button12BoundRect.Move( stepper_size,
                                     (scrollbarRect.GetHeight() - slider_width) / 2 );
         }
 
-        button11BoundRect.Move( trough_border, (scrollbarRect.GetHeight() - slider_width) / 2 );
+        button11BoundRect.Move( 0, (scrollbarRect.GetHeight() - slider_width) / 2 );
         button11BoundRect.SetSize( Size( stepper_size, slider_width ) );
         button12BoundRect.SetSize( Size( stepper_size, slider_width ) );
 
         if ( has_backward2 )
         {
-            button22BoundRect.Move( stepper_size+(trough_border+1)/2, (scrollbarRect.GetHeight() - slider_width) / 2 );
-            button21BoundRect.Move( (trough_border+1)/2, (scrollbarRect.GetHeight() - slider_width) / 2 );
+            button22BoundRect.Move( stepper_size, (scrollbarRect.GetHeight() - slider_width) / 2 );
+            button21BoundRect.Move( 0, (scrollbarRect.GetHeight() - slider_width) / 2 );
         }
         else
         {
-            button22BoundRect.Move( (trough_border+1)/2, (scrollbarRect.GetHeight() - slider_width) / 2 );
+            button22BoundRect.Move( 0, (scrollbarRect.GetHeight() - slider_width) / 2 );
         }
 
         button21BoundRect.SetSize( Size( stepper_size, slider_width ) );
         button22BoundRect.SetSize( Size( stepper_size, slider_width ) );
-
-        thumbRect.SetBottom( thumbRect.Top() + slider_width - 1 );
-        // Make sure the thumb is at least the default width (so we don't get tiny thumbs),
-        // but if the VCL gives us a size smaller than the theme's default thumb size,
-        // honor the VCL size
-        thumbRect.AdjustRight(magic );
-        // Center vertically in the track
-        thumbRect.Move( 0, (scrollbarRect.GetHeight() - slider_width) / 2 );
     }
     else
     {
+        // Center horizontally in the track
         scrollbarRect.Move( (scrollbarRect.GetWidth() - slider_side) / 2, 0 );
         scrollbarRect.SetSize( Size( slider_side, scrollbarRect.GetHeight() ) );
+        thumbRect.Move( (scrollbarRect.GetWidth() - slider_side) / 2, 0 );
+        thumbRect.SetSize( Size( slider_side, thumbRect.GetHeight() ) );
 
         scrollbarOrientation = GTK_ORIENTATION_VERTICAL;
         arrow1Angle = 0;
@@ -887,30 +514,24 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
         if ( has_backward )
         {
             button12BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2,
-                                    stepper_size + trough_border );
+                                    stepper_size );
         }
-        button11BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, trough_border );
+        button11BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, 0 );
         button11BoundRect.SetSize( Size( slider_width, stepper_size ) );
         button12BoundRect.SetSize( Size( slider_width, stepper_size ) );
 
         if ( has_backward2 )
         {
-            button22BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, stepper_size+(trough_border+1)/2 );
-            button21BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, (trough_border+1)/2 );
+            button22BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, stepper_size );
+            button21BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, 0 );
         }
         else
         {
-            button22BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, (trough_border+1)/2 );
+            button22BoundRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, 0 );
         }
 
         button21BoundRect.SetSize( Size( slider_width, stepper_size ) );
         button22BoundRect.SetSize( Size( slider_width, stepper_size ) );
-
-        thumbRect.SetRight( thumbRect.Left() + slider_width - 1 );
-
-        thumbRect.AdjustBottom(magic );
-        // Center horizontally in the track
-        thumbRect.Move( (scrollbarRect.GetWidth() - slider_width) / 2, 0 );
     }
 
     bool has_slider = !thumbRect.IsEmpty();
@@ -932,40 +553,6 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
     gtk_render_frame(pScrollbarContentsStyle, cr, 0, 0,
                      scrollbarRect.GetWidth(), scrollbarRect.GetHeight() );
 
-    // ----------------- TROUGH
-    GtkStyleContext* pScrollbarTroughStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
-                                              mpVScrollbarTroughStyle : mpHScrollbarTroughStyle;
-    gtk_render_background(pScrollbarTroughStyle, cr, 0, 0,
-                          scrollbarRect.GetWidth(), scrollbarRect.GetHeight() );
-    gtk_render_frame(pScrollbarTroughStyle, cr, 0, 0,
-                     scrollbarRect.GetWidth(), scrollbarRect.GetHeight() );
-
-    // ----------------- THUMB
-    if ( has_slider )
-    {
-        stateFlags = NWConvertVCLStateToGTKState(rScrollbarVal.mnThumbState);
-        if ( rScrollbarVal.mnThumbState & ControlState::PRESSED )
-            stateFlags = static_cast<GtkStateFlags>(stateFlags | GTK_STATE_FLAG_PRELIGHT);
-
-        GtkStyleContext* pScrollbarSliderStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
-                                                  mpVScrollbarSliderStyle : mpHScrollbarSliderStyle;
-
-        gtk_style_context_set_state(pScrollbarSliderStyle, stateFlags);
-
-        GtkBorder margin;
-        gtk_style_context_get_margin(pScrollbarSliderStyle, stateFlags, &margin);
-
-        gtk_render_background(pScrollbarSliderStyle, cr,
-                          thumbRect.Left() + margin.left, thumbRect.Top() + margin.top,
-                          thumbRect.GetWidth() - margin.left - margin.right,
-                          thumbRect.GetHeight() - margin.top - margin.bottom);
-
-        gtk_render_frame(pScrollbarSliderStyle, cr,
-                          thumbRect.Left() + margin.left, thumbRect.Top() + margin.top,
-                          thumbRect.GetWidth() - margin.left - margin.right,
-                          thumbRect.GetHeight() - margin.top - margin.bottom);
-    }
-
     bool backwardButtonInsensitive =
         rScrollbarVal.mnCur == rScrollbarVal.mnMin;
     bool forwardButtonInsensitive = rScrollbarVal.mnMax == 0 ||
@@ -1023,6 +610,33 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
                          MIN(arrowRect.GetWidth(), arrowRect.GetHeight()) );
     }
     // ----------------- BUTTON 2
+
+    if ( has_forward )
+    {
+        stateFlags = NWConvertVCLStateToGTKState(rScrollbarVal.mnButton2State);
+        if ( forwardButtonInsensitive )
+            stateFlags = GTK_STATE_FLAG_INSENSITIVE;
+
+        GtkStyleContext* pScrollbarButtonStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
+                                                 mpVScrollbarButtonStyle : mpHScrollbarButtonStyle;
+
+        gtk_style_context_set_state(pScrollbarButtonStyle, stateFlags);
+
+        gtk_render_background(pScrollbarButtonStyle, cr,
+                       button22BoundRect.Left(), button22BoundRect.Top(),
+                       button22BoundRect.GetWidth(), button22BoundRect.GetHeight() );
+        gtk_render_frame(pScrollbarButtonStyle, cr,
+                       button22BoundRect.Left(), button22BoundRect.Top(),
+                       button22BoundRect.GetWidth(), button22BoundRect.GetHeight() );
+
+        // ----------------- ARROW 2
+        NWCalcArrowRect( button22BoundRect, arrowRect );
+        gtk_render_arrow(pScrollbarButtonStyle, cr,
+                         arrow2Angle,
+                         arrowRect.Left(), arrowRect.Top(),
+                         MIN(arrowRect.GetWidth(), arrowRect.GetHeight()) );
+    }
+
     if ( has_backward2 )
     {
         stateFlags = NWConvertVCLStateToGTKState(rScrollbarVal.mnButton1State);
@@ -1048,31 +662,61 @@ void GtkSalGraphics::PaintScrollbar(GtkStyleContext *context,
                          arrowRect.Left(), arrowRect.Top(),
                          MIN(arrowRect.GetWidth(), arrowRect.GetHeight()) );
     }
-    if ( !has_forward )
-        return;
 
-    stateFlags = NWConvertVCLStateToGTKState(rScrollbarVal.mnButton2State);
-    if ( forwardButtonInsensitive )
-        stateFlags = GTK_STATE_FLAG_INSENSITIVE;
+    // ----------------- TROUGH
+    // trackrect matches that of ScrollBar::ImplCalc
+    tools::Rectangle aTrackRect(Point(0, 0), scrollbarRect.GetSize());
+    if (nPart == ControlPart::DrawBackgroundHorz)
+    {
+        tools::Rectangle aBtn1Rect = NWGetScrollButtonRect(ControlPart::ButtonLeft, aTrackRect);
+        tools::Rectangle aBtn2Rect = NWGetScrollButtonRect(ControlPart::ButtonRight, aTrackRect);
+        if (!aBtn1Rect.IsWidthEmpty())
+            aTrackRect.SetLeft( aBtn1Rect.Right() );
+        if (!aBtn2Rect.IsWidthEmpty())
+            aTrackRect.SetRight( aBtn2Rect.Left() );
+    }
+    else
+    {
+        tools::Rectangle aBtn1Rect = NWGetScrollButtonRect(ControlPart::ButtonUp, aTrackRect);
+        tools::Rectangle aBtn2Rect = NWGetScrollButtonRect(ControlPart::ButtonDown, aTrackRect);
+        if (!aBtn1Rect.IsHeightEmpty())
+            aTrackRect.SetTop( aBtn1Rect.Bottom() + 1 );
+        if (!aBtn2Rect.IsHeightEmpty())
+            aTrackRect.SetBottom( aBtn2Rect.Top() );
+    }
+
+    GtkStyleContext* pScrollbarTroughStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
+                                              mpVScrollbarTroughStyle : mpHScrollbarTroughStyle;
+    gtk_render_background(pScrollbarTroughStyle, cr, aTrackRect.Left(), aTrackRect.Top(),
+                          aTrackRect.GetWidth(), aTrackRect.GetHeight() );
+    gtk_render_frame(pScrollbarTroughStyle, cr, aTrackRect.Left(), aTrackRect.Top(),
+                     aTrackRect.GetWidth(), aTrackRect.GetHeight() );
+
+    // ----------------- THUMB
+    if ( has_slider )
+    {
+        stateFlags = NWConvertVCLStateToGTKState(rScrollbarVal.mnThumbState);
+        if ( rScrollbarVal.mnThumbState & ControlState::PRESSED )
+            stateFlags = static_cast<GtkStateFlags>(stateFlags | GTK_STATE_FLAG_PRELIGHT);
+
+        GtkStyleContext* pScrollbarSliderStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
+                                                  mpVScrollbarSliderStyle : mpHScrollbarSliderStyle;
 
-    GtkStyleContext* pScrollbarButtonStyle = scrollbarOrientation == GTK_ORIENTATION_VERTICAL ?
-                                             mpVScrollbarButtonStyle : mpHScrollbarButtonStyle;
+        gtk_style_context_set_state(pScrollbarSliderStyle, stateFlags);
 
-    gtk_style_context_set_state(pScrollbarButtonStyle, stateFlags);
+        GtkBorder margin;
+        gtk_style_context_get_margin(pScrollbarSliderStyle, stateFlags, &margin);
 
-    gtk_render_background(pScrollbarButtonStyle, cr,
-                   button22BoundRect.Left(), button22BoundRect.Top(),
-                   button22BoundRect.GetWidth(), button22BoundRect.GetHeight() );
-    gtk_render_frame(pScrollbarButtonStyle, cr,
-                   button22BoundRect.Left(), button22BoundRect.Top(),
-                   button22BoundRect.GetWidth(), button22BoundRect.GetHeight() );
+        gtk_render_background(pScrollbarSliderStyle, cr,
+                          thumbRect.Left() + margin.left, thumbRect.Top() + margin.top,
+                          thumbRect.GetWidth() - margin.left - margin.right,
+                          thumbRect.GetHeight() - margin.top - margin.bottom);
 
-    // ----------------- ARROW 2
-    NWCalcArrowRect( button22BoundRect, arrowRect );
-    gtk_render_arrow(pScrollbarButtonStyle, cr,
-                     arrow2Angle,
-                     arrowRect.Left(), arrowRect.Top(),
-                     MIN(arrowRect.GetWidth(), arrowRect.GetHeight()) );
+        gtk_render_frame(pScrollbarSliderStyle, cr,
+                          thumbRect.Left() + margin.left, thumbRect.Top() + margin.top,
+                          thumbRect.GetWidth() - margin.left - margin.right,
+                          thumbRect.GetHeight() - margin.top - margin.bottom);
+    }
 }
 
 void GtkSalGraphics::PaintOneSpinButton( GtkStyleContext *context,
@@ -1191,16 +835,9 @@ tools::Rectangle GtkSalGraphics::NWGetComboBoxButtonRect(ControlType nType,
         gtk_style_context_get_padding(mpButtonStyle, gtk_style_context_get_state(mpButtonStyle), &padding);
 
     gint nArrowWidth = FALLBACK_ARROW_SIZE;
-    if (gtk_check_version(3, 20, 0) == nullptr)
-    {
-        gtk_style_context_get(mpComboboxButtonArrowStyle,
-            gtk_style_context_get_state(mpComboboxButtonArrowStyle),
-            "min-width", &nArrowWidth, nullptr);
-    }
-    else
-    {
-        nArrowWidth = nArrowWidth * gtk_style_context_get_scale (mpComboboxButtonArrowStyle);
-    }
+    gtk_style_context_get(mpComboboxButtonArrowStyle,
+        gtk_style_context_get_state(mpComboboxButtonArrowStyle),
+        "min-width", &nArrowWidth, nullptr);
 
     gint nButtonWidth = nArrowWidth + padding.left + padding.right;
     if( nPart == ControlPart::ButtonDown )
@@ -1253,33 +890,17 @@ void GtkSalGraphics::PaintCombobox( GtkStateFlags flags, cairo_t *cr,
         aEditBoxRect.SetPos( Point( areaRect.Left() + buttonRect.GetWidth(), areaRect.Top() ) );
 
     gint arrow_width = FALLBACK_ARROW_SIZE, arrow_height = FALLBACK_ARROW_SIZE;
-    if (gtk_check_version(3, 20, 0) == nullptr)
+    if (nType == ControlType::Combobox)
     {
-        if (nType == ControlType::Combobox)
-        {
-            gtk_style_context_get(mpComboboxButtonArrowStyle,
-                gtk_style_context_get_state(mpComboboxButtonArrowStyle),
-                "min-width", &arrow_width, "min-height", &arrow_height, nullptr);
-        }
-        else if (nType == ControlType::Listbox)
-        {
-            gtk_style_context_get(mpListboxButtonArrowStyle,
-                gtk_style_context_get_state(mpListboxButtonArrowStyle),
-                "min-width", &arrow_width, "min-height", &arrow_height, nullptr);
-        }
+        gtk_style_context_get(mpComboboxButtonArrowStyle,
+            gtk_style_context_get_state(mpComboboxButtonArrowStyle),
+            "min-width", &arrow_width, "min-height", &arrow_height, nullptr);
     }
-    else
+    else if (nType == ControlType::Listbox)
     {
-        if (nType == ControlType::Combobox)
-        {
-            arrow_width = arrow_width * gtk_style_context_get_scale (mpComboboxButtonArrowStyle);
-            arrow_height = arrow_height * gtk_style_context_get_scale (mpComboboxButtonArrowStyle);
-        }
-        else if (nType == ControlType::Listbox)
-        {
-            arrow_width = arrow_width * gtk_style_context_get_scale (mpListboxButtonArrowStyle);
-            arrow_height = arrow_height * gtk_style_context_get_scale (mpListboxButtonArrowStyle);
-        }
+        gtk_style_context_get(mpListboxButtonArrowStyle,
+            gtk_style_context_get_state(mpListboxButtonArrowStyle),
+            "min-width", &arrow_width, "min-height", &arrow_height, nullptr);
     }
 
     arrowRect.SetSize(Size(arrow_width, arrow_height));
@@ -1347,493 +968,70 @@ void GtkSalGraphics::PaintCombobox( GtkStateFlags flags, cairo_t *cr,
     }
 }
 
-static void appendComboEntry(GtkWidgetPath* pSiblingsPath, gtk_widget_path_iter_set_object_nameFunc set_object_name)
+static void appendComboEntry(GtkWidgetPath* pSiblingsPath)
 {
     gtk_widget_path_append_type(pSiblingsPath, GTK_TYPE_ENTRY);
-    set_object_name(pSiblingsPath, -1, "entry");
+    gtk_widget_path_iter_set_object_name(pSiblingsPath, -1, "entry");
     gtk_widget_path_iter_add_class(pSiblingsPath, -1, "combo");
 }
 
-static void appendComboButton(GtkWidgetPath* pSiblingsPath, gtk_widget_path_iter_set_object_nameFunc set_object_name)
+static void appendComboButton(GtkWidgetPath* pSiblingsPath)
 {
     gtk_widget_path_append_type(pSiblingsPath, GTK_TYPE_BUTTON);
-    set_object_name(pSiblingsPath, -1, "button");
+    gtk_widget_path_iter_set_object_name(pSiblingsPath, -1, "button");
     gtk_widget_path_iter_add_class(pSiblingsPath, -1, "combo");
 }
 
-static GtkWidgetPath* buildLTRComboSiblingsPath(gtk_widget_path_iter_set_object_nameFunc set_object_name)
-{
-    GtkWidgetPath* pSiblingsPath = gtk_widget_path_new();
-
-    appendComboEntry(pSiblingsPath, set_object_name);
-    appendComboButton(pSiblingsPath, set_object_name);
-
-    return pSiblingsPath;
-}
-
-static GtkWidgetPath* buildRTLComboSiblingsPath(gtk_widget_path_iter_set_object_nameFunc set_object_name)
-{
-    GtkWidgetPath* pSiblingsPath = gtk_widget_path_new();
-
-    appendComboButton(pSiblingsPath, set_object_name);
-    appendComboEntry(pSiblingsPath, set_object_name);
-
-    return pSiblingsPath;
-}
-
-GtkStyleContext* GtkSalGraphics::makeContext(GtkWidgetPath *pPath, GtkStyleContext *pParent)
-{
-    GtkStyleContext* context = gtk_style_context_new();
-    gtk_style_context_set_screen(context, gtk_widget_get_screen(mpWindow));
-    gtk_style_context_set_path(context, pPath);
-    if (pParent == nullptr)
-    {
-        GtkWidget* pTopLevel = gtk_widget_get_toplevel(mpWindow);
-        GtkStyleContext* pStyle = gtk_widget_get_style_context(pTopLevel);
-        gtk_style_context_set_parent(context, pStyle);
-        gtk_style_context_set_scale (context, gtk_style_context_get_scale (pStyle));
-    }
-    else
-    {
-        gtk_style_context_set_parent(context, pParent);
-        gtk_style_context_set_scale (context, gtk_style_context_get_scale (pParent));
-    }
-    gtk_widget_path_unref(pPath);
-    return context;
-}
-
-GtkStyleContext* GtkSalGraphics::createNewContext(GtkControlPart ePart, gtk_widget_path_iter_set_object_nameFunc set_object_name)
-{
-    switch (ePart)
-    {
-        case GtkControlPart::ToplevelWindow:
-        {
-            GtkWidgetPath *path = gtk_widget_path_new();
-            gtk_widget_path_append_type(path, G_TYPE_NONE);
-            set_object_name(path, -1, "window");
-            gtk_widget_path_iter_add_class(path, -1, "background");
-            return makeContext(path, nullptr);
-        }
-        case GtkControlPart::Button:
-        {
-            GtkWidgetPath *path = gtk_widget_path_new();
-            gtk_widget_path_append_type(path, GTK_TYPE_BUTTON);
-            set_object_name(path, -1, "button");
-            return makeContext(path, nullptr);
-        }
-        case GtkControlPart::LinkButton:
-        {
-            GtkWidgetPath *path = gtk_widget_path_new();
-            gtk_widget_path_append_type(path, GTK_TYPE_BUTTON);
-            set_object_name(path, -1, "button");
-            gtk_widget_path_iter_add_class(path, -1, "link");
-            return makeContext(path, nullptr);
-        }
-        case GtkControlPart::CheckButton:
-        {
-            GtkWidgetPath *path = gtk_widget_path_new();
-            gtk_widget_path_append_type(path, GTK_TYPE_CHECK_BUTTON);
-            set_object_name(path, -1, "checkbutton");
-            return makeContext(path, nullptr);
-        }
-        case GtkControlPart::CheckButtonCheck:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpCheckButtonStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_CHECK_BUTTON);
-            set_object_name(path, -1, "check");
-            return makeContext(path, mpCheckButtonStyle);
-        }
-        case GtkControlPart::RadioButton:
-        {
-            GtkWidgetPath *path = gtk_widget_path_new();
-            gtk_widget_path_append_type(path, GTK_TYPE_RADIO_BUTTON);
-            set_object_name(path, -1, "radiobutton");
-            return makeContext(path, nullptr);
-        }
-        case GtkControlPart::RadioButtonRadio:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpRadioButtonStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_RADIO_BUTTON);
-            set_object_name(path, -1, "radio");
-            return makeContext(path, mpRadioButtonStyle);
-        }
-        case GtkControlPart::ComboboxBoxButtonBoxArrow:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpComboboxButtonBoxStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_RADIO_BUTTON);
-            gtk_widget_path_append_type(path, GTK_TYPE_BUTTON);
-            set_object_name(path, -1, "arrow");
-            return makeContext(path, mpComboboxButtonBoxStyle);
-        }
-        case GtkControlPart::ListboxBoxButtonBoxArrow:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpListboxButtonBoxStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_RADIO_BUTTON);
-            gtk_widget_path_append_type(path, GTK_TYPE_BUTTON);
-            set_object_name(path, -1, "arrow");
-            return makeContext(path, mpListboxButtonBoxStyle);
-        }
-        case GtkControlPart::Entry:
-        {
-            GtkWidgetPath *path = gtk_widget_path_new();
-            gtk_widget_path_append_type(path, GTK_TYPE_ENTRY);
-            set_object_name(path, -1, "entry");
-            return makeContext(path, nullptr);
-        }
-        case GtkControlPart::Combobox:
-        case GtkControlPart::Listbox:
-        {
-            GtkWidgetPath *path = gtk_widget_path_new();
-            gtk_widget_path_append_type(path, G_TYPE_NONE);
-            set_object_name(path, -1, "combobox");
-            return makeContext(path, nullptr);
-        }
-        case GtkControlPart::ComboboxBox:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpComboboxStyle));
-            gtk_widget_path_append_type(path, G_TYPE_NONE);
-            set_object_name(path, -1, "box");
-            gtk_widget_path_iter_add_class(path, -1, "horizontal");
-            gtk_widget_path_iter_add_class(path, -1, "linked");
-            return makeContext(path, mpComboboxStyle);
-        }
-        case GtkControlPart::ListboxBox:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpListboxStyle));
-            gtk_widget_path_append_type(path, G_TYPE_NONE);
-            set_object_name(path, -1, "box");
-            gtk_widget_path_iter_add_class(path, -1, "horizontal");
-            gtk_widget_path_iter_add_class(path, -1, "linked");
-            return makeContext(path, mpListboxStyle);
-        }
-        case GtkControlPart::ComboboxBoxEntry:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpComboboxBoxStyle));
-            GtkWidgetPath* pSiblingsPath;
-            if (AllSettings::GetLayoutRTL())
-            {
-                pSiblingsPath = buildRTLComboSiblingsPath(set_object_name);
-                gtk_widget_path_append_with_siblings(path, pSiblingsPath, 1);
-            }
-            else
-            {
-                pSiblingsPath = buildLTRComboSiblingsPath(set_object_name);
-                gtk_widget_path_append_with_siblings(path, pSiblingsPath, 0);
-            }
-            gtk_widget_path_unref(pSiblingsPath);
-            return makeContext(path, mpComboboxBoxStyle);
-        }
-        case GtkControlPart::ComboboxBoxButton:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpComboboxBoxStyle));
-            GtkWidgetPath* pSiblingsPath;
-            if (AllSettings::GetLayoutRTL())
-            {
-                pSiblingsPath = buildRTLComboSiblingsPath(set_object_name);
-                gtk_widget_path_append_with_siblings(path, pSiblingsPath, 0);
-            }
-            else
-            {
-                pSiblingsPath = buildLTRComboSiblingsPath(set_object_name);
-                gtk_widget_path_append_with_siblings(path, pSiblingsPath, 1);
-            }
-            gtk_widget_path_unref(pSiblingsPath);
-            return makeContext(path, mpComboboxBoxStyle);
-        }
-        case GtkControlPart::ListboxBoxButton:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpListboxBoxStyle));
-            GtkWidgetPath* pSiblingsPath = gtk_widget_path_new();
-
-            gtk_widget_path_append_type(pSiblingsPath, GTK_TYPE_BUTTON);
-            set_object_name(pSiblingsPath, -1, "button");
-            gtk_widget_path_iter_add_class(pSiblingsPath, -1, "combo");
-
-            gtk_widget_path_append_with_siblings(path, pSiblingsPath, 0);
-            gtk_widget_path_unref(pSiblingsPath);
-            return makeContext(path, mpListboxBoxStyle);
-        }
-        case GtkControlPart::ComboboxBoxButtonBox:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpComboboxButtonStyle));
-            gtk_widget_path_append_type(path, G_TYPE_NONE);
-            set_object_name(path, -1, "box");
-            gtk_widget_path_iter_add_class(path, -1, "horizontal");
-            return makeContext(path, mpComboboxButtonStyle);
-        }
-        case GtkControlPart::ListboxBoxButtonBox:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpListboxButtonStyle));
-            gtk_widget_path_append_type(path, G_TYPE_NONE);
-            set_object_name(path, -1, "box");
-            gtk_widget_path_iter_add_class(path, -1, "horizontal");
-            return makeContext(path, mpListboxButtonStyle);
-        }
-        case GtkControlPart::SpinButton:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpWindowStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_SPIN_BUTTON);
-            set_object_name(path, -1, "spinbutton");
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_HORIZONTAL);
-            return makeContext(path, mpWindowStyle);
-        }
-        case GtkControlPart::SpinButtonEntry:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpSpinStyle));
-            gtk_widget_path_append_type(path, G_TYPE_NONE);
-            set_object_name(path, -1, "entry");
-            return makeContext(path, mpSpinStyle);
-        }
-        case GtkControlPart::SpinButtonUpButton:
-        case GtkControlPart::SpinButtonDownButton:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpSpinStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_SPIN_BUTTON);
-            set_object_name(path, -1, "button");
-            gtk_widget_path_iter_add_class(path, -1, ePart == GtkControlPart::SpinButtonUpButton ? "up" : "down");
-            return makeContext(path, mpSpinStyle);
-        }
-        case GtkControlPart::ScrollbarVertical:
-        case GtkControlPart::ScrollbarHorizontal:
-        {
-            GtkWidgetPath *path = gtk_widget_path_new();
-            gtk_widget_path_append_type(path, GTK_TYPE_SCROLLBAR);
-            set_object_name(path, -1, "scrollbar");
-            gtk_widget_path_iter_add_class(path, -1, ePart == GtkControlPart::ScrollbarVertical ? "vertical" : "horizontal");
-            return makeContext(path, nullptr);
-        }
-        case GtkControlPart::ScrollbarVerticalContents:
-        case GtkControlPart::ScrollbarHorizontalContents:
-        {
-            GtkStyleContext *pParent =
-                (ePart == GtkControlPart::ScrollbarVerticalContents) ? mpVScrollbarStyle : mpHScrollbarStyle;
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(pParent));
-            gtk_widget_path_append_type(path, GTK_TYPE_SCROLLBAR);
-            set_object_name(path, -1, "contents");
-            return makeContext(path, pParent);
-        }
-        case GtkControlPart::ScrollbarVerticalTrough:
-        case GtkControlPart::ScrollbarHorizontalTrough:
-        {
-            GtkStyleContext *pParent =
-                (ePart == GtkControlPart::ScrollbarVerticalTrough) ? mpVScrollbarContentsStyle : mpHScrollbarContentsStyle;
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(pParent));
-            gtk_widget_path_append_type(path, GTK_TYPE_SCROLLBAR);
-            set_object_name(path, -1, "trough");
-            return makeContext(path, pParent);
-        }
-        case GtkControlPart::ScrollbarVerticalSlider:
-        case GtkControlPart::ScrollbarHorizontalSlider:
-        {
-            GtkStyleContext *pParent =
-                (ePart == GtkControlPart::ScrollbarVerticalSlider) ? mpVScrollbarTroughStyle : mpHScrollbarTroughStyle;
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(pParent));
-            gtk_widget_path_append_type(path, GTK_TYPE_SCROLLBAR);
-            set_object_name(path, -1, "slider");
-            return makeContext(path, pParent);
-        }
-        case GtkControlPart::ScrollbarVerticalButton:
-        case GtkControlPart::ScrollbarHorizontalButton:
-        {
-            GtkStyleContext *pParent =
-                (ePart == GtkControlPart::ScrollbarVerticalButton) ? mpVScrollbarStyle : mpHScrollbarStyle;
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(pParent));
-            gtk_widget_path_append_type(path, GTK_TYPE_SCROLLBAR);
-            set_object_name(path, -1, "button");
-            return makeContext(path, pParent);
-        }
-        case GtkControlPart::ProgressBar:
-        {
-            GtkWidgetPath *path = gtk_widget_path_new();
-            gtk_widget_path_append_type(path, GTK_TYPE_PROGRESS_BAR);
-            set_object_name(path, -1, "progressbar");
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_HORIZONTAL);
-            return makeContext(path, nullptr);
-        }
-        case GtkControlPart::ProgressBarTrough:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpProgressBarStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_PROGRESS_BAR);
-            set_object_name(path, -1, "trough");
-            return makeContext(path, mpProgressBarStyle);
-        }
-        case GtkControlPart::ProgressBarProgress:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpProgressBarTroughStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_PROGRESS_BAR);
-            set_object_name(path, -1, "progress");
-            return makeContext(path, mpProgressBarTroughStyle);
-        }
-        case GtkControlPart::Notebook:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpWindowStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_NOTEBOOK);
-            set_object_name(path, -1, "notebook");
-            return makeContext(path, mpWindowStyle);
-        }
-        case GtkControlPart::NotebookStack:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpNotebookStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_NOTEBOOK);
-            set_object_name(path, -1, "stack");
-            return makeContext(path, mpNotebookStyle);
-        }
-        case GtkControlPart::NotebookHeader:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpNotebookStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_NOTEBOOK);
-            set_object_name(path, -1, "header");
-            gtk_widget_path_iter_add_class(path, -1, "frame");
-            gtk_widget_path_iter_add_class(path, -1, "top");
-            return makeContext(path, mpNotebookStyle);
-        }
-        case GtkControlPart::NotebookHeaderTabs:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpNotebookHeaderStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_NOTEBOOK);
-            set_object_name(path, -1, "tabs");
-            gtk_widget_path_iter_add_class(path, -1, "top");
-            return makeContext(path, mpNotebookHeaderStyle);
-        }
-        case GtkControlPart::NotebookHeaderTabsTab:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpNotebookHeaderTabsStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_NOTEBOOK);
-            set_object_name(path, -1, "tab");
-            gtk_widget_path_iter_add_class(path, -1, "top");
-            return makeContext(path, mpNotebookHeaderTabsStyle);
-        }
-        case GtkControlPart::NotebookHeaderTabsTabLabel:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpNotebookHeaderTabsTabStyle));
-            gtk_widget_path_append_type(path, G_TYPE_NONE);
-            set_object_name(path, -1, "label");
-            return makeContext(path, mpNotebookHeaderTabsTabStyle);
-        }
-        case GtkControlPart::NotebookHeaderTabsTabActiveLabel:
-        case GtkControlPart::NotebookHeaderTabsTabHoverLabel:
-            return mpNotebookHeaderTabsTabLabelStyle;
-        case GtkControlPart::FrameBorder:
-        {
-            GtkWidgetPath *path = gtk_widget_path_new();
-            gtk_widget_path_append_type(path, GTK_TYPE_FRAME);
-            set_object_name(path, -1, "frame");
-            gtk_widget_path_iter_add_class(path, -1, "frame");
-            return makeContext(path, nullptr);
-        }
-        case GtkControlPart::MenuBar:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpWindowStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_MENU_BAR);
-            set_object_name(path, -1, "menubar");
-            return makeContext(path, mpWindowStyle);
-        }
-        case GtkControlPart::MenuBarItem:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpMenuBarStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_MENU_ITEM);
-            set_object_name(path, -1, "menuitem");
-            return makeContext(path, mpMenuBarStyle);
-        }
-        case GtkControlPart::MenuWindow:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpMenuBarItemStyle));
-            gtk_widget_path_append_type(path, G_TYPE_NONE);
-            set_object_name(path, -1, "window");
-            gtk_widget_path_iter_add_class(path, -1, "background");
-            gtk_widget_path_iter_add_class(path, -1, "popup");
-            return makeContext(path, mpMenuBarItemStyle);
-        }
-        case GtkControlPart::Menu:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpMenuWindowStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_MENU);
-            set_object_name(path, -1, "menu");
-            return makeContext(path, mpMenuWindowStyle);
-        }
-        case GtkControlPart::MenuItem:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpMenuStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_MENU_ITEM);
-            set_object_name(path, -1, "menuitem");
-            return makeContext(path, mpMenuStyle);
-        }
-        case GtkControlPart::MenuItemLabel:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpMenuItemStyle));
-            gtk_widget_path_append_type(path, G_TYPE_NONE);
-            set_object_name(path, -1, "label");
-            return makeContext(path, mpMenuItemStyle);
-        }
-        case GtkControlPart::MenuItemArrow:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpMenuItemStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_MENU_ITEM);
-            set_object_name(path, -1, "arrow");
-            return makeContext(path, mpMenuItemStyle);
-        }
-        case GtkControlPart::CheckMenuItem:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpMenuStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_CHECK_MENU_ITEM);
-            set_object_name(path, -1, "menuitem");
-            return makeContext(path, mpMenuStyle);
-        }
-        case GtkControlPart::CheckMenuItemCheck:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpCheckMenuItemStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_CHECK_MENU_ITEM);
-            set_object_name(path, -1, "check");
-            return makeContext(path, mpCheckMenuItemStyle);
-        }
-        case GtkControlPart::RadioMenuItem:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpMenuStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_RADIO_MENU_ITEM);
-            set_object_name(path, -1, "menuitem");
-            return makeContext(path, mpMenuStyle);
-        }
-        case GtkControlPart::RadioMenuItemRadio:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpRadioMenuItemStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_RADIO_MENU_ITEM);
-            set_object_name(path, -1, "radio");
-            return makeContext(path, mpRadioMenuItemStyle);
-        }
-        case GtkControlPart::SeparatorMenuItem:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpMenuStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_SEPARATOR_MENU_ITEM);
-            set_object_name(path, -1, "menuitem");
-            return makeContext(path, mpMenuStyle);
-        }
-        case GtkControlPart::SeparatorMenuItemSeparator:
-        {
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpSeparatorMenuItemStyle));
-            gtk_widget_path_append_type(path, GTK_TYPE_SEPARATOR_MENU_ITEM);
-            set_object_name(path, -1, "separator");
-            return makeContext(path, mpSeparatorMenuItemStyle);
-        }
-    }
-
-    return nullptr;
+static GtkWidgetPath* buildLTRComboSiblingsPath()
+{
+    GtkWidgetPath* pSiblingsPath = gtk_widget_path_new();
+
+    appendComboEntry(pSiblingsPath);
+    appendComboButton(pSiblingsPath);
+
+    return pSiblingsPath;
 }
 
-#ifndef GTK_STYLE_CLASS_POPUP
-#define GTK_STYLE_CLASS_POPUP "popup"
-#endif
-#ifndef GTK_STYLE_CLASS_LABEL
-#define GTK_STYLE_CLASS_LABEL "label"
-#endif
+static GtkWidgetPath* buildRTLComboSiblingsPath()
+{
+    GtkWidgetPath* pSiblingsPath = gtk_widget_path_new();
+
+    appendComboButton(pSiblingsPath);
+    appendComboEntry(pSiblingsPath);
+
+    return pSiblingsPath;
+}
+
+GtkStyleContext* GtkSalGraphics::makeContext(GtkWidgetPath *pPath, GtkStyleContext *pParent)
+{
+    GtkStyleContext* context = gtk_style_context_new();
+    gtk_style_context_set_screen(context, gtk_widget_get_screen(mpWindow));
+    gtk_style_context_set_path(context, pPath);
+    if (pParent == nullptr)
+    {
+        GtkWidget* pTopLevel = gtk_widget_get_toplevel(mpWindow);
+        GtkStyleContext* pStyle = gtk_widget_get_style_context(pTopLevel);
+        gtk_style_context_set_parent(context, pStyle);
+        gtk_style_context_set_scale (context, gtk_style_context_get_scale (pStyle));
+    }
+    else
+    {
+        gtk_style_context_set_parent(context, pParent);
+        gtk_style_context_set_scale (context, gtk_style_context_get_scale (pParent));
+    }
+    gtk_widget_path_unref(pPath);
+    return context;
+}
 
-GtkStyleContext* GtkSalGraphics::createOldContext(GtkControlPart ePart)
+GtkStyleContext* GtkSalGraphics::createStyleContext(GtkControlPart ePart)
 {
     switch (ePart)
     {
         case GtkControlPart::ToplevelWindow:
         {
             GtkWidgetPath *path = gtk_widget_path_new();
-            gtk_widget_path_append_type(path, GTK_TYPE_WINDOW);
+            gtk_widget_path_append_type(path, G_TYPE_NONE);
+            gtk_widget_path_iter_set_object_name(path, -1, "window");
             gtk_widget_path_iter_add_class(path, -1, "background");
             return makeContext(path, nullptr);
         }
@@ -1841,92 +1039,179 @@ GtkStyleContext* GtkSalGraphics::createOldContext(GtkControlPart ePart)
         {
             GtkWidgetPath *path = gtk_widget_path_new();
             gtk_widget_path_append_type(path, GTK_TYPE_BUTTON);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_BUTTON);
-            gtk_widget_path_iter_add_class(path, -1, "button");
-            gtk_widget_path_iter_add_class(path, -1, "text-button");
+            gtk_widget_path_iter_set_object_name(path, -1, "button");
             return makeContext(path, nullptr);
         }
         case GtkControlPart::LinkButton:
         {
             GtkWidgetPath *path = gtk_widget_path_new();
-            gtk_widget_path_append_type(path, GTK_TYPE_LINK_BUTTON);
-            gtk_widget_path_iter_add_class(path, -1, "text-button");
+            gtk_widget_path_append_type(path, GTK_TYPE_BUTTON);
+            gtk_widget_path_iter_set_object_name(path, -1, "button");
+            gtk_widget_path_iter_add_class(path, -1, "link");
             return makeContext(path, nullptr);
         }
         case GtkControlPart::CheckButton:
         {
             GtkWidgetPath *path = gtk_widget_path_new();
             gtk_widget_path_append_type(path, GTK_TYPE_CHECK_BUTTON);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_CHECK);
-            gtk_widget_path_iter_add_class(path, -1, "text-button");
+            gtk_widget_path_iter_set_object_name(path, -1, "checkbutton");
             return makeContext(path, nullptr);
         }
         case GtkControlPart::CheckButtonCheck:
-            return mpCheckButtonStyle;
+        {
+            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpCheckButtonStyle));
+            gtk_widget_path_append_type(path, GTK_TYPE_CHECK_BUTTON);
+            gtk_widget_path_iter_set_object_name(path, -1, "check");
+            return makeContext(path, mpCheckButtonStyle);
+        }
         case GtkControlPart::RadioButton:
         {
             GtkWidgetPath *path = gtk_widget_path_new();
             gtk_widget_path_append_type(path, GTK_TYPE_RADIO_BUTTON);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_RADIO);
-            gtk_widget_path_iter_add_class(path, -1, "text-button");
+            gtk_widget_path_iter_set_object_name(path, -1, "radiobutton");
             return makeContext(path, nullptr);
         }
         case GtkControlPart::RadioButtonRadio:
-            return mpRadioButtonStyle;
+        {
+            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpRadioButtonStyle));
+            gtk_widget_path_append_type(path, GTK_TYPE_RADIO_BUTTON);
+            gtk_widget_path_iter_set_object_name(path, -1, "radio");
+            return makeContext(path, mpRadioButtonStyle);
+        }
         case GtkControlPart::ComboboxBoxButtonBoxArrow:
+        {
+            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpComboboxButtonBoxStyle));
+            gtk_widget_path_append_type(path, GTK_TYPE_RADIO_BUTTON);
+            gtk_widget_path_append_type(path, GTK_TYPE_BUTTON);
+            gtk_widget_path_iter_set_object_name(path, -1, "arrow");
+            return makeContext(path, mpComboboxButtonBoxStyle);
+        }
         case GtkControlPart::ListboxBoxButtonBoxArrow:
         {
-            return (ePart == GtkControlPart::ComboboxBoxButtonBoxArrow)
-                ? mpComboboxButtonStyle : mpListboxButtonStyle;
+            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpListboxButtonBoxStyle));
+            gtk_widget_path_append_type(path, GTK_TYPE_RADIO_BUTTON);
+            gtk_widget_path_append_type(path, GTK_TYPE_BUTTON);
+            gtk_widget_path_iter_set_object_name(path, -1, "arrow");
+            return makeContext(path, mpListboxButtonBoxStyle);
         }
         case GtkControlPart::Entry:
-        case GtkControlPart::ComboboxBoxEntry:
-        case GtkControlPart::SpinButtonEntry:
         {
             GtkWidgetPath *path = gtk_widget_path_new();
             gtk_widget_path_append_type(path, GTK_TYPE_ENTRY);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_ENTRY);
+            gtk_widget_path_iter_set_object_name(path, -1, "entry");
             return makeContext(path, nullptr);
         }
         case GtkControlPart::Combobox:
+        case GtkControlPart::Listbox:
         {
             GtkWidgetPath *path = gtk_widget_path_new();
-            gtk_widget_path_append_type(path, GTK_TYPE_COMBO_BOX_TEXT);
+            gtk_widget_path_append_type(path, G_TYPE_NONE);
+            gtk_widget_path_iter_set_object_name(path, -1, "combobox");
             return makeContext(path, nullptr);
         }
-        case GtkControlPart::Listbox:
+        case GtkControlPart::ComboboxBox:
         {
-            GtkWidgetPath *path = gtk_widget_path_new();
-            gtk_widget_path_append_type(path, GTK_TYPE_COMBO_BOX);
-            return makeContext(path, nullptr);
+            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpComboboxStyle));
+            gtk_widget_path_append_type(path, G_TYPE_NONE);
+            gtk_widget_path_iter_set_object_name(path, -1, "box");
+            gtk_widget_path_iter_add_class(path, -1, "horizontal");
+            gtk_widget_path_iter_add_class(path, -1, "linked");
+            return makeContext(path, mpComboboxStyle);
+        }
+        case GtkControlPart::ListboxBox:
+        {
+            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpListboxStyle));
+            gtk_widget_path_append_type(path, G_TYPE_NONE);
+            gtk_widget_path_iter_set_object_name(path, -1, "box");
+            gtk_widget_path_iter_add_class(path, -1, "horizontal");
+            gtk_widget_path_iter_add_class(path, -1, "linked");
+            return makeContext(path, mpListboxStyle);
+        }
+        case GtkControlPart::ComboboxBoxEntry:
+        {
+            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpComboboxBoxStyle));
+            GtkWidgetPath* pSiblingsPath;
+            if (AllSettings::GetLayoutRTL())
+            {
+                pSiblingsPath = buildRTLComboSiblingsPath();
+                gtk_widget_path_append_with_siblings(path, pSiblingsPath, 1);
+            }
+            else
+            {
+                pSiblingsPath = buildLTRComboSiblingsPath();
+                gtk_widget_path_append_with_siblings(path, pSiblingsPath, 0);
+            }
+            gtk_widget_path_unref(pSiblingsPath);
+            return makeContext(path, mpComboboxBoxStyle);
         }
         case GtkControlPart::ComboboxBoxButton:
+        {
+            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpComboboxBoxStyle));
+            GtkWidgetPath* pSiblingsPath;
+            if (AllSettings::GetLayoutRTL())
+            {
+                pSiblingsPath = buildRTLComboSiblingsPath();
+                gtk_widget_path_append_with_siblings(path, pSiblingsPath, 0);
+            }
+            else
+            {
+                pSiblingsPath = buildLTRComboSiblingsPath();
+                gtk_widget_path_append_with_siblings(path, pSiblingsPath, 1);
+            }
+            gtk_widget_path_unref(pSiblingsPath);
+            return makeContext(path, mpComboboxBoxStyle);
+        }
         case GtkControlPart::ListboxBoxButton:
         {
-            GtkStyleContext *pParent =
-                (ePart == GtkControlPart::ComboboxBoxButton ) ? mpComboboxStyle : mpListboxStyle;
-            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(pParent));
-            gtk_widget_path_append_type(path, GTK_TYPE_TOGGLE_BUTTON);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_BUTTON);
-            gtk_widget_path_iter_add_class(path, -1, "the-button-in-the-combobox");
-            return makeContext(path, pParent);
+            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpListboxBoxStyle));
+            GtkWidgetPath* pSiblingsPath = gtk_widget_path_new();
+
+            gtk_widget_path_append_type(pSiblingsPath, GTK_TYPE_BUTTON);
+            gtk_widget_path_iter_set_object_name(pSiblingsPath, -1, "button");
+            gtk_widget_path_iter_add_class(pSiblingsPath, -1, "combo");
+
+            gtk_widget_path_append_with_siblings(path, pSiblingsPath, 0);
+            gtk_widget_path_unref(pSiblingsPath);
+            return makeContext(path, mpListboxBoxStyle);
+        }
+        case GtkControlPart::ComboboxBoxButtonBox:
+        {
+            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpComboboxButtonStyle));
+            gtk_widget_path_append_type(path, G_TYPE_NONE);
+            gtk_widget_path_iter_set_object_name(path, -1, "box");
+            gtk_widget_path_iter_add_class(path, -1, "horizontal");
+            return makeContext(path, mpComboboxButtonStyle);
+        }
+        case GtkControlPart::ListboxBoxButtonBox:
+        {
+            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpListboxButtonStyle));
+            gtk_widget_path_append_type(path, G_TYPE_NONE);
+            gtk_widget_path_iter_set_object_name(path, -1, "box");
+            gtk_widget_path_iter_add_class(path, -1, "horizontal");
+            return makeContext(path, mpListboxButtonStyle);
         }
         case GtkControlPart::SpinButton:
         {
-            GtkWidgetPath *path = gtk_widget_path_new();
+            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpWindowStyle));
             gtk_widget_path_append_type(path, GTK_TYPE_SPIN_BUTTON);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_ENTRY);
+            gtk_widget_path_iter_set_object_name(path, -1, "spinbutton");
             gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_HORIZONTAL);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_SPINBUTTON);
-            return makeContext(path, nullptr);
+            return makeContext(path, mpWindowStyle);
+        }
+        case GtkControlPart::SpinButtonEntry:
+        {
+            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpSpinStyle));
+            gtk_widget_path_append_type(path, G_TYPE_NONE);
+            gtk_widget_path_iter_set_object_name(path, -1, "entry");
+            return makeContext(path, mpSpinStyle);
         }
         case GtkControlPart::SpinButtonUpButton:
         case GtkControlPart::SpinButtonDownButton:
         {
             GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpSpinStyle));
             gtk_widget_path_append_type(path, GTK_TYPE_SPIN_BUTTON);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_SPINBUTTON);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_BUTTON);
+            gtk_widget_path_iter_set_object_name(path, -1, "button");
+            gtk_widget_path_iter_add_class(path, -1, ePart == GtkControlPart::SpinButtonUpButton ? "up" : "down");
             return makeContext(path, mpSpinStyle);
         }
         case GtkControlPart::ScrollbarVertical:
@@ -1934,7 +1219,7 @@ GtkStyleContext* GtkSalGraphics::createOldContext(GtkControlPart ePart)
         {
             GtkWidgetPath *path = gtk_widget_path_new();
             gtk_widget_path_append_type(path, GTK_TYPE_SCROLLBAR);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_SCROLLBAR);
+            gtk_widget_path_iter_set_object_name(path, -1, "scrollbar");
             gtk_widget_path_iter_add_class(path, -1, ePart == GtkControlPart::ScrollbarVertical ? "vertical" : "horizontal");
             return makeContext(path, nullptr);
         }
@@ -1945,48 +1230,44 @@ GtkStyleContext* GtkSalGraphics::createOldContext(GtkControlPart ePart)
                 (ePart == GtkControlPart::ScrollbarVerticalContents) ? mpVScrollbarStyle : mpHScrollbarStyle;
             GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(pParent));
             gtk_widget_path_append_type(path, GTK_TYPE_SCROLLBAR);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_SCROLLBAR);
-            gtk_widget_path_iter_add_class(path, -1, "contents");
+            gtk_widget_path_iter_set_object_name(path, -1, "contents");
             return makeContext(path, pParent);
         }
-        case GtkControlPart::ScrollbarHorizontalTrough:
         case GtkControlPart::ScrollbarVerticalTrough:
+        case GtkControlPart::ScrollbarHorizontalTrough:
         {
             GtkStyleContext *pParent =
                 (ePart == GtkControlPart::ScrollbarVerticalTrough) ? mpVScrollbarContentsStyle : mpHScrollbarContentsStyle;
             GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(pParent));
             gtk_widget_path_append_type(path, GTK_TYPE_SCROLLBAR);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_SCROLLBAR);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_TROUGH);
+            gtk_widget_path_iter_set_object_name(path, -1, "trough");
             return makeContext(path, pParent);
         }
-        case GtkControlPart::ScrollbarHorizontalSlider:
         case GtkControlPart::ScrollbarVerticalSlider:
+        case GtkControlPart::ScrollbarHorizontalSlider:
         {
             GtkStyleContext *pParent =
-                (ePart == GtkControlPart::ScrollbarVerticalSlider) ? mpVScrollbarContentsStyle : mpHScrollbarContentsStyle;
+                (ePart == GtkControlPart::ScrollbarVerticalSlider) ? mpVScrollbarTroughStyle : mpHScrollbarTroughStyle;
             GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(pParent));
             gtk_widget_path_append_type(path, GTK_TYPE_SCROLLBAR);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_SCROLLBAR);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_SLIDER);
+            gtk_widget_path_iter_set_object_name(path, -1, "slider");
             return makeContext(path, pParent);
         }
-        case GtkControlPart::ScrollbarHorizontalButton:
         case GtkControlPart::ScrollbarVerticalButton:
+        case GtkControlPart::ScrollbarHorizontalButton:
         {
             GtkStyleContext *pParent =
                 (ePart == GtkControlPart::ScrollbarVerticalButton) ? mpVScrollbarStyle : mpHScrollbarStyle;
             GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(pParent));
             gtk_widget_path_append_type(path, GTK_TYPE_SCROLLBAR);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_SCROLLBAR);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_BUTTON);
+            gtk_widget_path_iter_set_object_name(path, -1, "button");
             return makeContext(path, pParent);
         }
         case GtkControlPart::ProgressBar:
         {
             GtkWidgetPath *path = gtk_widget_path_new();
             gtk_widget_path_append_type(path, GTK_TYPE_PROGRESS_BAR);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_PROGRESSBAR);
+            gtk_widget_path_iter_set_object_name(path, -1, "progressbar");
             gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_HORIZONTAL);
             return makeContext(path, nullptr);
         }
@@ -1994,71 +1275,70 @@ GtkStyleContext* GtkSalGraphics::createOldContext(GtkControlPart ePart)
         {
             GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpProgressBarStyle));
             gtk_widget_path_append_type(path, GTK_TYPE_PROGRESS_BAR);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_TROUGH);
+            gtk_widget_path_iter_set_object_name(path, -1, "trough");
             return makeContext(path, mpProgressBarStyle);
         }
         case GtkControlPart::ProgressBarProgress:
         {
             GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpProgressBarTroughStyle));
             gtk_widget_path_append_type(path, GTK_TYPE_PROGRESS_BAR);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_PROGRESSBAR);
+            gtk_widget_path_iter_set_object_name(path, -1, "progress");
             return makeContext(path, mpProgressBarTroughStyle);
         }
         case GtkControlPart::Notebook:
         {
             GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpWindowStyle));
             gtk_widget_path_append_type(path, GTK_TYPE_NOTEBOOK);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_NOTEBOOK);
-            gtk_widget_path_iter_add_class(path, -1, "frame");
+            gtk_widget_path_iter_set_object_name(path, -1, "notebook");
             return makeContext(path, mpWindowStyle);
         }
         case GtkControlPart::NotebookStack:
-            return mpNotebookStyle;
+        {
+            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpNotebookStyle));
+            gtk_widget_path_append_type(path, GTK_TYPE_NOTEBOOK);
+            gtk_widget_path_iter_set_object_name(path, -1, "stack");
+            return makeContext(path, mpNotebookStyle);
+        }
         case GtkControlPart::NotebookHeader:
         {
             GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpNotebookStyle));
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_HEADER);
+            gtk_widget_path_append_type(path, GTK_TYPE_NOTEBOOK);
+            gtk_widget_path_iter_set_object_name(path, -1, "header");
+            gtk_widget_path_iter_add_class(path, -1, "frame");
             gtk_widget_path_iter_add_class(path, -1, "top");
-            return makeContext(path, gtk_style_context_get_parent(mpNotebookStyle));
+            return makeContext(path, mpNotebookStyle);
         }
         case GtkControlPart::NotebookHeaderTabs:
-            return mpNotebookHeaderStyle;
+        {
+            GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpNotebookHeaderStyle));
+            gtk_widget_path_append_type(path, GTK_TYPE_NOTEBOOK);
+            gtk_widget_path_iter_set_object_name(path, -1, "tabs");
+            gtk_widget_path_iter_add_class(path, -1, "top");
+            return makeContext(path, mpNotebookHeaderStyle);
+        }
         case GtkControlPart::NotebookHeaderTabsTab:
         {
             GtkWidgetPath *path = gtk_widget_path_copy(gtk_style_context_get_path(mpNotebookHeaderTabsStyle));
             gtk_widget_path_append_type(path, GTK_TYPE_NOTEBOOK);
-            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_HEADER);
+            gtk_widget_path_iter_set_object_name(path, -1, "tab");
             gtk_widget_path_iter_add_class(path, -1, "top");

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list