Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Respect the default system double-click interval #1090

Merged
merged 4 commits into from Oct 28, 2018

Conversation

Luflosi
Copy link
Contributor

@Luflosi Luflosi commented Oct 24, 2018

As discussed in #1088. The goal is to set the click_interval to the system default if the option is missing or set to system.
The current code will currently most likely break horribly on any platform that is not macOS.
Where should I put the platform specific code that gets the value from the system? glfw? If so, in which file does it fit best?

@kovidgoyal
Copy link
Owner

the best place for this kind of thing is in glfw. Look at glfw/*_window.c

you will need to add new API to glfw to return the platform double click interval, which should go into glfw3.h. Once you add the declaration to that file run ./glfw/glfw.py to auto-update glfw-wrapper.h

To start with just have the functions for wayland and x11 return default values.

@Luflosi
Copy link
Contributor Author

Luflosi commented Oct 24, 2018

Ok, I got that. Now what's the best way to use that new function? Do I somehow call it directly from the parser in python or do I just let the parser put a negative number into the click_interval variable in state.h and then overwrite it immediately using c code?

@kovidgoyal
Copy link
Owner

use a negative number

@Luflosi
Copy link
Contributor Author

Luflosi commented Oct 25, 2018

Where should I overwrite that negative number with the value returned from glfw?

@kovidgoyal
Copy link
Owner

probably do it in create_os_window() for the first time the window is created, yu can be sure glfw is properly initialized then.

@Luflosi
Copy link
Contributor Author

Luflosi commented Oct 26, 2018

Could you review the code please?

@kovidgoyal
Copy link
Owner

Looks fine in general. I suggest changing the default in config_data.py for click_interval and adding some help text about negative values meaning to use system default. It would also be nice to figure out how to get this value from the system for X11 and wayland, but not critical.

@kovidgoyal
Copy link
Owner

Oh and I meant change the default to -1

@Luflosi
Copy link
Contributor Author

Luflosi commented Oct 26, 2018

Is the following description good or could it be improved?
The interval between successive clicks to detect double/triple clicks (in seconds). Negative numbers will use the system default instead (this only works on macOS currently, X11 and Wayland will use the default value of 0.5 in this case)

@kovidgoyal
Copy link
Owner

Dont bother with mentioning where it does not work, just say, will use the system default, if available or fallback to 0.5. That way we dont have to remember ot change the description if someone later adds support for wayland/x11

@Luflosi
Copy link
Contributor Author

Luflosi commented Oct 27, 2018

Like this?

@kovidgoyal kovidgoyal merged commit 09daaf1 into kovidgoyal:master Oct 28, 2018
@Luflosi
Copy link
Contributor Author

Luflosi commented Oct 28, 2018

Any idea on how to do it in X11 and/or Wayland? I didn't find anything useful but I also know pretty much nothing about writing code for X11 and Wayland. I did find a function that should do the right thing on windows though.

@kovidgoyal
Copy link
Owner

IIRC X11 uses the X resources system, you'd need to read the mouseClickTimes resource onthe window and the root window, but it is not widely used, so I wouldn't worry about it. No idea about wayland.

@Luflosi
Copy link
Contributor Author

Luflosi commented Oct 29, 2018

Would be nice to have feature parity between the different platforms, maybe you could look into it when you have some time again and nothing more important to do

@Luflosi Luflosi deleted the system_double_click_interval branch November 11, 2018 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants