Guake / guake

Drop-down terminal for GNOME
https://guake.github.io
GNU General Public License v2.0
4.41k stars 576 forks source link

Mouse shortcuts conflict with terminal apps and are non-configurable. #1674

Open SoniEx2 opened 4 years ago

SoniEx2 commented 4 years ago

Be sure to check the existing issues (both open and closed!), and make sure you are running the latest version of Guake.

For how to run the latest Guake in your computer, please refer to Install from source.

Describe the bug

A clear and concise description of what the bug is.

Mouse shortcuts such as double-clicking the current tab conflict with things such as vim and tmux in mouse mode.

Expected behavior

A clear and concise description of what you expected to happen.

Mouse shortcuts would be ignored by guake or require shift to be pressed while mouse mode is active.

Actual behavior

What you actually get.

Guake takes over.

To Reproduce

Provide the steps to reproduce the behavior

Open guake, run vim or tmux with mouse mode enabled, and double-click guake.


Please run $ guake --support, and paste the results here. Don't put backticks (`) around it! The output already contains Markdown formatting. And make sure you run the command OUTSIDE the Guake.

$ guake --support Guake Version: 3.6.3 Vte Version: 0.58.2 Vte Runtime Version: 0.58.2 -------------------------------------------------- GTK+ Version: 3.24.12 GDK Backend: GdkX11.X11Display -------------------------------------------------- Desktop Session: None -------------------------------------------------- Display: :0 RGBA visual: True Composited: True * Monitor: 0 - GSM DVI-I-1 * Geometry: 1920 x 1080 at 0, 0 * Size: 477 x 268 mm² * Primary: True * Refresh rate: 60.00 Hz * Subpixel layout: horizontal-rgb
SoniEx2 commented 4 years ago

I'd also be happy with an option to disable mouse shortcuts in guake. Currently not seeing any way to do that.

egmontkob commented 4 years ago

You only have trouble with double (and maybe triple) clicks, not single clicks, correct?

Guake should review all the combinations of double (event.type == Gdk.EventType._2BUTTON_PRESS a.k.a. DOUBLE_BUTTON_PRESS) and triple (_3BUTTON_PRESS a.k.a. TRIPLE_BUTTON_PRESS), combined with left, middle and right button.

When you double click, on the first click a single press event is generated (for single click), and on the second click two press events are generated by GTK (a single click and a double click). And again two press events (a single and a triple) if you quickly click again.

The mouse reporting protocol for terminal emulators doesn't support "double click" and "triple click" events, so only single clicks are reported. Correspondingly:

For the left button: A single click is always handled by VTE: depending on the app running inside, either VTE itself starts selecting text, or forwards the click to the application. Accordingly, the event handler returns true. A double/triple click is handled by VTE (returns true) if no mouse-aware app is running inside, it selects a word or a line. But when a mouse-aware app is running inside, the double/triple click event is not handled by VTE and thus returns false.

I think it's the same for the middle click (pastes if the app is not interested in it). – Update: err, wait... doubles and triples aren't handled by VTE here.

For the right button: A single click is handled by VTE only if a mouse-aware app is running inside. A double/triple click is never handled by VTE. The return value, again, reflects this.

I guess what Guake should do is simply not to want to do anything itself on double and triple clicks: either VTE handles it or nothing happens.

gsemet commented 4 years ago

No sure on how to rework all the mouse click handling code for that, may be quite tricky. I think it is because we are notified too early (we get the notification and if we do nothing vte can handle that to the application... should be the other way around)

egmontkob commented 4 years ago

Could you please elaborate? I'm not sure I understand you.

Guake gets the event first, since it hooks up to VTE's on_button_press. It may do with it anything that it wants, including calling VTE's handler (Vte.Terminal.do_button_press_event()) if it wants to, potentially even with a modified event (e.g. removing a keyboard modifier), and then it can continue with arbitrary further actions (e.g. popping up a menu) based on VTE's return value (whether it handled it or not). Finally, I think via the return value of Guake's on_button_press you control whether VTE should receive the original event or not (I'm not entirely sure about this).

I think this is flexible enough for you to do anything you reasonably might want to. Many other VTE-based apps successfully do it, without unintended side effects on a double-click.

What is the exact user-visible behavior that you want to implement, and which cell of that do you believe can't be done? It's a giant matrix with many dimensions: