Fixed: #1008 Modifier Key Information

This commit is contained in:
rti 2010-07-14 16:52:15 +02:00
parent 1cc6877502
commit 6f2ac6201f

View file

@ -809,49 +809,46 @@ void submitEvents(NLMISC::CEventServer& server,
continue; continue;
} }
// convert the modifiers for nel to pass them with the events
NLMISC::TKeyButton modifiers =
modifierFlagsToNelKeyButton([event modifierFlags]);
switch(event.type) switch(event.type)
{ {
case NSLeftMouseDown: case NSLeftMouseDown:
{ {
/*
TODO modifiers with mouse events
*/
server.postEvent(new NLMISC::CEventMouseDown( server.postEvent(new NLMISC::CEventMouseDown(
mouseX, mouseY, NLMISC::leftButton /* modifiers */, eventEmitter)); mouseX, mouseY,
(NLMISC::TMouseButton)(NLMISC::leftButton | modifiers),
eventEmitter));
} }
break; break;
case NSLeftMouseUp: case NSLeftMouseUp:
{ {
/*
TODO modifiers with mouse events
*/
server.postEvent(new NLMISC::CEventMouseUp( server.postEvent(new NLMISC::CEventMouseUp(
mouseX, mouseY, NLMISC::leftButton /* modifiers */, eventEmitter)); mouseX, mouseY,
(NLMISC::TMouseButton)(NLMISC::leftButton | modifiers),
eventEmitter));
break; break;
} }
case NSRightMouseDown: case NSRightMouseDown:
{ {
/*
TODO modifiers with mouse events
*/
server.postEvent(new NLMISC::CEventMouseDown( server.postEvent(new NLMISC::CEventMouseDown(
mouseX, mouseY, NLMISC::rightButton /* modifiers */, eventEmitter)); mouseX, mouseY,
(NLMISC::TMouseButton)(NLMISC::rightButton | modifiers),
eventEmitter));
break; break;
} }
case NSRightMouseUp: case NSRightMouseUp:
{ {
/*
TODO modifiers with mouse events
*/
server.postEvent(new NLMISC::CEventMouseUp( server.postEvent(new NLMISC::CEventMouseUp(
mouseX, mouseY, NLMISC::rightButton /* modifiers */, eventEmitter)); mouseX, mouseY,
(NLMISC::TMouseButton)(NLMISC::rightButton | modifiers),
eventEmitter));
break; break;
} }
case NSMouseMoved: case NSMouseMoved:
{ {
/*
TODO modifiers with mouse events
*/
NLMISC::CEvent* nelEvent; NLMISC::CEvent* nelEvent;
// when emulating raw mode, send the delta in a CGDMouseMove event // when emulating raw mode, send the delta in a CGDMouseMove event
@ -861,17 +858,14 @@ void submitEvents(NLMISC::CEventServer& server,
// normally send position in a CEventMouseMove // normally send position in a CEventMouseMove
else else
nelEvent = new NLMISC::CEventMouseMove(mouseX, mouseY, nelEvent = new NLMISC::CEventMouseMove(
(NLMISC::TMouseButton)0 /* modifiers */, eventEmitter); mouseX, mouseY, (NLMISC::TMouseButton)modifiers, eventEmitter);
server.postEvent(nelEvent); server.postEvent(nelEvent);
break; break;
} }
case NSLeftMouseDragged: case NSLeftMouseDragged:
{ {
/*
TODO modifiers with mouse events
*/
NLMISC::CEvent* nelEvent; NLMISC::CEvent* nelEvent;
// when emulating raw mode, send the delta in a CGDMouseMove event // when emulating raw mode, send the delta in a CGDMouseMove event
@ -882,16 +876,14 @@ void submitEvents(NLMISC::CEventServer& server,
// normally send position in a CEventMouseMove // normally send position in a CEventMouseMove
else else
nelEvent = new NLMISC::CEventMouseMove(mouseX, mouseY, nelEvent = new NLMISC::CEventMouseMove(mouseX, mouseY,
NLMISC::leftButton /* modifiers */, eventEmitter); (NLMISC::TMouseButton)(NLMISC::leftButton | modifiers),
eventEmitter);
server.postEvent(nelEvent); server.postEvent(nelEvent);
break; break;
} }
case NSRightMouseDragged: case NSRightMouseDragged:
{ {
/*
TODO modifiers with mouse events
*/
NLMISC::CEvent* nelEvent; NLMISC::CEvent* nelEvent;
// when emulating raw mode, send the delta in a CGDMouseMove event // when emulating raw mode, send the delta in a CGDMouseMove event
@ -902,7 +894,8 @@ void submitEvents(NLMISC::CEventServer& server,
// normally send position in a CEventMouseMove // normally send position in a CEventMouseMove
else else
nelEvent = new NLMISC::CEventMouseMove(mouseX, mouseY, nelEvent = new NLMISC::CEventMouseMove(mouseX, mouseY,
NLMISC::rightButton /* modifiers */, eventEmitter); (NLMISC::TMouseButton)(NLMISC::rightButton | modifiers),
eventEmitter);
server.postEvent(nelEvent); server.postEvent(nelEvent);
break; break;
@ -951,12 +944,9 @@ void submitEvents(NLMISC::CEventServer& server,
case NSCursorUpdate:break; case NSCursorUpdate:break;
case NSScrollWheel: case NSScrollWheel:
{ {
/*
TODO modifiers with mouse events
*/
if(fabs(event.deltaY) > 0.1) if(fabs(event.deltaY) > 0.1)
server.postEvent(new NLMISC::CEventMouseWheel( server.postEvent(new NLMISC::CEventMouseWheel(
mouseX, mouseY, (NLMISC::TMouseButton)0 /* modifiers */, mouseX, mouseY, (NLMISC::TMouseButton)modifiers,
(event.deltaY > 0), eventEmitter)); (event.deltaY > 0), eventEmitter));
break; break;