After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 13299 - gnome-terminal: Bad Shift + Right Button behavior in mc
gnome-terminal: Bad Shift + Right Button behavior in mc
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
unspecified
Other other
: Normal minor
: vte-0-36
Assigned To: VTE Maintainers
VTE Maintainers
[fixed-0-36][needed-next][commit:105f...
: 86943 108230 610629 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2000-06-06 03:34 UTC by utx
Modified: 2014-04-16 17:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
vte patch, updated to 0.34.9 (3.93 KB, patch)
2013-10-17 00:51 UTC, Egmont Koblinger
committed Details | Review
g-t patch, updated to 3.10.1 (2.56 KB, patch)
2013-10-17 00:52 UTC, Egmont Koblinger
committed Details | Review

Description utx 2001-01-27 20:01:33 UTC
Package: gnome-core
Version: 1.2.0
Details:

I have sent a feature request to mc developers about right mouse button
behavior when shift is pressed in mc in gnome-terminal:

On Tue, Apr 18, 2000 at 09:38:02AM +0200, Stanislav Brabec wrote:
> I have small "feature request" to mc, which makes mc much more powerfull
> with combination with gnome-terminal.
>
> As tips says, when pressed Shift, Left and Middle Button is not catched
> by mc and are sent to terminal (very useful for clip and paste).
>
> And my request is same behavior for Right Button - it opens menu in gnome-
> terminal, which allows, for example, follow http/ftp link.
> Now it's impossible inside mc, because right key is catched.
> So what about sending of Shift + Right Button to terminal?
>

And I have got answer:

On Thu, Apr 27, 2000 at 06:08:15PM +0200, Bjorn Eriksson wrote:
>  This behaviour is not a feature of mc itself. When shift is pressed no
> mouse info ever get sent to mc. You'll have to bug the gnome-terminal
> developers instead. (I don't use gnome-term.)

-- 
Stanislav Brabec




------- Additional Comments From utx@k332.feld.cvut.cz 2000-06-05 03:59:28 ----

Subject: gnome-terminal: Shift + Right Button behavior
From: Stanislav Brabec <utx@k332.feld.cvut.cz>
To: bugs@gnome.org
Message-Id: <20000605095928.A5229@utx.cz>
Date: Mon, 5 Jun 2000 09:59:28 +0200

Package: gnome-core
Version: 1.2.0
Details:

I have sent a feature request to mc developers about right mouse button
behavior when shift is pressed in mc in gnome-terminal:

On Tue, Apr 18, 2000 at 09:38:02AM +0200, Stanislav Brabec wrote:
> I have small "feature request" to mc, which makes mc much more powerfull
> with combination with gnome-terminal.
>
> As tips says, when pressed Shift, Left and Middle Button is not catched
> by mc and are sent to terminal (very useful for clip and paste).
>
> And my request is same behavior for Right Button - it opens menu in gnome-
> terminal, which allows, for example, follow http/ftp link.
> Now it's impossible inside mc, because right key is catched.
> So what about sending of Shift + Right Button to terminal?
>

And I have got answer:

On Thu, Apr 27, 2000 at 06:08:15PM +0200, Bjorn Eriksson wrote:
>  This behaviour is not a feature of mc itself. When shift is pressed no
> mouse info ever get sent to mc. You'll have to bug the gnome-terminal
> developers instead. (I don't use gnome-term.)

-- 
Stanislav Brabec




------- Bug moved to this database by debbugs-export@bugzilla.gnome.org 2001-01-27 15:01 -------
This bug was previously known as bug 13299 at http://bugs.gnome.org/
http://bugs.gnome.org/show_bug.cgi?id=13299
Originally filed under the gnome-core product and general component.

Unknown version 1.2.x in product gnome-core. Setting version to the default, "unspecified".
The original reporter (utx@k332.feld.cvut.cz) of this bug does not have an account here.
Reassigning to the exporter, debbugs-export@bugzilla.gnome.org.
Reassigning to the default owner of the component, gnome-core-maint@bugzilla.gnome.org.

Comment 1 Kjartan Maraas 2001-09-18 22:32:10 UTC
Has this been fixed in a later release?
Comment 2 Ross Burton 2002-01-23 17:00:32 UTC
Mass-closing what appear to be old bugs.  If this is still a bug for you, feel
free to open it again.  Filter on the phrase "Ross is breaking things again" if
you get lots of these messages.
Comment 3 Ross Burton 2002-01-29 20:06:04 UTC
Stanislav Brabec <utx@penguin.cz> mailed me with the following
information:

In Gnome 1.4 the problem is still present.
Simple test is mc. Run mc, press Shift and Right Button. You should
see gnome-terminal menu, but you don't.
Comment 4 Kjartan Maraas 2002-03-13 01:57:08 UTC
Confirmed on 1.4.0.6
Comment 5 Kjartan Maraas 2002-08-17 11:22:11 UTC
Not sure this is a bug. We want to let some console apps get the mouse
events and it's hard to decide when that is not the case.
Comment 6 Stanislav Brabec 2002-08-18 19:05:47 UTC
There is following mouse click convention, introduced by xterm:
- If application requests mouse click watching, simple mouse clicks
are delivered to application.
- Shift-mouse clicks are never delivered to application and are used
for purposes of terminal.

This behavior is not present nor in Gnome1's gnome-terminal
(Shift-clicks are not delivered to gnome-terminal) nor Gnome2's
gnome-terminal (aka profterm) (simple right click should be delivered
to application, if requested, in such case menu should be accessible
only via Shift-right click).
Comment 7 Kjartan Maraas 2002-10-11 16:12:47 UTC
Havoc, care to comment on this?
Comment 8 Havoc Pennington 2002-10-11 17:06:07 UTC
Should be moved to vte or libzvt as appropriate.
I guess it's fine to do, as long as Shift is down.
Comment 9 Kjartan Maraas 2002-10-12 12:42:52 UTC
Moving to libzvt.
Comment 10 Kjartan Maraas 2005-01-05 09:48:38 UTC
Moving to vte. It seems that this doesn't work in xterm either though...
Comment 11 Stanislav Brabec 2005-01-05 10:59:01 UTC
Works for me in xterm (xorg-6.8.1, SuSE Linux 9.2), as described above. Does not
work in gnome-terminal.

xterm

right click - block marking (function of xterm)

mc
right click - select/deselect (function of mc)
Shift + right click - block marking (function of xterm)
Comment 12 Kjartan Maraas 2005-02-14 14:49:36 UTC
I see the following:

- left click on mc menus works in both g-t and xterm
- shift right click to do block marking (while runnning mc) only works under xterm
- shift right click seems to work when not running an application in g-t

Does this sum up this bug? And do you see the same behaviour on SuSE?
Comment 13 Stanislav Brabec 2005-02-14 15:30:43 UTC
No. Block marking is a default function of xterm for right click. Default
fonction for gnome-terminal is menu pop-up and it's OK.

At least in SuSE 9.2 I see following: If mc catches right click, it does
toggle-selection. In xterm, it is possible by simple right click. Shift right
click is passed directly to xterm and does block marking. In gnome-terminal,
using toggle selection is not possible, because click is never delivered to mc.

There is a sum of expected behavior:

Simple right click should be delivered to terminal application, if terminal
application can handle it. If it does not, it should be passed to terminal emulator.

Shift right click should passed directly to terminal emulator and do the same as
simple right click does for terminal applications not handling it.

mc = terminal application
gnome-terminal = terminal emulator

Exactly the same already works for left and middle clicks (and even for scroll
wheel).
Comment 14 Kjartan Maraas 2005-03-02 14:24:09 UTC
Yeah, I see this as well. Need to compare what xterm does and what vte does
codewise I guess.
Comment 15 Behdad Esfahbod 2006-04-12 07:55:03 UTC
I almost tracked this down.  Currently vte simply ignores right-click and passes it on to the application.  gnome-terminal on the other hand, reacts on right-clicks that happen without any modifiers, and pops up the context menu.

We should change these to:

  * gnome-terminal should also popup if shift is pressed with right click. (it's all in terminal_screen_button_press_event)

  * when shift is not pressed, gnome-terminal should first emit the right click signal to the vte terminal, and popup a menu only if the signal was not handled by vte.

  * vte should be changed to return FALSE on mouse events when it didn't handle them and the client had not requested to be notified of those kind of mouse events.

I don't quite know how to do the second step, although I'm sure it's quite possible and easy.
Comment 16 Behdad Esfahbod 2006-04-12 08:48:12 UTC
Implemented this.  Patches for vte and gnome-terminal follow.  Please review.
Comment 17 Stanislav Brabec 2006-04-12 09:57:59 UTC
What is the difference of your implementation of right click handling and left and middle click handling?

Please note, that I have just filled new bug, which describes the same problem with mouse wheel events: bug 338194
Comment 18 Behdad Esfahbod 2006-04-12 10:30:20 UTC
The difference is that right-click is handled by gnome-terminal, while others are handled by vte.  I'll look into bug 338194 later.  Doesn't look hard to do.
Comment 19 Behdad Esfahbod 2006-04-12 10:32:12 UTC
Ah, attached to the wrong bug :(.  Here they are:

vte patch: attachment 63289 [details] [review].
g-t patch: attachment 63290 [details] [review].
Comment 20 Behdad Esfahbod 2006-04-16 23:05:49 UTC
I've been using g-t with these patches since, and unfortunately it doesn't look good.  Seems to me like ncurses does request to be notified of the mouse events no matter whether the application uses them or not.  So in vim and pine I keep wondering why right-click on URLs doesn't work anymore, to remember that I have to press shift too...   Not sure if this can be solved at all.
Comment 21 Stanislav Brabec 2006-04-17 19:58:21 UTC
You can use the behavior of xterm as a reference. g-t should pass mouse clicks/rolls in exactly the same way. I don't see a problem there - Shift+Right Button should work in any case.
Comment 22 Behdad Esfahbod 2006-04-17 20:09:52 UTC
And what is the xterm behavior?  My xterm doesn't have a context menu enabled by right-click, so I don't see how we can use the behavior of xterm as a reference.
Comment 23 Stanislav Brabec 2006-04-17 20:34:07 UTC
xterm behavior:
without Shift (or other modifier key) - if application requests clicks, pass clicks to application, otherwise handle click by terminal
with Shift (or other modifier key) - do not pass click to application, handle click by terminal

The meaning of click for terminal can differ, but meaning for application should be the same.

Right click in xterm does additive selection, i g-t context menu.
Comment 24 Behdad Esfahbod 2006-04-20 13:43:46 UTC
*** Bug 108230 has been marked as a duplicate of this bug. ***
Comment 25 Behdad Esfahbod 2006-05-08 10:30:30 UTC
*** Bug 86943 has been marked as a duplicate of this bug. ***
Comment 26 Christian Persch 2010-02-21 20:28:09 UTC
*** Bug 610629 has been marked as a duplicate of this bug. ***
Comment 27 Behdad Esfahbod 2010-02-22 03:02:39 UTC
(In reply to comment #23)
> xterm behavior:
> without Shift (or other modifier key) - if application requests clicks, pass
> clicks to application, otherwise handle click by terminal
> with Shift (or other modifier key) - do not pass click to application, handle
> click by terminal

That's exactly what g-t does also.  Did you read my previous comments as well as comment #20?
Comment 28 Stanislav Brabec 2010-02-22 10:44:51 UTC
>> without Shift (or other modifier key) - if application requests clicks, pass
>> clicks to application, otherwise handle click by terminal
>That's exactly what g-t does also.

Not for me in gnome-terminal-2.28.2. Expecting selection with right click in mc, I get g-t context menu.

> Did you read my previous comments as well
> as comment #20?

Yes, I read.

I can imagine solution that can satisfy everybody: Make it configurable:

Simple way:
Pass clicks to application
Left click: With Shift/Without Shift/Always/Never
Right click: With Shift/Without Shift/Always/Never
Middle click: With Shift/Without Shift/Always/Never
Scroll wheel: With Shift/Without Shift/Always/Never

Advanced way:
Pass clicks to application
Left click: With modifier/Without modifier/Always/Never  Modifier: Shift/...
Right click: With modifier/Without modifier/Always/Never  Modifier: Shift/...
Middle click: With modifier/Without modifier/Always/Never  Modifier: Shift/...
Scroll wheel: With modifier/Without modifier/Always/Never  Modifier: Shift/...

The current behavior in xterm:
Left: Without Shift, Right: Without Shift, Middle: Without Shift, Scroll wheel: Without Shift

The current behavior in g-t:
Left: Without Shift, Right: Never, Middle: Without Shift, Scroll wheel: Without Shift

Both xterm and g-t have special behavior for Scroll wheel: If application requests scroll wheel, it is passed only wihout Shift. With Shift, nothing happens: Event is not sent to the application nor the terminal.
Comment 29 Behdad Esfahbod 2010-02-22 18:58:47 UTC
(In reply to comment #28)
> >> without Shift (or other modifier key) - if application requests clicks, pass
> >> clicks to application, otherwise handle click by terminal
> >That's exactly what g-t does also.
> 
> Not for me in gnome-terminal-2.28.2. Expecting selection with right click in
> mc, I get g-t context menu.

Sorry, my bad.  If we made it behave like xterm, there will be the issue in comment 20.

I'm leaning toward going ahead and committing that patch though.  Right now right-click is never sent...

ChPe, what do you think?
Comment 30 Skip Sloan 2010-02-23 02:51:43 UTC
>I'm leaning toward going ahead and committing that patch though.  Right now
>right-click is never sent...

Hi,

I'm new to the conversation, but hopefully I can bring a newbies perspective :)

I believe right-click should go to the application, and shift-right-click should go to the terminal.

All the apps, that support it, say right-click in their man pages. The terminal should honor that!

That's my thought. YeeHaaw! Patch it up!!!

Thank you!
Comment 31 Tomas Cech 2011-03-01 19:34:26 UTC
still valid for gnome-terminal-2.30.1. Xfce terminal which also use vte behaves correctly.
Comment 32 Egmont Koblinger 2013-10-16 23:57:57 UTC
A 13 year old bug, still not resolved :(

Behdad, your comment 20 seems to be incorrect or outdated to me. First, neither vim nor pine (alpine, actually) use ncurses (checked on Ubuntu Saucy). Second, apps using ncurses (e.g. mutt) that don't use mouse don't initialize it either (the mouse cursor stays a vertical bar, and left mouse button highlights without shift needed).

I think the desired behavior is clear. Right click should go to the application if it's interested in mouse events. Popup is fine for Shift+rightclick, or when the application doesn't care about mouse.
Comment 33 Egmont Koblinger 2013-10-17 00:51:41 UTC
Created attachment 257470 [details] [review]
vte patch, updated to 0.34.9
Comment 34 Egmont Koblinger 2013-10-17 00:52:05 UTC
Created attachment 257471 [details] [review]
g-t patch, updated to 3.10.1
Comment 35 Behdad Esfahbod 2013-10-22 13:43:50 UTC
Egmont, if you are comfortable with git please push out a git tree so I can at least easily cherry-pick.  Unfortunately I have very little time for vte these days.  You really should be pushing out patches yourself, but if you don't like to do that, having a git tree is a more comfortable middle ground.  Thanks!
Comment 36 Egmont Koblinger 2013-10-23 11:21:32 UTC
I've created https://github.com/egmontkob/vte-0-36-egmont with my all proposed vte patches.
Comment 37 Christian Persch 2013-11-18 18:16:58 UTC
Committed to vte-0-36 and g-t master.

Moving to vte to keep open for vte-next work.