mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0032686: Visualization, Wasm_Window - filter out unexpected pressed buttons state within mouse move / up events
Wasm_Window::ProcessMouseEvent() now ignores not previously pressed mouse buttons within mouse move / up events. Fixed -Wshorten-64-to-32 compiler warning within cpulimit command on 32-bit Linux.
This commit is contained in:
parent
87b7b496ec
commit
b6b55c3d96
@ -636,15 +636,21 @@ static Standard_Integer cpulimit(Draw_Interpretor& di, Standard_Integer n, const
|
|||||||
rlimit rlp;
|
rlimit rlp;
|
||||||
rlp.rlim_max = RLIM_INFINITY;
|
rlp.rlim_max = RLIM_INFINITY;
|
||||||
if (n <= 1)
|
if (n <= 1)
|
||||||
|
{
|
||||||
rlp.rlim_cur = RLIM_INFINITY;
|
rlp.rlim_cur = RLIM_INFINITY;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
rlp.rlim_cur = GetCpuLimit (a[1]);
|
rlp.rlim_cur = GetCpuLimit (a[1]);
|
||||||
CPU_LIMIT = rlp.rlim_cur;
|
}
|
||||||
|
|
||||||
int status;
|
CPU_LIMIT = (clock_t )rlp.rlim_cur;
|
||||||
status=setrlimit(RLIMIT_CPU,&rlp);
|
|
||||||
if (status !=0)
|
int aStatus = setrlimit (RLIMIT_CPU, &rlp);
|
||||||
di << "status cpulimit setrlimit : " << status << "\n";
|
if (aStatus != 0)
|
||||||
|
{
|
||||||
|
di << "status cpulimit setrlimit : " << aStatus << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
// set signal handler to print a message before death
|
// set signal handler to print a message before death
|
||||||
struct sigaction act, oact;
|
struct sigaction act, oact;
|
||||||
|
@ -276,14 +276,19 @@ bool Wasm_Window::ProcessMouseEvent (Aspect_WindowInputListener& theListener,
|
|||||||
if (theEvent->metaKey == EM_TRUE) { aFlags |= Aspect_VKeyFlags_META; }
|
if (theEvent->metaKey == EM_TRUE) { aFlags |= Aspect_VKeyFlags_META; }
|
||||||
|
|
||||||
const bool isEmulated = false;
|
const bool isEmulated = false;
|
||||||
const Aspect_VKeyMouse aButtons = Wasm_Window::MouseButtonsFromNative (theEvent->buttons);
|
const Aspect_VKeyMouse aButtonsOld = theListener.PressedMouseButtons();
|
||||||
|
Aspect_VKeyMouse aButtons = Wasm_Window::MouseButtonsFromNative (theEvent->buttons);
|
||||||
|
if (theEventType != EMSCRIPTEN_EVENT_MOUSEDOWN)
|
||||||
|
{
|
||||||
|
aButtons &= aButtonsOld; // filter out unexpected buttons
|
||||||
|
}
|
||||||
switch (theEventType)
|
switch (theEventType)
|
||||||
{
|
{
|
||||||
case EMSCRIPTEN_EVENT_MOUSEMOVE:
|
case EMSCRIPTEN_EVENT_MOUSEMOVE:
|
||||||
{
|
{
|
||||||
if ((aNewPos2i.x() < 0 || aNewPos2i.x() > mySize.x()
|
if ((aNewPos2i.x() < 0 || aNewPos2i.x() > mySize.x()
|
||||||
|| aNewPos2i.y() < 0 || aNewPos2i.y() > mySize.y())
|
|| aNewPos2i.y() < 0 || aNewPos2i.y() > mySize.y())
|
||||||
&& theListener.PressedMouseButtons() == Aspect_VKeyMouse_NONE)
|
&& aButtonsOld == Aspect_VKeyMouse_NONE)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user