[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 69340] keyboard repeat does no longer work in HTML forms
From:       David Faure <faure () kde ! org>
Date:       2003-11-30 13:25:24
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
     
http://bugs.kde.org/show_bug.cgi?id=69340     




------- Additional Comments From faure@kde.org  2003-11-30 14:25 -------
Subject: kdelibs/khtml/rendering

CVS commit by faure: 

Fixing autorepeat of arrow keys in e.g. form lineedits.
However autorepeat of text keys doesn't work (no text, see comment in KHTMLView),
and autorepeated arrow keys are also sent to the htmlview (huh? Will need debugging).

Need to discuss this with Seli tomorrow, looks like we have to choose the other
solution for autorepeat.

CCMAIL: 69340@bugs.kde.org


  M +22 -1     render_replaced.cpp   1.150


--- kdelibs/khtml/rendering/render_replaced.cpp  #1.149:1.150
@@ -584,4 +584,25 @@ bool RenderWidget::handleEvent(const DOM
         if (ke)
             static_cast<EventPropagator *>(m_widget)->sendEvent(ke);
+        break;
+    }
+    case EventImpl::KHTML_KEYPRESS_EVENT: {
+
+        // See KHTMLView::dispatchKeyEvent: autorepeat is just keypress in the DOM
+        // but it's keyrelease+keypress in Qt. So here we do the inverse mapping as
+        // the one done in KHTMLView: generate two events for one DOM auto-repeat keypress.
+        // (We know it's auto-repeat if the Qt event is KeyRelease)
+
+        // Reverse drawing as the one in KHTMLView:
+        //  DOM:   Down     Press   |       Press                             |     Up
+        //  Qt:    Press  (nothing) | Release(autorepeat) + Press(autorepeat) |   Release
+
+        QKeyEvent *ke = static_cast<const TextEventImpl &>(ev).qKeyEvent;
+        if (ke && ke->type() == QEvent::KeyRelease) {
+            static_cast<EventPropagator *>(m_widget)->sendEvent(ke);
+            QKeyEvent pressEv( QEvent::KeyPress, ke->key(), ke->ascii(), ke->state(),
+                               ke->text(), true /*autorepeat*/, ke->count() );
+            static_cast<EventPropagator *>(m_widget)->sendEvent(&pressEv);
+        }
+
         break;
     }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic