1a32dfd
From b5411c190e798c27e18a67eb1472b465728c28a8 Mon Sep 17 00:00:00 2001
7cfba14
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
7cfba14
Date: Mon, 21 Nov 2016 10:22:27 +0000
7cfba14
Subject: [PATCH] Resolves: rhbz#1396827 update geom on mouse click as well as
7cfba14
 motion
7cfba14
7cfba14
Change-Id: Ia361aa316fe3f5ecdd672d42de9bea7fcf142554
7cfba14
---
7cfba14
 vcl/unx/gtk3/gtk3gtkframe.cxx | 33 ++++++++++++++++++++++++---------
7cfba14
 1 file changed, 24 insertions(+), 9 deletions(-)
7cfba14
7cfba14
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
1a32dfd
index 24ffcdd..d5ade01 100644
7cfba14
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
7cfba14
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
1a32dfd
@@ -2582,10 +2582,6 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer
7cfba14
         case 3: aEvent.mnButton = MOUSE_RIGHT;  break;
7cfba14
         default: return false;
7cfba14
     }
7cfba14
-    aEvent.mnTime   = pEvent->time;
7cfba14
-    aEvent.mnX      = (long)pEvent->x_root - pThis->maGeometry.nX;
7cfba14
-    aEvent.mnY      = (long)pEvent->y_root - pThis->maGeometry.nY;
7cfba14
-    aEvent.mnCode   = GetMouseModCode( pEvent->state );
7cfba14
 
7cfba14
     vcl::DeletionListener aDel( pThis );
7cfba14
 
1a32dfd
@@ -2596,12 +2592,31 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer
1a32dfd
             closePopup();
7cfba14
     }
7cfba14
 
7cfba14
-    // --- RTL --- (mirror mouse pos)
7cfba14
-    if( AllSettings::GetLayoutRTL() )
7cfba14
-        aEvent.mnX = pThis->maGeometry.nWidth-1-aEvent.mnX;
7cfba14
+    if (!aDel.isDeleted())
7cfba14
+    {
7cfba14
+        int frame_x = (int)(pEvent->x_root - pEvent->x);
7cfba14
+        int frame_y = (int)(pEvent->y_root - pEvent->y);
7cfba14
+        if (frame_x != pThis->maGeometry.nX || frame_y != pThis->maGeometry.nY)
7cfba14
+        {
7cfba14
+            pThis->maGeometry.nX = frame_x;
7cfba14
+            pThis->maGeometry.nY = frame_y;
7cfba14
+            ImplSVData* pSVData = ImplGetSVData();
7cfba14
+            if (pSVData->maNWFData.mbCanDetermineWindowPosition)
7cfba14
+                pThis->CallCallbackExc(SalEvent::Move, nullptr);
7cfba14
+        }
7cfba14
+    }
7cfba14
 
7cfba14
     if (!aDel.isDeleted())
7cfba14
     {
7cfba14
+        aEvent.mnTime   = pEvent->time;
7cfba14
+        aEvent.mnX      = (long)pEvent->x_root - pThis->maGeometry.nX;
7cfba14
+        aEvent.mnY      = (long)pEvent->y_root - pThis->maGeometry.nY;
7cfba14
+        aEvent.mnCode   = GetMouseModCode( pEvent->state );
7cfba14
+
7cfba14
+        // --- RTL --- (mirror mouse pos)
7cfba14
+        if( AllSettings::GetLayoutRTL() )
7cfba14
+            aEvent.mnX = pThis->maGeometry.nWidth-1-aEvent.mnX;
7cfba14
+
7cfba14
         pThis->CallCallbackExc( nEventType, &aEvent );
7cfba14
     }
7cfba14
 
1a32dfd
@@ -2777,7 +2792,7 @@ gboolean GtkSalFrame::signalMotion( GtkWidget*, GdkEventMotion* pEvent, gpointer
7cfba14
             pThis->CallCallbackExc(SalEvent::Move, nullptr);
7cfba14
     }
7cfba14
 
7cfba14
-    if( ! aDel.isDeleted() )
7cfba14
+    if (!aDel.isDeleted())
7cfba14
     {
7cfba14
         SalMouseEvent aEvent;
7cfba14
         aEvent.mnTime   = pEvent->time;
1a32dfd
@@ -2793,7 +2808,7 @@ gboolean GtkSalFrame::signalMotion( GtkWidget*, GdkEventMotion* pEvent, gpointer
7cfba14
         pThis->CallCallbackExc( SalEvent::MouseMove, &aEvent );
7cfba14
     }
7cfba14
 
7cfba14
-    if( ! aDel.isDeleted() )
7cfba14
+    if (!aDel.isDeleted())
7cfba14
     {
7cfba14
         // ask for the next hint
7cfba14
         gint x, y;
7cfba14
-- 
7cfba14
2.9.3
7cfba14