Bug 82908

Summary: Tab context menu doesn't popup
Product: [Applications] konsole Reporter: Kurt Hindenburg <khindenburg>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Snapshot of working and non working context tab menu.

Description Kurt Hindenburg 2004-06-05 21:57:40 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

The tab context menu does not popup when the left-most visible tab is 'cut-off'.  I'll attach a screen shot that clearly shows what I mean.
Comment 1 Kurt Hindenburg 2004-06-05 21:59:11 UTC
Created attachment 6254 [details]
Snapshot of working and non working context tab menu.
Comment 2 Stephan Binner 2004-06-05 22:26:45 UTC
Ok, can reproduce this one. Thought before you talk about the 'new-tab' popup menu because you said left-clicking. :-)
Comment 3 Stephan Binner 2004-06-05 22:42:37 UTC
CVS commit by binner: 

Bug 82908: Tab context menu doesn't popup
CCMAIL: 82908-done@bugs.kde.org


  M +8 -6      ktabwidget.cpp   1.32


--- kdelibs/kdeui/ktabwidget.cpp  #1.31:1.32
@@ -219,10 +219,12 @@ bool KTabWidget::isEmptyTabbarSpace( con
     QSize size( tabBar()->sizeHint() );
     if ( ( tabPosition()==Top && point.y()< size.height() ) || ( tabPosition()==Bottom && point.y()>(height()-size.height() ) ) ) {
-#if QT_VERSION >= 0x030200
         // QTabWidget::cornerWidget isn't const even it doesn't write any data ;(
         KTabWidget *that = const_cast<KTabWidget*>(this);
-        if ( that->cornerWidget( TopLeft ) )
+        QWidget *leftcorner = that->cornerWidget( TopLeft );
+        if ( leftcorner ) {
+            if ( point.x()<=leftcorner->width() )
+                return true;
             point.setX( point.x()-size.height() );
-#endif
+        }
         if ( tabPosition()==Bottom )
             point.setY( point.y()-( height()-size.height() ) );


Comment 4 Kurt Hindenburg 2004-06-06 02:18:21 UTC
Left handed mouse... :-()

I'm glad I didn't waste any time trying to fix this... ;-))

Works O.K.
Comment 5 Stephan Binner 2004-06-10 11:19:18 UTC
CVS commit by binner: 

Don't consider corner widgets as empty tabbar space (don't you expect it too?)

Kurt, there are some small gaps between the full tabbar and the corner widgets
which allow dnd and context menu but in general the application has to imple-
ment the full wanted behavior for the corner widgets it sets now itself.
CCMAIL: 82908@bugs.kde.org


  M +7 -2      ktabwidget.cpp   1.33


--- kdelibs/kdeui/ktabwidget.cpp  #1.32:1.33
@@ -221,8 +221,13 @@ bool KTabWidget::isEmptyTabbarSpace( con
         // QTabWidget::cornerWidget isn't const even it doesn't write any data ;(
         KTabWidget *that = const_cast<KTabWidget*>(this);
+        QWidget *rightcorner = that->cornerWidget( TopRight );
+        if ( rightcorner ) {
+            if ( point.x()>=width()-rightcorner->width() )
+                return false;
+        }
         QWidget *leftcorner = that->cornerWidget( TopLeft );
         if ( leftcorner ) {
             if ( point.x()<=leftcorner->width() )
-                return true;
+                return false;
             point.setX( point.x()-size.height() );
         }


Comment 6 Kurt Hindenburg 2004-06-17 22:30:44 UTC
Now I can't get the context menu to popup at all...

It worked with the Comment #3 patch, but not with the Comment #5 patch.

I also notice that konqueror is the same... no context menu on the newtab button.
Comment 7 Kurt Hindenburg 2004-06-18 09:31:02 UTC
I just update CVS and the context menus still don't work at all;  even with just 1 tab open.
Comment 8 Stephan Binner 2004-06-18 09:48:21 UTC
Did you read comment 5?
Comment 9 Kurt Hindenburg 2004-06-18 10:17:26 UTC
Read? Yes. Understand? No.

To get the tab context menu, now, you have to click on an empty space on the tabbar.  Of course, if there are no empty spaces (ie. the tab arrows are showing) then you are out of luck.

I'm rather puzzled by this change...
Comment 10 Stephan Binner 2004-06-18 10:20:59 UTC
> To get the tab context menu, now, you have to click on an empty space on the tabbar.

Unless the application doesn't handle right clicks for its buttons, yes. Please feel invited to change Konsole.
Comment 11 Kurt Hindenburg 2004-06-18 11:34:36 UTC
O.K. I see what you mean.  Before the context menu was a mis-feature.  corner widget == empty space.

Here's a quickie... it appears to work... I'll look at it again later when I have more time.


Index: konsole.cpp
===================================================================
RCS file: /home/kde/kdebase/konsole/konsole/konsole.cpp,v
retrieving revision 1.465
diff -u -p -r1.465 konsole.cpp
--- konsole.cpp 15 Jun 2004 15:19:02 -0000      1.465
+++ konsole.cpp 18 Jun 2004 09:33:31 -0000
@@ -941,6 +941,12 @@ bool Konsole::eventFilter( QObject *o, Q
         return true;
       }
     }
+    else if (ev->type() == QEvent::ContextMenu)
+    {
+      QMouseEvent* mev = static_cast<QMouseEvent*>(ev);
+      slotTabbarContextMenu(mev->globalPos());
+      return true;
+    }
   }
   return KMainWindow::eventFilter(o, ev);
 }
Comment 12 Kurt Hindenburg 2004-06-19 07:36:12 UTC
Applied.