[Libreoffice-commits] core.git: 2 commits - svx/source vcl/unx

Caolán McNamara caolanm at redhat.com
Tue Jun 5 20:07:57 UTC 2018


 svx/source/dialog/charmap.cxx |    3 +-
 vcl/unx/gtk3/gtk3gtkframe.cxx |   44 ++++++++++++++++++++++++++++++++++++------
 2 files changed, 40 insertions(+), 7 deletions(-)

New commits:
commit dbd804bac6db541d60b3a101852580b87bd4e33e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 5 14:57:19 2018 +0100

    tdf#117981 translate embedded video window mouse events to parent coordinates
    
    Change-Id: I0d8fb6c6adc44389332434f9f6a8396a4d1817cf
    Reviewed-on: https://gerrit.libreoffice.org/55337
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 3595e0bf20c7..38cb6b8c087a 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2586,11 +2586,28 @@ void GtkSalFrame::closePopup()
     pSVData->maWinData.mpFirstFloat->EndPopupMode(FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll);
 }
 
+namespace
+{
+    //tdf#117981 translate embedded video window mouse events to parent coordinates
+    void translate_coords(GdkWindow* pSourceWindow, GtkWidget* pTargetWidget, int& rEventX, int& rEventY)
+    {
+        gpointer user_data=nullptr;
+        gdk_window_get_user_data(pSourceWindow, &user_data);
+        GtkWidget* pRealEventWidget = static_cast<GtkWidget*>(user_data);
+        if (pRealEventWidget)
+        {
+            gtk_widget_translate_coordinates(pRealEventWidget, pTargetWidget, rEventX, rEventY, &rEventX, &rEventY);
+        }
+    }
+}
+
 gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer frame )
 {
     UpdateLastInputEventTime(pEvent->time);
 
     GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
+    GtkWidget* pEventWidget = pThis->getMouseEventWidget();
+    bool bDifferentEventWindow = pEvent->window != widget_get_window(pEventWidget);
 
     SalMouseEvent aEvent;
     SalEvent nEventType = SalEvent::NONE;
@@ -2619,7 +2636,7 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer
     {
         //rhbz#1505379 if the window that got the event isn't our one, or there's none
         //of our windows under the mouse then close this popup window
-        if (pEvent->window != widget_get_window(pThis->getMouseEventWidget()) ||
+        if (bDifferentEventWindow ||
             gdk_device_get_window_at_position(pEvent->device, nullptr, nullptr) == nullptr)
         {
             if (pEvent->type == GDK_BUTTON_PRESS)
@@ -2629,10 +2646,16 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer
         }
     }
 
+    int nEventX = pEvent->x;
+    int nEventY = pEvent->y;
+
+    if (bDifferentEventWindow)
+        translate_coords(pEvent->window, pEventWidget, nEventX, nEventY);
+
     if (!aDel.isDeleted())
     {
-        int frame_x = static_cast<int>(pEvent->x_root - pEvent->x);
-        int frame_y = static_cast<int>(pEvent->y_root - pEvent->y);
+        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.nX || frame_y != pThis->maGeometry.nY)
         {
             pThis->m_bGeometryIsProvisional = false;
@@ -2843,18 +2866,27 @@ gboolean GtkSalFrame::signalMotion( GtkWidget*, GdkEventMotion* pEvent, gpointer
     UpdateLastInputEventTime(pEvent->time);
 
     GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
+    GtkWidget* pEventWidget = pThis->getMouseEventWidget();
+    bool bDifferentEventWindow = pEvent->window != widget_get_window(pEventWidget);
 
     //If a menu, e.g. font name dropdown, is open, then under wayland moving the
     //mouse in the top left corner of the toplevel window in a
     //0,0,float-width,float-height area generates motion events which are
     //delivered to the dropdown
-    if (pThis->isFloatGrabWindow() && pEvent->window != widget_get_window(pThis->getMouseEventWidget()))
+    if (pThis->isFloatGrabWindow() && bDifferentEventWindow)
         return true;
 
     vcl::DeletionListener aDel( pThis );
 
-    int frame_x = static_cast<int>(pEvent->x_root - pEvent->x);
-    int frame_y = static_cast<int>(pEvent->y_root - pEvent->y);
+    int nEventX = pEvent->x;
+    int nEventY = pEvent->y;
+
+    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.nX || frame_y != pThis->maGeometry.nY)
     {
         pThis->m_bGeometryIsProvisional = false;
commit e0cf2c1e4ea94211f59d2ff87bb132754bb74048
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 5 16:49:11 2018 +0100

    Resolves: tdf#116876 don't reselect index on resize if it wouldn't change
    
    selecting the index sets it as active and updates the previews, so if its an
    inactive index and resize happens, leave it as inactive but selected
    
    Change-Id: If823f6b3e8f2ee4e77ba5e5d0202d72893ed614c
    Reviewed-on: https://gerrit.libreoffice.org/55344
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index 596e0b71a97f..3bf3a01d520f 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -679,7 +679,8 @@ void SvxShowCharSet::RecalculateFont(vcl::RenderContext& rRenderContext)
 
     // restore last selected unicode
     int nMapIndex = mxFontCharMap->GetIndexFromChar(getSelectedChar());
-    SelectIndex(nMapIndex);
+    if (nMapIndex != nSelectedIndex)
+        SelectIndex(nMapIndex);
 
     // rearrange CharSet element in sync with nX- and nY-multiples
     Size aDrawSize(nX * COLUMN_COUNT, nY * ROW_COUNT);


More information about the Libreoffice-commits mailing list