Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: double click ?  (Read 12729 times)

0 Members and 2 Guests are viewing this topic.

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: double click ?
« Reply #15 on: October 19, 2017, 08:33:41 pm »
CS_DBLCLKS is a window class style, we have one window class that is shared between all windows so we can't set/unset it per window (I didn't even yet see if you can set class window styles at creation or later too like with SetWindowLongPtr for window styles per handle). :'(

On the other hand, there is this function to query: https://msdn.microsoft.com/en-us/library/windows/desktop/ms646258(v=vs.85).aspx

There also isn't a triple click.
Maybe we should go with an int after all? Or even just expose the above function as static in Window or Mouse and make it return Time?

First draft for sequence field in event (beware, the int will be uninitialized outside Windows  :P ):
Branch: https://github.com/FRex/SFML/tree/multiclickwin32only
Test: https://gist.github.com/FRex/83ab096bacb356afcf6fabd97f7ab841
Back to C++ gamedev with SFML in May 2023

barnack

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Re: double click ?
« Reply #16 on: October 26, 2017, 03:19:25 pm »
Yeah, Windows offers you a double click event, but you gotta check if Linux does as well.
Also, yes, as you said double click timing is an user setting on Windows, but you can check in many games, there's an in-game setting for double click timing. Can't you do the same?
(Also note, to distinct double clicks you'd also have to delay the single click event, since when the first click occurs you have no way to know if the second is coming or not. Unless you want to do statistics based on mouse position over certain items, but that'd be crazy, un efficient and... crazy)

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: double click ?
« Reply #17 on: October 26, 2017, 03:37:35 pm »
Windows doesn't delay the first event so neither should we, that'd be a horrible lag if it did that.

Setting double click time in the app regardless of what the OS has.. I'm not sure. You can handle it ALL (timing, handling double, triple, qurduple, etc. click events in your code) yourself then using what SFML now has.

Although getting double click time from the OS might be a nice default/reset for your setting (i.e. it's adjustable but you can reset it to 'get double click time from OS') so there's a use case.

On the other hand, X apparently has no double click (the WM does): https://github.com/glfw/glfw/issues/462 so.. yeah. We're left with:
  • New event type, native but not toggleable on Windows, must be 'emulated' on Linux, also no triple or quadruple click
  • Just provide a getDoubleclickTime function to wrap the Windows one, on Linux return some sane value
  • 'Emulated' everywhere via a count field on all with user defined time or 'native' time on Windows if SFML user didn't set any
  • Do nothing ;D

I also have no idea about Mac (I don't own one, I don't know Obj C, it's hard and illegal to run OS X on non-Apple machines, etc.).
Back to C++ gamedev with SFML in May 2023