[SDL] SDL 2.0 API stabilization

John john at leafygreengames.com
Sat Mar 2 22:57:18 PST 2013


These global fields (of the SDL_mouse struct) are affected: x,y, last_x, last_y, 
xdelta, ydelta, buttonstate. Those fields, in turn, are used to generate the 
event. See SDL_SendMouseButton() and SDL_SendMouseMotion() in 
"src/events/SDL_mouse.c".




On 03/03/2013 12:59 AM, Sik the hedgehog wrote:
> I was asking specifically which parts of the mouse state get affected,
> e.g. position, buttons, etc.
>
> I guess it isn't much of a problem if you're just checking events and
> keep track of the status on your own (which I had to do to work around
> a bug regarding alt+tab), but I assume it can be a big issue if you
> query the mouse state directly (which also won't let you know if touch
> emulation is in place...).
>
> 2013/3/3, John <john at leafygreengames.com>:
>> The state that is affected is the mouse state. SDL maintains mouse state in
>> a
>> global variable. It represents the current state of all the mouse info, x,y,
>>
>> delta, button states, cursor info, etc.  Whenever a mouse event is about to
>> be
>> placed onto the queue, the global mouse state is updated to match the
>> event.
>>
>> The specific issue is that the global mouse state is updated whenever a
>> mouse
>> event is posted, whether or not it is a simulated event. For example, when a
>>
>> touch event is created, a simulated mouse event is also generated, and this
>>
>> alters the global mouse state. Then the simulated event is placed onto the
>> queue, where it is delivered to the application. Applications can discard
>> the
>> event by checking for evt.mouse.which==SDL_TOUCH_MOUSEID, but they cannot
>> discard the global state change that was already committed before the event
>> was
>> delivered.
>>
>>
>>
>>
>>
>> On 03/03/2013 12:21 AM, Sik the hedgehog wrote:
>>> What states could be affected? May want to narrow down the specific
>>> issues that could arise before trying to discuss what to do about it.
>>>
>>> 2013/3/3, John <john at leafygreengames.com>:
>>>> Does the mouse state become affected by delivery of the simulated
>>>> events?
>>>> i.e.,
>>>> will touch events now alter the mouse state?
>>>>
>>>>
>>>> On 03/03/2013 12:09 AM, Sik the hedgehog wrote:
>>>>> Yeah, that seems better. I realized later that SDL_INIT_TOUCH would
>>>>> result in programs using SDL_INIT_EVERYTHING to not get emulated touch
>>>>> input, but I was away by then :/ (honestly using SDL_INIT_EVERYTHING
>>>>> isn't a good idea in the first place, but eh)
>>>>>
>>>>> 2013/3/3, Sam Lantinga <slouken at libsdl.org>:
>>>>>> You can now tell if a mouse event was simulated by touch input.  The
>>>>>> mouse
>>>>>> event has  a new 'which' field and is set to the value
>>>>>> SDL_TOUCH_MOUSEID.
>>>>>>
>>>>>> I talked it over with Ryan and this was the best solution which didn't
>>>>>> involve unexpected behavior changes and still allowed smart
>>>>>> applications
>>>>>> to
>>>>>> do the right thing.
>>>>>>
>>>>>> Cheers!
>>>>>>
>>>>>> On Sat, Mar 2, 2013 at 10:38 AM, Sik the hedgehog <
>>>>>> sik.the.hedgehog at gmail.com> wrote:
>>>>>>
>>>>>>> So basically SDL_INIT_TOUCH? (if a program acknowledges it supports
>>>>>>> touch there isn't any reason to emulate touch events)
>>>>>>>
>>>>>>> 2013/3/2, Sam Lantinga <slouken at libsdl.org>:
>>>>>>>> I agree, this needs to be addressed.
>>>>>>>>
>>>>>>>> Another option is to default touch events off, and deliver mouse
>>>>>>>> events
>>>>>>> if
>>>>>>>> they are off, and touch events if they are enabled.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Sat, Mar 2, 2013 at 9:50 AM, John <john at leafygreengames.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> The android duplicate event issue needs to be addressed before SDL2
>>>>>>>>> is
>>>>>>>>> stable on Android. The patch is in the ticket:
>>>>>>>>> http://bugzilla.libsdl.org/**show_bug.cgi?id=1713<
>>>>>>> http://bugzilla.libsdl.org/show_bug.cgi?id=1713>
>>>>>>>>>
>>>>>>>>> The motivation is that developers cannot currently write a portable
>>>>>>> event
>>>>>>>>> loop in SDL2 if they want to support touch events.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 02/18/2013 02:19 AM, Sam Lantinga wrote:
>>>>>>>>>
>>>>>>>>>> We're on the road to release for SDL 2.0.
>>>>>>>>>>
>>>>>>>>>> To that end, most of the existing APIs are stable, and we'll only
>>>>>>> change
>>>>>>>>>> them if
>>>>>>>>>> it's critical.
>>>>>>>>>> There are a few things which are still being considered, such as
>>>>>>>>>> the
>>>>>>> iOS
>>>>>>>>>> event
>>>>>>>>>> handling, and touch/mouse event semantics, but by and large the
>>>>>>>>>> API
>>>>>>>>>> is
>>>>>>>>>> set for
>>>>>>>>>> release.
>>>>>>>>>>
>>>>>>>>>> Please report bugs which are affecting you in the current
>>>>>>>>>> snapshot:
>>>>>>>>>> http://www.libsdl.org/tmp/SDL-**2.0.zip<
>>>>>>> http://www.libsdl.org/tmp/SDL-2.0.zip>
>>>>>>>>>>
>>>>>>>>>> If anyone wants to fix anything currently in bugzilla, they are
>>>>>>>>>> more
>>>>>>>>>> than
>>>>>>>>>> welcome:
>>>>>>>>>> http://bugzilla.libsdl.org <http://bugzilla.libsdl.org/>
>>>>>>>>>>
>>>>>>>>>> Cheers!
>>>>>>>>>> --Sam
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ______________________________**_________________
>>>>>>>>>> SDL mailing list
>>>>>>>>>> SDL at lists.libsdl.org
>>>>>>>>>> http://lists.libsdl.org/**listinfo.cgi/sdl-libsdl.org<
>>>>>>> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org>
>>>>>>>>>>
>>>>>>>>>>     ______________________________**_________________
>>>>>>>>> SDL mailing list
>>>>>>>>> SDL at lists.libsdl.org
>>>>>>>>> http://lists.libsdl.org/**listinfo.cgi/sdl-libsdl.org<
>>>>>>> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org>
>>>>>>>>>
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> SDL mailing list
>>>>>>> SDL at lists.libsdl.org
>>>>>>> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> SDL mailing list
>>>>> SDL at lists.libsdl.org
>>>>> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>>>>>
>>>> _______________________________________________
>>>> SDL mailing list
>>>> SDL at lists.libsdl.org
>>>> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>>>>
>>> _______________________________________________
>>> SDL mailing list
>>> SDL at lists.libsdl.org
>>> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>>>
>> _______________________________________________
>> SDL mailing list
>> SDL at lists.libsdl.org
>> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>



More information about the SDL mailing list