diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp index e9baa0d7b..6e3be14d1 100644 --- a/src/lib/webengine/webview.cpp +++ b/src/lib/webengine/webview.cpp @@ -1033,7 +1033,7 @@ void WebView::_mouseReleaseEvent(QMouseEvent *event) case Qt::RightButton: if (s_forceContextMenuOnMouseRelease) { QContextMenuEvent ev(QContextMenuEvent::Mouse, event->pos(), event->globalPos(), event->modifiers()); - QApplication::sendEvent(this, &ev); + _contextMenuEvent(&ev); event->accept(); } break; @@ -1116,6 +1116,10 @@ void WebView::resizeEvent(QResizeEvent *event) void WebView::contextMenuEvent(QContextMenuEvent *event) { + // Context menu is created in mouseReleaseEvent + if (s_forceContextMenuOnMouseRelease) + return; + const QPoint pos = event->pos(); const QContextMenuEvent::Reason reason = event->reason(); @@ -1135,14 +1139,6 @@ void WebView::loadRequest(const LoadRequest &req) bool WebView::eventFilter(QObject *obj, QEvent *event) { - if (s_forceContextMenuOnMouseRelease && obj == this && event->type() == QEvent::ContextMenu) { - QContextMenuEvent* ev = static_cast(event); - if (ev->reason() == QContextMenuEvent::Mouse && ev->spontaneous()) { - ev->accept(); - return true; - } - } - // Hack to find widget that receives input events if (obj == this && event->type() == QEvent::ChildAdded) { QObject *child = static_cast(event)->child(); diff --git a/src/plugins/MouseGestures/mousegestures.cpp b/src/plugins/MouseGestures/mousegestures.cpp index 188bf4601..87cf20cba 100644 --- a/src/plugins/MouseGestures/mousegestures.cpp +++ b/src/plugins/MouseGestures/mousegestures.cpp @@ -27,8 +27,7 @@ #include "QjtMouseGesture.h" #include -#include -#include +#include #include MouseGestures::MouseGestures(const QString &settingsPath, QObject* parent) @@ -99,14 +98,6 @@ bool MouseGestures::mousePress(QObject* obj, QMouseEvent* event) { m_view = qobject_cast(obj); - QWebFrame* frame = m_view.data()->page()->mainFrame(); - - if (frame->scrollBarGeometry(Qt::Vertical).contains(event->pos()) || - frame->scrollBarGeometry(Qt::Horizontal).contains(event->pos()) - ) { - return false; - } - if (m_enableRockerNavigation && event->buttons() == (Qt::RightButton | Qt::LeftButton)) { bool accepted = false; @@ -183,11 +174,16 @@ void MouseGestures::upGestured() void MouseGestures::downGestured() { - if (!m_view) { + TabbedWebView* view = qobject_cast(m_view.data()); + if (!view) return; - } - m_view.data()->openNewTab(Qz::NT_SelectedNewEmptyTab); + BrowserWindow* window = view->browserWindow(); + if (!window) + return; + + TabWidget* tabWidget = window->tabWidget(); + tabWidget->addView(QUrl(), Qz::NT_SelectedNewEmptyTab); } void MouseGestures::leftGestured() @@ -245,7 +241,7 @@ void MouseGestures::downUpGestured() BrowserWindow* window = view->browserWindow(); if (!window) return; - + TabWidget* tabWidget = window->tabWidget(); tabWidget->duplicateTab(tabWidget->currentIndex()); } diff --git a/src/plugins/MouseGestures/mousegesturesplugin.cpp b/src/plugins/MouseGestures/mousegesturesplugin.cpp index 512611ece..ed11adfba 100644 --- a/src/plugins/MouseGestures/mousegesturesplugin.cpp +++ b/src/plugins/MouseGestures/mousegesturesplugin.cpp @@ -35,7 +35,7 @@ PluginSpec MouseGesturesPlugin::pluginSpec() spec.name = "Mouse Gestures"; spec.info = "Mouse gestures for QupZilla"; spec.description = "Provides support for navigating in webpages by mouse gestures"; - spec.version = "0.4.0"; + spec.version = "0.5.0"; spec.author = "David Rosca "; spec.icon = QPixmap(":/mousegestures/data/icon.png"); spec.hasSettings = true; diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 21597dad6..8b9d370d8 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -44,6 +44,5 @@ isEqual(QT_MAJOR_VERSION, 5): !qtHaveModule(KWallet): disablePlugin(KWalletPassw disablePlugin(AccessKeysNavigation) disablePlugin(CopyTitle) disablePlugin(MailHandle) -disablePlugin(MouseGestures) disablePlugin(PIM) disablePlugin(Videoner)