diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-05-24 14:29:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-05-24 16:31:40 +0200 |
commit | 5ca3dd6b9e531421bc7d3e66109e27e8df15b1e6 (patch) | |
tree | 7957132d3bbe78ff93ead0108d96aa27ebc0cfd2 | |
parent | cb5e49907a2970f6d2820bbc6061ccc7ed0bea93 (diff) |
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@redhat.com>
-rw-r--r-- | vcl/inc/unx/gtk/gtkframe.hxx | 3 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtkframe.cxx | 15 |
2 files changed, 11 insertions, 7 deletions
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(); |