Comments (9)
i guess this is still valid right?
from pdcurses.
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.
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.
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.
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.
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.
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.
Anyways, I'm out for now, I need to do other things... something wrong with this and\or this. (button_mask
?)
from pdcurses.
from pdcurses.
Related Issues (20)
- Is it normal that several styles don't work correctly in PowerShell? HOT 7
- Enabling support for showing window after process put to sleep (SDL2) HOT 4
- SDL_GetError() returns "Parameter 'src' is invalid" after call to initscr() for sdl2 HOT 2
- ncurses compat: add WACS_D_LRCORNER and other double line drawings
- SDL2 port missing support for PDC_PRESERVE_SCREEN HOT 4
- WinCon, endwin() kills QuickEdit/InsertMode options and more.. HOT 8
- touchoverlap() un-touches parts of lines HOT 1
- addition of vt port from Bill-Gray HOT 1
- additional gitpod config
- No rule to make target '../common/libobjs.mif'. Stop. HOT 5
- SDL2 build fails for Mac/Linux in Github HOT 2
- When resizing the SDL2 window, the surface isn't refreshed
- Build failure when building PDcurses DLL library for Window console HOT 1
- Debugging? HOT 1
- printw.c - for Unicode? HOT 3
- wresize doesn't return ERR if the window size requested is too big HOT 3
- Unable to initialize soft label keys HOT 2
- missing escapes in configure script HOT 1
- Scrolling and inserting/deleting lines
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdcurses.