vcl/inc/unx/gtk/gtkframe.hxx |    2 ++
 vcl/unx/gtk3/gtkframe.cxx    |   42 +++++++++++++++++-------------------------
 2 files changed, 19 insertions(+), 25 deletions(-)

New commits:
commit 20d5763b2b56b4e3d7569fe9e5cdad87657f6808
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Nov 4 10:45:46 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Nov 4 16:54:47 2022 +0100

    Related: tdf#151509 factor out common block as UpdateGeometryFromEvent
    
    Change-Id: Iec2d4d1dcc2c38e264079024e25a8a3b8ea351c9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142273
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 8f2b8064fe9f..5b2df74d3f5c 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -425,6 +425,8 @@ class GtkSalFrame final : public SalFrame
 
     void ListenPortalSettings();
 
+    void UpdateGeometryFromEvent(int x_root, int y_root, int nEventX, int 
nEventY);
+
 public:
     cairo_surface_t*                m_pSurface;
     basegfx::B2IVector              m_aFrameSize;
diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index 525bf2554a60..d4084ca9836b 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -3130,6 +3130,21 @@ bool GtkSalFrame::DrawingAreaButton(SalEvent nEventType, 
int nEventX, int nEvent
 }
 
 #if !GTK_CHECK_VERSION(4, 0, 0)
+
+void GtkSalFrame::UpdateGeometryFromEvent(int x_root, int y_root, int nEventX, 
int nEventY)
+{
+    int frame_x = x_root - nEventX;
+    int frame_y = y_root - nEventY;
+    if (m_bGeometryIsProvisional || frame_x != maGeometry.x() || frame_y != 
maGeometry.y())
+    {
+        m_bGeometryIsProvisional = false;
+        maGeometry.setPos({ frame_x, frame_y });
+        ImplSVData* pSVData = ImplGetSVData();
+        if (pSVData->maNWFData.mbCanDetermineWindowPosition)
+            CallCallbackExc(SalEvent::Move, nullptr);
+    }
+}
+
 gboolean GtkSalFrame::signalButton(GtkWidget*, GdkEventButton* pEvent, 
gpointer frame)
 {
     GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
@@ -3187,18 +3202,7 @@ gboolean GtkSalFrame::signalButton(GtkWidget*, 
GdkEventButton* pEvent, gpointer
         translate_coords(pEvent->window, pEventWidget, nEventX, nEventY);
 
     if (!aDel.isDeleted())
-    {
-        int frame_x = static_cast<int>(pEvent->x_root - nEventX);
-        int frame_y = static_cast<int>(pEvent->y_root - nEventY);
-        if (pThis->m_bGeometryIsProvisional || frame_x != 
pThis->maGeometry.x() || frame_y != pThis->maGeometry.y())
-        {
-            pThis->m_bGeometryIsProvisional = false;
-            pThis->maGeometry.setPos({ frame_x, frame_y });
-            ImplSVData* pSVData = ImplGetSVData();
-            if (pSVData->maNWFData.mbCanDetermineWindowPosition)
-                pThis->CallCallbackExc(SalEvent::Move, nullptr);
-        }
-    }
+        pThis->UpdateGeometryFromEvent(pEvent->x_root, pEvent->y_root, 
nEventX, nEventY);
 
     bool bRet = false;
     if (!aDel.isDeleted())
@@ -3501,22 +3505,10 @@ gboolean GtkSalFrame::signalMotion( GtkWidget*, 
GdkEventMotion* pEvent, gpointer
     if (bDifferentEventWindow)
         translate_coords(pEvent->window, pEventWidget, nEventX, nEventY);
 
-    int frame_x = static_cast<int>(pEvent->x_root - nEventX);
-    int frame_y = static_cast<int>(pEvent->y_root - nEventY);
-
-    if (pThis->m_bGeometryIsProvisional || frame_x != pThis->maGeometry.x() || 
frame_y != pThis->maGeometry.y())
-    {
-        pThis->m_bGeometryIsProvisional = false;
-        pThis->maGeometry.setPos({ frame_x, frame_y });
-        ImplSVData* pSVData = ImplGetSVData();
-        if (pSVData->maNWFData.mbCanDetermineWindowPosition)
-            pThis->CallCallbackExc(SalEvent::Move, nullptr);
-    }
+    pThis->UpdateGeometryFromEvent(pEvent->x_root, pEvent->y_root, nEventX, 
nEventY);
 
     if (!aDel.isDeleted())
-    {
         pThis->DrawingAreaMotion(nEventX, nEventY, pEvent->time, 
pEvent->state);
-    }
 
     if (!aDel.isDeleted())
     {

Reply via email to