Patch for MMB on file upload
Harri Porten
porten at kde.org
Sat Oct 18 20:57:22 BST 2008
Hi!
David reported that it is impossible to paste text into file upload
elements with the middle-mouse button. Here is the result of my debugging
session and a proposed fix.
The file upload element is different from other form elements because
KUrlRequester is a composite of two QWidgets (a KLineEdit and a
KPushButton). I found out that a MMB click does not have a symmetric event
delivery. The mouse press event goes to the embedded KLineEdit but the
release goes to the KUrlRequester. Hence the past within
QPushButton::mouseReleaseEvent() is not triggered.
The asymmetry stems from RenderWidget::handleEvent() make the following
exception for *left* mouse buttons on press
if ( button == Qt::LeftButton )
view()->setMouseEventsTarget( target );
but unconditionally using the result on release:
target = view()->mouseEventsTarget();
My naive fix (attached) consists of doing this for the left button only:
if ( button == Qt::LeftButton )
target = view()->mouseEventsTarget();
Whether this is the real and full fix I don't know. Maybe we should be
doing this for all buttons. Then there are differences between press and
release when it comes to the target widget.
Harri.
-------------- next part --------------
Index: rendering/render_replaced.cpp
===================================================================
--- rendering/render_replaced.cpp (revision 873041)
+++ rendering/render_replaced.cpp (working copy)
@@ -1015,7 +1015,8 @@
if ( button == Qt::LeftButton )
view()->setMouseEventsTarget( target );
} else {
- target = view()->mouseEventsTarget();
+ if ( button == Qt::LeftButton )
+ target = view()->mouseEventsTarget();
if (target) {
QWidget * parent = target;
while (parent && parent != m_widget)
More information about the kfm-devel
mailing list