neovim / python-gui

Proof-of-concept Nvim GUI. Not maintained.
Apache License 2.0
75 stars 20 forks source link

2 mouse clicks instead of one #29

Closed Mathiasb17 closed 6 years ago

Mathiasb17 commented 7 years ago

Hello,

When i'm lazy i sometimes prefer using the mouse over vim movements ( :-1: )... like clicking on files in nerdtree or to select some text.

In pynvim, it looks like doing one mouse click automatically does 2 mouse clicks, since i only need to do one click instead of two to open a file or directory in nerdtree (which is pretty annoying if i misclicked), and it takes only one click to expand region in visual mode (which is annoying if i want to select only 2 words for example).

As far as i can tell, this is not the default behavior in neovim, i tried this in neovim-qt and it also seems to be ok.

Is there anyway to configure this in pynvim ?

Cheers,

Mathiasb17

bfredl commented 7 years ago

Adding return True to the end of _gtk_button_press improves it somewhat but not sure it is still completely correct.

diefans commented 7 years ago

I have the same behavior running python-gui in a virtual box

justinmk commented 7 years ago

I've updated the repo description:

Proof-of-concept Neovim GUI. Not maintained, but patches are welcome.

This GUI is mostly a demo. Help in maintaining it would be welcome, but currently there's no one actively maintaining it.

diefans commented 7 years ago

just made some investigation to the problem:

# simple.py
# taken from https://python-gtk-3-tutorial.readthedocs.io/en/latest/introduction.html
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

def log_event(widget, event):
    print("event", widget, event.type)

win = Gtk.Window()
win.connect("delete-event", Gtk.main_quit)
win.connect("button-press-event", log_event)
win.connect("button-release-event", log_event)
win.show_all()
Gtk.main()

results in a duplicate event printed:

# python simple.py
('event', <Gtk.Window object at 0x7ffa3643b370 (GtkWindow at 0x2a74240)>, <enum GDK_BUTTON_PRESS of type Gdk.EventType>)
('event', <Gtk.Window object at 0x7ffa3643b370 (GtkWindow at 0x2a74240)>, <enum GDK_BUTTON_PRESS of type Gdk.EventType>)
('event', <Gtk.Window object at 0x7ffa3643b370 (GtkWindow at 0x2a74240)>, <enum GDK_BUTTON_RELEASE of type Gdk.EventType>)
('event', <Gtk.Window object at 0x7ffa3643b370 (GtkWindow at 0x2a74240)>, <enum GDK_BUTTON_RELEASE of type Gdk.EventType>)

seems to be an issue with pygtk...