Git Product home page Git Product logo

Comments (9)

GiorgosXou avatar GiorgosXou commented on June 11, 2024

i guess this is still valid right?

from pdcurses.

Bill-Gray avatar Bill-Gray commented on June 11, 2024

PDC_MOUSE_POSITION and MOUSE_POS_REPORT don't actually do anything. Both are #defined in curses.h and never used after that; pay no attention to them. Use MOUSE_MOVED and PDC_MOUSE_MOVED.

You also have to set the REPORT_MOUSE_POSITION flag in mousemask().

It may also be worth trying the SDL1 or SDL2 platform. I have a vague memory that mouse movements were not supported in WinCon unless you had a button pressed (an issue that apparently neither I nor William was able to work around). If your program works on SDL2 but not with WinCon, that'd be a significant clue.

from pdcurses.

GiorgosXou avatar GiorgosXou commented on June 11, 2024

@Bill-Gray

I have a vague memory that mouse movements were not supported in WinCon unless you had a button pressed

Exactly!

It may also be worth trying the SDL1 or SDL2 platform ...

I tried SDL, same thing... but! finally I found where the issue is and made a fix:

    for (i = 0; i < 3; i++)
    {
        if (old_mouse_status.button[i] != SP->mouse_status.button[i])
            SP->mouse_status.changes |= (1 << i);

        /* Discard non-moved "moves" */

        if (SP->mouse_status.x == old_mouse_status.x &&
            SP->mouse_status.y == old_mouse_status.y)
            continue;

        /* Motion events always flag the button as changed */

        SP->mouse_status.changes |= (1 << i);
        SP->mouse_status.changes |= PDC_MOUSE_MOVED;
        SP->mouse_status.button[i] = BUTTON_MOVED; // <--- to report same value as ncurses when hovering
        break;
    }

So... from what i understand: It appears that the buttons are never set to the BUTTON_MOVED state, and so they never pass the condition of SP->mouse_status.button[i] == BUTTON_MOVED [...] + return -1; ignores the rest of the code afterwords

Regarding this fix, although everything appears to work fine, when using the mousemask(...) function with the ALL_MOUSE_EVENTS flag, it includes hover events without requiring the REPORT_MOUSE_POSITION flag. In contrast, in ncurses, if you don't pass REPORT_MOUSE_POSITION and hover around, getmouse() returns -1 which I'm not 100% sure how to solve yet ([I guess it's not that much of a big deal but] I might dive deep into the source later), any idea?

(Here's the minimal example I used to test both pdcurses and ncurses)

⚠️ Update

I was wrong about the fix

from pdcurses.

GiorgosXou avatar GiorgosXou commented on June 11, 2024

Ok, a condition like if !(SP->_trap_mbe &=REPORT_MOUSE_POSITION){return -1;} should work (althought I am a bit unaware of what might be the effect on the rest of the code...), lets seeee....

from pdcurses.

GiorgosXou avatar GiorgosXou commented on June 11, 2024

Ah... the fix, actually doesn't work us expected... and without SP->mouse_status.button[i] = BUTTON_MOVED; it reports 0x00000001 when it should report 0x00000000

from pdcurses.

GiorgosXou avatar GiorgosXou commented on June 11, 2024

If i won't change the code besides this line to if (action == BUTTON_MOVED) it works, BUT it shouldn't report 0x00000001, it should report 0x00000000 and this baffles me

from pdcurses.

GiorgosXou avatar GiorgosXou commented on June 11, 2024

Another Failed (but closer to the solution) fix

    for (i = 0; i < 3; i++)
    {
        if (old_mouse_status.button[i] != SP->mouse_status.button[i])
            SP->mouse_status.changes |= (1 << i);

        if (action == BUTTON_MOVED)
        {
            /* Discard non-moved "moves" */

            if (SP->mouse_status.x == old_mouse_status.x &&
                SP->mouse_status.y == old_mouse_status.y)
                return -1;

            /* Motion events always flag the button as changed */

            SP->mouse_status.changes |= (1 << i);
            SP->mouse_status.changes |= PDC_MOUSE_MOVED;
            SP->mouse_status.button[i] = BUTTON_MOVED;
            break;
        }
    }

Now the issue with this is, is that whenever i move the mouse and right click, it adds a release too or something

from pdcurses.

GiorgosXou avatar GiorgosXou commented on June 11, 2024

Anyways, I'm out for now, I need to do other things... something wrong with this and\or this. (button_mask?)

from pdcurses.

GiorgosXou avatar GiorgosXou commented on June 11, 2024

the faild fix 2 in gif
PDCURSESMOUSEHOVERissue0 gif

from pdcurses.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.