Skip to content

Commit 82138d4

Browse files
authored
Fix webview position upon DragEnter event with QT WebEngine (#536)
* Fix webview position upon DragEnter event with QT WebEngine * Fix unneeded nesting and missing comment
1 parent 2fe5b1a commit 82138d4

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

distrho/extra/WebViewImpl.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,7 @@ struct QEvent {
10691069
uint8_t _[SIZEOF_QEvent];
10701070
enum Type {
10711071
Close = 19,
1072+
DragEnter = 60,
10721073
ContextMenu = 82,
10731074
User = 1000,
10741075
};
@@ -1850,6 +1851,15 @@ class WebViewEventFilter : public QWebChannelAbstractTransport
18501851
return true;
18511852
}
18521853

1854+
// HACK forcing webview window position to update, needed for drop area
1855+
if (type == QEvent::DragEnter && _winId != 0) {
1856+
XWindowAttributes attrs;
1857+
XGetWindowAttributes(_display, _winId, &attrs);
1858+
XMoveWindow(_display, _winId, attrs.x + 1, attrs.y);
1859+
XMoveWindow(_display, _winId, attrs.x, attrs.y);
1860+
XFlush(_display);
1861+
}
1862+
18531863
if (type == QEvent::Close && watched != nullptr && watched == reinterpret_cast<QObject*>(_devToolsView))
18541864
_devToolsView = nullptr;
18551865

0 commit comments

Comments
 (0)