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

List:       kde-commits
Subject:    branches/KDE/4.1/kdelibs/khtml
From:       Maks Orlovich <maksim () kde ! org>
Date:       2008-08-13 23:57:46
Message-ID: 1218671866.268113.13735.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 846733 by orlovich:

Don't dispatch mouse events to disabled widgets. 
The current behavior matches FF since no event is produced, not even 
at capture or bubble spots.

Also, don't propagate the double-click of disabled widgets up;
but to we even want to do it for enabled ones? That code seems 
prehistoric and may be responsible for #165580

Still need to fix the palette of disabled buttons, though.


 M  +6 -1      khtmlview.cpp  
 M  +1 -0      rendering/render_replaced.h  


--- branches/KDE/4.1/kdelibs/khtml/khtmlview.cpp #846732:846733
@@ -1234,7 +1234,7 @@
                                            d->clickCount,_mouse,true,DOM::NodeImpl::MouseDblClick);
 
     khtml::RenderObject* r = mev.innerNode.handle() ? mev.innerNode.handle()->renderer() : 0;
-    if (r && r->isWidget())
+    if (r && r->isWidget() && !static_cast<RenderWidget*>(r)->isDisabled())
 	_mouse->ignore();
 
     if (!swallowEvent) {
@@ -3596,6 +3596,11 @@
     bool swallowEvent = false;
 
     if (targetNode) {
+	// if the target node is a disabled widget, we don't want any full-blown mouse events
+	khtml::RenderObject* r = targetNode ? targetNode->renderer() : 0;
+	if (r && r->isWidget() && static_cast<RenderWidget*>(r)->isDisabled())
+	    return true;
+
         // send the actual event
         bool dblclick = ( eventId == EventImpl::CLICK_EVENT &&
                           _mouse->type() == QEvent::MouseButtonDblClick );
--- branches/KDE/4.1/kdelibs/khtml/rendering/render_replaced.h #846732:846733
@@ -104,6 +104,7 @@
     static void paintWidget(PaintInfo& pI, QWidget *widget, int tx, int ty);
     virtual bool handleEvent(const DOM::EventImpl& ev);
     bool isRedirectedWidget() const;
+    bool isDisabled() const { return m_widget && !m_widget->isEnabled(); }
 
 #ifdef ENABLE_DUMP
     virtual void dump(QTextStream &stream, const QString &ind) const;
[prev in list] [next in list] [prev in thread] [next in thread] 

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