Commits

Anonymous committed 671d0f7

Cursor autoHide / focus fix.

svn path=/trunk/kdelibs/kate/; revision=157769

Comments (0)

Files changed (3)

part/part/kateview.cpp

   setInstance( KateFactory::instance() );
   doc->addView( this );
 
-  setFocusProxy( m_viewInternal );
+  setFocusProxy( m_viewInternal->viewport() );
   setFocusPolicy( StrongFocus );
   
   if (!doc->m_bSingleViewMode) {

part/part/kateviewinternal.cpp

   bm.sXPos = 0;
   bm.eXPos = -1;
 
-  viewport()->setFocusProxy( this );   
+  setFocusProxy( viewport() );
   viewport()->setAcceptDrops( true );
   viewport()->setBackgroundMode( NoBackground );
   setDragAutoScroll( true );
 // Overridden to pass events through KCursor auto-hide filter.
 bool KateViewInternal::eventFilter( QObject *obj, QEvent *e )
 {
-  if( obj == viewport() )
+  if( obj == viewport() ) {
+  
     KCursor::autoHideEventFilter( obj, e );
     
-  return QScrollView::eventFilter( obj, e );
-}
-
-void KateViewInternal::focusInEvent( QFocusEvent* e )
-{
-  QScrollView::focusInEvent( e );
-  
-  cursorTimer = startTimer( KApplication::cursorFlashTime() / 2 );
-  paintCursor();
-  
-  emit m_view->gotFocus( m_view );
-}
-
-void KateViewInternal::focusOutEvent( QFocusEvent* e )
-{
-  QScrollView::focusOutEvent( e );
-  
-  if( cursorTimer ) {
-    killTimer( cursorTimer );
-    cursorTimer = 0;
+    if( e->type() == QEvent::FocusIn ) {
+      cursorTimer = startTimer( KApplication::cursorFlashTime() / 2 );
+      paintCursor();
+      
+      emit m_view->gotFocus( m_view );
+    } else if ( e->type() == QEvent::FocusOut ) {
+      if( cursorTimer ) {
+        killTimer( cursorTimer );
+        cursorTimer = 0;
+      }
+      paintCursor();
+      
+      emit m_view->lostFocus( m_view );
+    }
+    
   }
-  paintCursor();
-  
-  emit m_view->lostFocus( m_view );
+    
+  return QScrollView::eventFilter( obj, e );
 }
 
 void KateViewInternal::keyPressEvent( QKeyEvent* e )

part/part/kateviewinternal.h

 
     bool event( QEvent* );
     bool eventFilter( QObject*, QEvent* );
-    void focusInEvent(  QFocusEvent* );
-    void focusOutEvent( QFocusEvent* );
     void keyPressEvent( QKeyEvent* );
     void contentsMousePressEvent(       QMouseEvent* );
     void contentsMouseDoubleClickEvent( QMouseEvent* );