summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/dialog.hxx2
-rw-r--r--libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx48
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx2
-rw-r--r--vcl/source/window/dialog.cxx25
4 files changed, 48 insertions, 29 deletions
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 092533c9143d..a38a6ebc6c6a 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -82,7 +82,7 @@ public:
void paintDialog(VirtualDevice& rDevice);
void LogicMouseButtonDown(const MouseEvent& rMouseEvent);
void LogicMouseButtonUp(const MouseEvent& rMouseEvent);
- void LogicMouseButtonMove(const MouseEvent& rMouseEvent);
+ void LogicMouseMove(const MouseEvent& rMouseEvent);
protected:
explicit Dialog( WindowType nType );
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
index 24773ebfc9a0..2a620b58000d 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx
@@ -34,6 +34,7 @@ struct GtvLokDialogPrivate
guint32 m_nLastButtonPressTime;
guint32 m_nLastButtonReleaseTime;
guint32 m_nKeyModifier;
+ guint32 m_nLastButtonPressed;
gchar* dialogid;
};
@@ -125,11 +126,12 @@ gtv_lok_dialog_signal_button(GtkWidget* pDialogDrawingArea, GdkEventButton* pEve
nEventButton = MOUSE_RIGHT;
break;
}
+ priv->m_nLastButtonPressed = nEventButton;
pDocument->pClass->postDialogMouseEvent(pDocument,
priv->dialogid,
LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
- pixelToTwip(pEvent->x),
- pixelToTwip(pEvent->y),
+ (pEvent->x),
+ (pEvent->y),
nCount,
nEventButton,
0/* Modifier */);
@@ -155,12 +157,12 @@ gtv_lok_dialog_signal_button(GtkWidget* pDialogDrawingArea, GdkEventButton* pEve
nEventButton = MOUSE_RIGHT;
break;
}
-
+ priv->m_nLastButtonPressed = nEventButton;
pDocument->pClass->postDialogMouseEvent(pDocument,
priv->dialogid,
LOK_MOUSEEVENT_MOUSEBUTTONUP,
- pixelToTwip(pEvent->x),
- pixelToTwip(pEvent->y),
+ (pEvent->x),
+ (pEvent->y),
nCount,
nEventButton,
0/* Modifier */);
@@ -172,6 +174,33 @@ gtv_lok_dialog_signal_button(GtkWidget* pDialogDrawingArea, GdkEventButton* pEve
return FALSE;
}
+static gboolean
+gtv_lok_dialog_signal_motion(GtkWidget* pDialogDrawingArea, GdkEventButton* pEvent)
+{
+ GtvLokDialog* pDialog = GTV_LOK_DIALOG(gtk_widget_get_toplevel(pDialogDrawingArea));
+ GtvLokDialogPrivate* priv = getPrivate(pDialog);
+
+ GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(gtk_window_get_transient_for(GTK_WINDOW(pDialog)));
+ LibreOfficeKitDocument* pDocument = lok_doc_view_get_document(LOK_DOC_VIEW(window->lokdocview));
+
+ g_info("lok_dialog_signal_button: %d, %d (in twips: %d, %d)",
+ (int)pEvent->x, (int)pEvent->y,
+ (int)pixelToTwip(pEvent->x),
+ (int)pixelToTwip(pEvent->y));
+ gtk_widget_grab_focus(GTK_WIDGET(pDialog));
+
+ pDocument->pClass->postDialogMouseEvent(pDocument,
+ priv->dialogid,
+ LOK_MOUSEEVENT_MOUSEMOVE,
+ (pEvent->x),
+ (pEvent->y),
+ 1,
+ priv->m_nLastButtonPressed,
+ 0/* Modifier */);
+
+ return FALSE;
+}
+
static void
gtv_lok_dialog_init(GtvLokDialog* dialog)
{
@@ -183,14 +212,17 @@ gtv_lok_dialog_init(GtvLokDialog* dialog)
priv->m_nLastButtonPressTime = 0;
priv->m_nLastButtonReleaseTime = 0;
priv->m_nKeyModifier = 0;
+ priv->m_nLastButtonPressed = 0;
gtk_widget_add_events(GTK_WIDGET(priv->pDialogDrawingArea),
GDK_BUTTON_PRESS_MASK
- |GDK_BUTTON_RELEASE_MASK);
+ |GDK_BUTTON_RELEASE_MASK
+ |GDK_BUTTON_MOTION_MASK);
g_signal_connect(G_OBJECT(priv->pDialogDrawingArea), "draw", G_CALLBACK(gtv_lok_dialog_draw), nullptr);
- g_signal_connect(G_OBJECT(priv->pDialogDrawingArea), "button-press-event", G_CALLBACK(gtv_lok_dialog_signal_button), dialog);
- g_signal_connect(G_OBJECT(priv->pDialogDrawingArea), "button-release-event", G_CALLBACK(gtv_lok_dialog_signal_button), dialog);
+ g_signal_connect(G_OBJECT(priv->pDialogDrawingArea), "button-press-event", G_CALLBACK(gtv_lok_dialog_signal_button), nullptr);
+ g_signal_connect(G_OBJECT(priv->pDialogDrawingArea), "button-release-event", G_CALLBACK(gtv_lok_dialog_signal_button), nullptr);
+ g_signal_connect(G_OBJECT(priv->pDialogDrawingArea), "motion-notify-event", G_CALLBACK(gtv_lok_dialog_signal_motion), nullptr);
gtk_container_add(GTK_CONTAINER(pContentArea), priv->pDialogDrawingArea);
}
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 73bdc7e7ace1..782d5f7f952c 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3702,7 +3702,7 @@ void SwXTextDocument::postDialogMouseEvent(const vcl::DialogID& rDialogID, int n
pDialog->LogicMouseButtonUp(aEvent);
break;
case LOK_MOUSEEVENT_MOUSEMOVE:
- //pDialog->LogicMouseMove(aEvent);
+ pDialog->LogicMouseMove(aEvent);
break;
default:
assert(false);
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index cf078750e4cc..375af4418abc 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -36,6 +36,8 @@
#include <rtl/strbuf.hxx>
#include <sal/log.hxx>
+#include "window.h"
+
#include <vcl/builder.hxx>
#include <vcl/layout.hxx>
#include <vcl/svapp.hxx>
@@ -877,12 +879,7 @@ void Dialog::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(comphelper::LibreOfficeKit::isActive());
- Point aPoint = GetPointerPosPixel();
- SetLastMousePos(rMouseEvent.GetPosPixel());
-
- MouseButtonDown(rMouseEvent);
-
- SetPointerPosPixel(aPoint);
+ ImplWindowFrameProc(this, SalEvent::ExternalMouseButtonDown, &rMouseEvent);
}
void Dialog::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
@@ -890,25 +887,15 @@ void Dialog::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(comphelper::LibreOfficeKit::isActive());
- Point aPoint = GetPointerPosPixel();
- SetLastMousePos(rMouseEvent.GetPosPixel());
-
- MouseButtonUp(rMouseEvent);
-
- SetPointerPosPixel(aPoint);
+ ImplWindowFrameProc(this, SalEvent::ExternalMouseButtonUp, &rMouseEvent);
}
-void Dialog::LogicMouseButtonMove(const MouseEvent& rMouseEvent)
+void Dialog::LogicMouseMove(const MouseEvent& rMouseEvent)
{
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(comphelper::LibreOfficeKit::isActive());
- Point aPoint = GetPointerPosPixel();
- SetLastMousePos(rMouseEvent.GetPosPixel());
-
- MouseMove(rMouseEvent);
-
- SetPointerPosPixel(aPoint);
+ ImplWindowFrameProc(this, SalEvent::ExternalMouseMove, &rMouseEvent);
}
void Dialog::ensureRepaint()