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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon May 24 14:32:28 UTC 2021


 vcl/inc/unx/gtk/gtkframe.hxx |    3 ++-
 vcl/unx/gtk3/gtkframe.cxx    |   15 +++++++++------
 2 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit 5ca3dd6b9e531421bc7d3e66109e27e8df15b1e6
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon May 24 14:29:37 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon May 24 16:31:40 2021 +0200

    gtk4: restore GtkFixed container for SalObjects
    
    put the DrawingArea into an Overlay so the overlay will take the size of
    the DrawingArea. Put a GtkFixed into that overlay which will then also
    mirror the size of the DrawingArea. Keep that GtkFixed because the
    SalObject stuff is set up to use a GtkFixed and its just easier to do it
    this way than use the overlay directly.
    
    Change-Id: I937b3740fd809660ee0edef56d5cf036f2503892
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116059
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 6c5b01d7c28e..645dbd9ac794 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -177,7 +177,8 @@ class GtkSalFrame final : public SalFrame
     GtkFixed*                       m_pFixedContainer;
     GtkFixed*                       m_pDrawingArea;
 #else
-    GtkOverlay*                     m_pFixedContainer;
+    GtkOverlay*                     m_pOverlay;
+    GtkFixed*                       m_pFixedContainer;
     GtkDrawingArea*                 m_pDrawingArea;
     GtkEventControllerKey*          m_pKeyController;
 #endif
diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index c5eae3ee430f..3a4a0abed28c 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -766,7 +766,7 @@ void GtkSalFrame::moveWindow( tools::Long nX, tools::Long nY )
 
 void GtkSalFrame::widget_set_size_request(tools::Long nWidth, tools::Long nHeight)
 {
-    gtk_widget_set_size_request(GTK_WIDGET(m_pFixedContainer), nWidth, nHeight );
+    gtk_widget_set_size_request(GTK_WIDGET(m_pDrawingArea), nWidth, nHeight );
 }
 
 void GtkSalFrame::window_resize(tools::Long nWidth, tools::Long nHeight)
@@ -916,7 +916,8 @@ void GtkSalFrame::InitCommon()
     m_pFixedContainer = GTK_FIXED(g_object_new( ooo_fixed_get_type(), nullptr ));
     m_pDrawingArea = m_pFixedContainer;
 #else
-    m_pFixedContainer = GTK_OVERLAY(gtk_overlay_new());
+    m_pOverlay = GTK_OVERLAY(gtk_overlay_new());
+    m_pFixedContainer = GTK_FIXED(gtk_fixed_new());
     m_pDrawingArea = GTK_DRAWING_AREA(gtk_drawing_area_new());
 #endif
     gtk_widget_set_can_focus(GTK_WIDGET(m_pDrawingArea), true);
@@ -924,10 +925,12 @@ void GtkSalFrame::InitCommon()
 #if !GTK_CHECK_VERSION(4,0,0)
     gtk_container_add( GTK_CONTAINER(m_pEventBox), GTK_WIDGET(m_pFixedContainer) );
 #else
-    gtk_widget_set_vexpand(GTK_WIDGET(m_pFixedContainer), true);
-    gtk_widget_set_hexpand(GTK_WIDGET(m_pFixedContainer), true);
-    gtk_grid_attach(m_pTopLevelGrid, GTK_WIDGET(m_pFixedContainer), 0, 0, 1, 1);
-    gtk_overlay_set_child(m_pFixedContainer, GTK_WIDGET(m_pDrawingArea));
+    gtk_widget_set_vexpand(GTK_WIDGET(m_pOverlay), true);
+    gtk_widget_set_hexpand(GTK_WIDGET(m_pOverlay), true);
+    gtk_grid_attach(m_pTopLevelGrid, GTK_WIDGET(m_pOverlay), 0, 0, 1, 1);
+    gtk_overlay_set_child(m_pOverlay, GTK_WIDGET(m_pDrawingArea));
+    gtk_overlay_add_overlay(m_pOverlay, GTK_WIDGET(m_pFixedContainer));
+    gtk_widget_set_can_target(GTK_WIDGET(m_pFixedContainer), false);
 #endif
 
     GtkWidget *pEventWidget = getMouseEventWidget();


More information about the Libreoffice-commits mailing list