Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
ImGui new thread - Page 15 — Gideros Forum

ImGui new thread

191011121315»

Comments

  • now a (pen) touch event generates a mouse event, which is handled by imgui. but also there is the pen event which is handled behind in my drawing area. how can i prevent this? can i somehow stop eventpropagation of the touch event if imgui 'got it' as a mouse event?
  • perhaps the hovering thing is also a problem in gideros? @hgy29 ? i shall test later.
  • rrraptorrrraptor Member
    edited November 13
    keszegh said:

    perhaps the hovering thing is also a problem in gideros? @hgy29 ? i shall test later.

    Because tablet events treated as touch events which only triggers if something is touching the screen or tablet in your case.
  • rrraptor said:

    keszegh said:

    perhaps the hovering thing is also a problem in gideros? @hgy29 ? i shall test later.

    Because tablet events treated as touch events which only triggers if something is touching the screen or tablet in your case.
    yes, actually would be more logical for gideros to treat pen events as mouse events and not as touch events. (As there is only one pen anyway so multitouch is not needed)
  • keszeghkeszegh Member
    edited November 13
    so i'm having this issue with how to stop propagation of event. i used IO:wantCaptureMouse() but now with mouse/touch invoking the other i have an issue that the event pressing the imgui button is a touch event even behind the button on my gideros object when IO:wantCaptureMouse() is still false. how can i prevent this?

    in particular, in the Constructor i've noticed a touch_listeners thing:
    ImGui.new([font_atlas = nil, mouse_listeners = true, keyboard_listeners = true, touch_listeners = false])

    what happens if i set it true? i thought that maybe then i won't need that touch events create mouse events, but it is not the case.
  • after i click on the pen button on an imgui element then it seems that IO:wantCaptureMouse() will be true forever.

    so all in all how can i consistently stop propagation of pen/mouse events when it was on some imgui element?
  • so i'm stuck with how to prevent getting touch info for an imgui related event.

    i think the problem is that the touches_down event happens first, my drawing layer registers it. then only afterwards it propagates a mouse event which imgui gets and sets wantCaptureMouse() properly, but too late as before this there is no way to know that the touch event is for imgui.
    one solution would be for imgui to handle touch events already (and then i do not need to propagate a mouse event from a touch event).
    other solution would be if when touch event propagates a mouse event, it would also transfer the 'type', 'pressure' etc info and then in my app i can listen only to mouse events (which would properly not get to my background sprite if imgui captures it).

    so, @hgy29 , @rrraptor , any ideas how should i handle this issue?
    thanks, i appreciate your efforts with this annoying wacom pen issue.


  • hgy29hgy29 Maintainer
    I'll add a mouseType in the mouse events, similar to the touchType, to help detect synthesized mouse events.
    BTW I'll add the whole pressed button set in tablet move events (buttons() in QT instead of button())
  • hgy29 said:

    I'll add a mouseType in the mouse events, similar to the touchType, to help detect synthesized mouse events.
    BTW I'll add the whole pressed button set in tablet move events (buttons() in QT instead of button())

    let's see if that helps me too, thanks.
  • hgy29 said:

    I'll add a mouseType in the mouse events, similar to the touchType, to help detect synthesized mouse events.
    BTW I'll add the whole pressed button set in tablet move events (buttons() in QT instead of button())

    is it possible to add hover type event too when pen is hovering?
  • MoKaLuxMoKaLux Member
    edited November 18
    FYI
    navigation between input textfields seems to be broken?
    tab goes to the next input textfield OK
    shift+tab doesn't go to the previous input textfield NOT OK

    EDIT: that works in html5, it didn't work (for me) on windows 10 (it behaves very strangely on my windows 10).
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • @rrraptor , @hgy29 please help. so with latest version 2021.11:
    in my background sprite i just listen to mouse events for simplicity (and touch events propagate mouse events too)
    whenever i press right button of pen (windows ink on) on some imgui element then it triggers the right-click event of the imgui element fine. yet, it also sends a mouse_down event to my sprite below, so the event is not stopped from propagation (When i do the same with the mouse, that is, right-click with a mouse on imgui, then it correctly does not reach my background sprite). even more seriously, starting with this there is no mousedown event ever reaching my sprite when i put pen down again and again. this error can be corrected e.g. if i right-click with mouse somewhere on my background.
    so overall windows ink on it is completely unusable at the moment, yet this is the only mode when i could get pressure info.


  • rrraptorrrraptor Member
    edited December 1
    Technichally, you can implement input system by yourself using this functions:
    -- set ALT/SHIFT/CTRL/SUPER (META) key state
    IO:setModKeyDown(key_code, bool) 
    -- set key state
    IO:setKeysDown(key_code, bool)
    -- adds text to active text input widget
    IO:addInputCharactersUTF8(text)
    -- emulate wheel scrolling
    IO:setMouseWheel(number)
    -- sets mouse position (data only, no visual changes)
    IO:setMousePos(x, y)
    -- set mouse state, where index: 0 - left mouse, 1 - right, 2 - middle, 3 - unused, 4 - unused.
    IO:setMouseDown(index, state)
    KeyCodes: https://github.com/MultiPain/Gideros_ImGui#available-keycodes

    I dont have free time rn to update my version.
  • thanks, in this case i'd need to disable standard inputs, how to do that?
  • rrraptorrrraptor Member
    edited December 1
    keszegh said:

    thanks, in this case i'd need to disable standard inputs, how to do that?

    ImGui.new(nil, false, false, false)
    or just
    imgui:removeAllListeners()
  • keszeghkeszegh Member
    edited December 2
    @rrraptor , i think i have something that may help to correct the issue finally:
    so setting self.imgui = ImGui.new(nil, true, true, false)
    (and touch events generate mouse events and vice versa)
    if i add print(self.imgui:isMouseDown(2)) to onEnterFrame then
    if i press pen button then it becomes true yet when i release it then it does not go back to false UNLESS i move the pen like 1 cm away from where i pressed it.

    let me also copy-paste the same issue from gideros side i wrote on another thread (here one can see that at least gideros noticed the event when penbutton is released, it just misinterprets it and thinks that the pen was released and not the penbutton (i.e. mouseButton=1 instead of =2):

    @hgy29 , i'm trying to test wacom and imgui etc. one anomaly that may affect my issues is the following (no imgui at all in this example):

    if on touch events i have:
    function onTouch(event)
      if lastEv~=event.type then print(event.type.."  "..event.touch.mouseButton) end
        lastEv=event.type
    end
    then if i press right-button of pen and move it and release, i get
    "touchesBegin 2"
    "touchesMove 2"
    "touchesEnd 2"

    yet if i just press it and don't move it or just move it a little and then release it, i get
    "touchesBegin 2"
    "touchesMove 2"
    "touchesEnd 1"

    so the end event has wrong button info. this may be related to the issue where 'touchesEnd' event is missing completely when used together with imgui i wrote about earlier. perhaps if this would be corrected, then it would improve my case.
  • and because of this IO:wantCaptureMouse() also remains true after the penbutton is released without moving at least ~1cm (which sadly is usually the case when one presses an item in imgui)
Sign In or Register to comment.