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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon May 10 13:37:58 UTC 2021


 vcl/inc/unx/gtk/gtkframe.hxx |    9 ++++++
 vcl/unx/gtk3/gtkframe.cxx    |   61 +++++++++++++++++++++++++++++++++----------
 2 files changed, 56 insertions(+), 14 deletions(-)

New commits:
commit fdb44082252bfbb6a174216be43746421a312180
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon May 10 12:04:19 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon May 10 15:37:08 2021 +0200

    gtk4: enable signalMap and signalUnmap
    
    Change-Id: I614296cfc2ccf78e45a9b9df04977c938e47dff4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115326
    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 7f637510bdf2..c45925755b3f 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -276,8 +276,17 @@ class GtkSalFrame final : public SalFrame
     static void         gestureLongPress(GtkGestureLongPress* gesture, gdouble x, gdouble y, gpointer frame);
     static gboolean     signalFocus( GtkWidget*, GdkEventFocus*, gpointer );
     static void         signalSetFocus( GtkWindow* pWindow, GtkWidget* pWidget, gpointer frame );
+#endif
+    void WindowMap();
+    void WindowUnmap();
+#if GTK_CHECK_VERSION(4, 0, 0)
+    static void         signalMap( GtkWidget*, gpointer );
+    static void         signalUnmap( GtkWidget*, gpointer );
+#else
     static gboolean     signalMap( GtkWidget*, GdkEvent*, gpointer );
     static gboolean     signalUnmap( GtkWidget*, GdkEvent*, gpointer );
+#endif
+#if !GTK_CHECK_VERSION(4, 0, 0)
     static gboolean     signalConfigure( GtkWidget*, GdkEventConfigure*, gpointer );
     static gboolean     signalMotion( GtkWidget*, GdkEventMotion*, gpointer );
     static gboolean     signalKey( GtkWidget*, GdkEventKey*, gpointer );
diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index 46f34dc143f4..1e6384b5615f 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -981,8 +981,15 @@ void GtkSalFrame::InitCommon()
     g_signal_connect_after( G_OBJECT(m_pWindow), "focus-out-event", G_CALLBACK(signalFocus), this );
     if (GTK_IS_WINDOW(m_pWindow)) // i.e. not if it's a GtkEventBox which doesn't have the signal
         m_nSetFocusSignalId = g_signal_connect( G_OBJECT(m_pWindow), "set-focus", G_CALLBACK(signalSetFocus), this );
+#endif
+#if !GTK_CHECK_VERSION(4,0,0)
     g_signal_connect( G_OBJECT(m_pWindow), "map-event", G_CALLBACK(signalMap), this );
     g_signal_connect( G_OBJECT(m_pWindow), "unmap-event", G_CALLBACK(signalUnmap), this );
+#else
+    g_signal_connect( G_OBJECT(m_pWindow), "map", G_CALLBACK(signalMap), this );
+    g_signal_connect( G_OBJECT(m_pWindow), "unmap", G_CALLBACK(signalUnmap), this );
+#endif
+#if !GTK_CHECK_VERSION(4,0,0)
     g_signal_connect( G_OBJECT(m_pWindow), "configure-event", G_CALLBACK(signalConfigure), this );
     g_signal_connect( G_OBJECT(m_pWindow), "key-press-event", G_CALLBACK(signalKey), this );
     g_signal_connect( G_OBJECT(m_pWindow), "key-release-event", G_CALLBACK(signalKey), this );
@@ -3485,38 +3492,64 @@ void GtkSalFrame::signalSetFocus(GtkWindow*, GtkWidget* pWidget, gpointer frame)
 
     gtk_widget_set_can_focus(GTK_WIDGET(pThis->m_pFixedContainer), !bLoseFocus);
 }
+#endif
 
-gboolean GtkSalFrame::signalMap(GtkWidget *, GdkEvent*, gpointer frame)
+void GtkSalFrame::WindowMap()
 {
-    GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
+    SolarMutexGuard aGuard;
 
-    if (pThis->m_bIconSetWhileUnmapped)
-        pThis->SetIcon(gtk_window_get_icon_name(GTK_WINDOW(pThis->m_pWindow)));
+    if (m_bIconSetWhileUnmapped)
+        SetIcon(gtk_window_get_icon_name(GTK_WINDOW(m_pWindow)));
 
-    pThis->CallCallbackExc( SalEvent::Resize, nullptr );
-    pThis->TriggerPaintEvent();
-
-    return false;
+    CallCallbackExc( SalEvent::Resize, nullptr );
+    TriggerPaintEvent();
 }
 
-gboolean GtkSalFrame::signalUnmap( GtkWidget*, GdkEvent*, gpointer frame )
+void GtkSalFrame::WindowUnmap()
 {
-    GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
+    SolarMutexGuard aGuard;
 
-    pThis->CallCallbackExc( SalEvent::Resize, nullptr );
+    CallCallbackExc( SalEvent::Resize, nullptr );
 
-    if (pThis->m_bFloatPositioned)
+    if (m_bFloatPositioned)
     {
         // Unrealize is needed for cases where we reuse the same popup
         // (e.g. the font name control), making the realize signal fire
         // again on next show.
-        gtk_widget_unrealize(pThis->m_pWindow);
-        pThis->m_bFloatPositioned = false;
+        gtk_widget_unrealize(m_pWindow);
+        m_bFloatPositioned = false;
     }
+}
 
+#if GTK_CHECK_VERSION(4, 0, 0)
+void GtkSalFrame::signalMap(GtkWidget*, gpointer frame)
+{
+    GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
+    pThis->WindowMap();
+}
+
+void GtkSalFrame::signalUnmap(GtkWidget*, gpointer frame)
+{
+    GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
+    pThis->WindowUnmap();
+}
+#else
+gboolean GtkSalFrame::signalMap(GtkWidget*, GdkEvent*, gpointer frame)
+{
+    GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
+    pThis->WindowMap();
+    return false;
+}
+
+gboolean GtkSalFrame::signalUnmap(GtkWidget*, GdkEvent*, gpointer frame)
+{
+    GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
+    pThis->WindowUnmap();
     return false;
 }
+#endif
 
+#if !GTK_CHECK_VERSION(4, 0, 0)
 gboolean GtkSalFrame::signalKey(GtkWidget* pWidget, GdkEventKey* pEvent, gpointer frame)
 {
     UpdateLastInputEventTime(pEvent->time);


More information about the Libreoffice-commits mailing list