Blame SOURCES/0001-Related-rhbz-1290014-gtk3-use-gtk_window_set_modal-o.patch

f325b2
From 8a30dab4e78b42cf3ce587965414b98a50830a78 Mon Sep 17 00:00:00 2001
f325b2
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
f325b2
Date: Mon, 14 Dec 2015 11:36:50 +0000
f325b2
Subject: [PATCH 1/2] Related: rhbz#1290014 gtk3: use gtk_window_set_modal on
f325b2
 modal dialogs
f325b2
MIME-Version: 1.0
f325b2
Content-Type: text/plain; charset=UTF-8
f325b2
Content-Transfer-Encoding: 8bit
f325b2
f325b2
which makes modal dialogs (which are most of them) place correctly
f325b2
under wayland. Modeless ones are still uselessly shoved far to the
f325b2
left, but this makes things near usable and gives the same "graying
f325b2
into the bg" effect for the main window as other gtk apps
f325b2
f325b2
Change-Id: If1486feb7631c5a0c2aa6efac3a6b9dd1b215daf
f325b2
Reviewed-on: https://gerrit.libreoffice.org/20699
f325b2
Tested-by: Jenkins <ci@libreoffice.org>
f325b2
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
f325b2
Tested-by: Caolán McNamara <caolanm@redhat.com>
f325b2
(cherry picked from commit 8d5822983e9b6a1e04874ce4d2c807fd0cf1ee04)
f325b2
Reviewed-on: https://gerrit.libreoffice.org/20700
f325b2
---
f325b2
 vcl/inc/salframe.hxx          | 4 ++++
f325b2
 vcl/inc/unx/gtk/gtkframe.hxx  | 4 ++++
f325b2
 vcl/source/window/dialog.cxx  | 3 ++-
f325b2
 vcl/unx/gtk3/gtk3gtkframe.cxx | 7 +++++++
f325b2
 4 files changed, 17 insertions(+), 1 deletion(-)
f325b2
f325b2
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
f325b2
index 4e52fe4..484504c 100644
f325b2
--- a/vcl/inc/salframe.hxx
f325b2
+++ b/vcl/inc/salframe.hxx
f325b2
@@ -233,6 +233,10 @@ public:
f325b2
     // done setting up the clipregion
f325b2
     virtual void            EndSetClipRegion() = 0;
f325b2
 
f325b2
+    virtual void            SetModal(bool /*bModal*/)
f325b2
+    {
f325b2
+    }
f325b2
+
f325b2
     // Callbacks (indepent part in vcl/source/window/winproc.cxx)
f325b2
     // for default message handling return 0
f325b2
     void                    SetCallback( vcl::Window* pWindow, SALFRAMEPROC pProc );
f325b2
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
f325b2
index 3bd5353..ee19e6c 100644
f325b2
--- a/vcl/inc/unx/gtk/gtkframe.hxx
f325b2
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
f325b2
@@ -465,6 +465,10 @@ public:
f325b2
     // done setting up the clipregion
f325b2
     virtual void                EndSetClipRegion() SAL_OVERRIDE;
f325b2
 
f325b2
+#if GTK_CHECK_VERSION(3,0,0)
f325b2
+    virtual void                SetModal(bool bModal) override;
f325b2
+#endif
f325b2
+
f325b2
     static GtkSalFrame         *getFromWindow( GtkWindow *pWindow );
f325b2
 
f325b2
     virtual Window              GetX11Window() SAL_OVERRIDE;
f325b2
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
f325b2
index 4ce15de..cd1f0da 100644
f325b2
--- a/vcl/source/window/dialog.cxx
f325b2
+++ b/vcl/source/window/dialog.cxx
f325b2
@@ -46,6 +46,7 @@
f325b2
 #include <vcl/msgbox.hxx>
f325b2
 #include <vcl/unowrap.hxx>
f325b2
 #include <vcl/settings.hxx>
f325b2
+#include <salframe.hxx>
f325b2
 
f325b2
 #include <iostream>
f325b2
 
f325b2
@@ -1001,7 +1002,6 @@ void Dialog::SetModalInputMode( bool bModal )
f325b2
             mpDialogParent = pParent->mpWindowImpl->mpFrameWindow;
f325b2
             mpDialogParent->ImplIncModalCount();
f325b2
         }
f325b2
-
f325b2
     }
f325b2
     else
f325b2
     {
f325b2
@@ -1037,6 +1037,7 @@ void Dialog::SetModalInputMode( bool bModal )
f325b2
             }
f325b2
         }
f325b2
     }
f325b2
+    ImplGetFrame()->SetModal(bModal);
f325b2
 }
f325b2
 
f325b2
 void Dialog::SetModalInputMode( bool bModal, bool bSubModalDialogs )
f325b2
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
f325b2
index 1443054..ca9d371 100644
f325b2
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
f325b2
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
f325b2
@@ -2616,6 +2616,13 @@ void GtkSalFrame::EndSetClipRegion()
f325b2
         gdk_window_shape_combine_region( widget_get_window(m_pWindow), m_pRegion, 0, 0 );
f325b2
 }
f325b2
 
f325b2
+void GtkSalFrame::SetModal(bool bModal)
f325b2
+{
f325b2
+    if (!m_pWindow)
f325b2
+        return;
f325b2
+    gtk_window_set_modal(GTK_WINDOW(m_pWindow), bModal);
f325b2
+}
f325b2
+
f325b2
 gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer frame )
f325b2
 {
f325b2
     GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
f325b2
-- 
f325b2
2.5.0
f325b2