This is a fix for bug https://bugs.kde.org/show_bug.cgi?id=205902

The problem is that the click event of the middle mouse button onto a tab 
activates it. Therefore, if a tab in the background is closed, the currently 
activated tab looses the focus.

With the attached patch, rekonq won't focus a tab on middle mouse click.
However, we will also loose the possibility to move tabs with the middle mouse 
button (left button still works though), so this fix may need some discussion.
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index bde1e63..02c301d 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -268,6 +268,15 @@ void TabBar::leaveEvent(QEvent *event)
     KTabBar::leaveEvent(event);
 }
 
+void TabBar::mousePressEvent(QMouseEvent *event)
+{
+    // prevent focusing the tab on middle mouse click
+    if (event->button() == Qt::MidButton)
+        return;
+    
+    KTabBar::mousePressEvent(event);
+}
+
 
 void TabBar::updateNewTabButton()
 {
diff --git a/src/tabbar.h b/src/tabbar.h
index 580021c..57b7862 100644
--- a/src/tabbar.h
+++ b/src/tabbar.h
@@ -79,6 +79,7 @@ protected:
     virtual QSize tabSizeHint(int index) const;
     virtual void mouseMoveEvent(QMouseEvent *event);
     virtual void leaveEvent(QEvent *event);
+    virtual void mousePressEvent(QMouseEvent *event);
     
 private slots:
     void cloneTab();
_______________________________________________
rekonq mailing list
rekonq@kde.org
https://mail.kde.org/mailman/listinfo/rekonq

Reply via email to