# [SDL] Patch for mouse coverage in win32

Dave Ashley (SDL list) mailto:sdl@lokigames.com
Sun, 17 Oct 1999 09:30:49 -0700

- Previous message: [SDL] Patch for mouse coverage in win32
- Next message: [SDL] Patch for mouse coverage in win32
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    >> I am concerned about this. When my SDL application has focus I want to
    >> receive mouse events regardless of whether the mouse is inside the window
    >> or whether the SDL window is obscured by another window. Really it is none
    >> of the application's business how I organize my windows. At very least I'd
    >> like it optional.
    >
    >I'm not sure I follow you. Why should you get mouse messages if the mouse
    >cursor isn't in your window? If the bottom right quarter of your window is
    >covered then you shouldn't have mouse focus or receive mouse messages when
    >the cursor is in that quarter (in the other window). My tiny patch makes
    >it so that whenever the mouse cursor enters the VISIBLE client area of the
    >SDL window, you gain mouse focus; whenever it leaves the VISIBLE client
    >area you lose mouse focus. The way Enzo had it was even if your SDL window
    >was completely covered (not visible at all) you could still gain and lose
    >mouse focus although you would never get any mouse messages.
    >
    >> When my window has focus, I want ALL mouse events. Not just mouse events,
    >> ALL events!
    >> -Dave
    >
    >Keyboard focus or mouse focus? It's treated as seperate in SDL. And by 'I
    >want ALL mouse events' do you mean mouse events that occur even when the
    >cursor is outside of the window?
    >

    I really wasn't thinking of the question of what the mouse pointer should
    look like. If the pointer is over my window it should look like what my
    application wants it to look like. If it is over another window, it should
    look like what that appication wants it to look like. Regardless of how
    the cursor is rendered, if my application has focus, I want mouse, keyboard,
    whatever events. I also want mouse movement events even if the mouse is
    outside my window--I don't want any clipping going on, I can do that myself
    if I want to.

    For example in the SDL version of scavenger, I turn the pointer off (the
    hardware sprite pointer) and I render my own + style cursor into my window
    myself. When the user moves the mouse out of the window, there is a
    dangling pointer sitting there because I didn't get mouse movement events
    outside of the window. Then when I bring the pointer back into the window
    the pointer will pop over to the new position. My program can handle the
    clipping, I'd just like to get the mouse events outside so there isn't that
    silly looking pointer sitting there. Now there is probably some check I
    can do to see if the pointer is looking like I want it and if it isn't, don't
    draw the cursor. Meaning the pointer moved outside or is over another window.
    Which is what I don't want.

    Possibly regarding the cursor appearance issue--if the cursor moves over
    an SDL window that doesn't have focus, the cursor should probably stay as
    the default system cursor. Because in that case if the cursor is being
    rendered in software by the SDL application, you wouldn't see anything for
    that period.

    I just ran an experiment with founts and it is close but I'm not happy with
    how it works. If the mouse button isn't down, the mouse movement events stop
    when the SDL window is obscured by another window. If the mouse button is down,
    I continue to get events even in the obscured part. And I never get events
    outside the SDL window's area.

    I'd rather it work so that the SDL window gets all events all the time if
    it has focus--and gets no events ever if it doesn't have focus. And if
    the mouse moves within the SDL window when it doesn't have focus, the
    pointer remains the default system pointer.
    -Dave

- Previous message: [SDL] Patch for mouse coverage in win32
- Next message: [SDL] Patch for mouse coverage in win32
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]