mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-24 17:58:45 +00:00
Fixed: Removed raw mouse mode for OS X too
This commit is contained in:
parent
541fd4a25c
commit
afac054306
3 changed files with 5 additions and 67 deletions
|
@ -270,28 +270,14 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
|
|||
return false;
|
||||
}
|
||||
|
||||
// first event about mouse movement after setting to emulateRawMode
|
||||
if(_setToEmulateRawMode &&
|
||||
(event.type == NSMouseMoved ||
|
||||
event.type == NSLeftMouseDragged ||
|
||||
event.type == NSRightMouseDragged))
|
||||
{
|
||||
// do not report because it reflects wrapping pointer to 0.5/0.5
|
||||
_setToEmulateRawMode = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// convert the modifiers for nel to pass them with the events
|
||||
NLMISC::TKeyButton modifiers =
|
||||
modifierFlagsToNelKeyButton([event modifierFlags]);
|
||||
NLMISC::TKeyButton modifiers = modifierFlagsToNelKeyButton([event modifierFlags]);
|
||||
|
||||
switch(event.type)
|
||||
{
|
||||
case NSLeftMouseDown:
|
||||
{
|
||||
server->postEvent(new NLMISC::CEventMouseDown(
|
||||
mousePos.x, mousePos.y,
|
||||
(NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this));
|
||||
server->postEvent(new NLMISC::CEventMouseDown(mousePos.x, mousePos.y, (NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this));
|
||||
}
|
||||
break;
|
||||
case NSLeftMouseUp:
|
||||
|
@ -319,15 +305,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
|
|||
{
|
||||
NLMISC::CEvent* nelEvent;
|
||||
|
||||
// when emulating raw mode, send the delta in a CGDMouseMove event
|
||||
if(_emulateRawMode)
|
||||
nelEvent = new NLMISC::CGDMouseMove(
|
||||
this, NULL /* no mouse device */, event.deltaX, -event.deltaY);
|
||||
|
||||
// normally send position in a CEventMouseMove
|
||||
else
|
||||
nelEvent = new NLMISC::CEventMouseMove(
|
||||
mousePos.x, mousePos.y, (NLMISC::TMouseButton)modifiers, this);
|
||||
nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y, (NLMISC::TMouseButton)modifiers, this);
|
||||
|
||||
server->postEvent(nelEvent);
|
||||
break;
|
||||
|
@ -336,15 +314,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
|
|||
{
|
||||
NLMISC::CEvent* nelEvent;
|
||||
|
||||
// when emulating raw mode, send the delta in a CGDMouseMove event
|
||||
if(_emulateRawMode)
|
||||
nelEvent = new NLMISC::CGDMouseMove(
|
||||
this, NULL /* no mouse device */, event.deltaX, -event.deltaY);
|
||||
|
||||
// normally send position in a CEventMouseMove
|
||||
else
|
||||
nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y,
|
||||
(NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this);
|
||||
nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y, (NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this);
|
||||
|
||||
server->postEvent(nelEvent);
|
||||
break;
|
||||
|
@ -353,15 +323,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
|
|||
{
|
||||
NLMISC::CEvent* nelEvent;
|
||||
|
||||
// when emulating raw mode, send the delta in a CGDMouseMove event
|
||||
if(_emulateRawMode)
|
||||
nelEvent = new NLMISC::CGDMouseMove(
|
||||
this, NULL /* no mouse device */, event.deltaX, -event.deltaY);
|
||||
|
||||
// normally send position in a CEventMouseMove
|
||||
else
|
||||
nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y,
|
||||
(NLMISC::TMouseButton)(NLMISC::rightButton | modifiers), this);
|
||||
nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y, (NLMISC::TMouseButton)(NLMISC::rightButton | modifiers), this);
|
||||
|
||||
server->postEvent(nelEvent);
|
||||
break;
|
||||
|
@ -434,12 +396,6 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
|
|||
}
|
||||
}
|
||||
|
||||
if(_emulateRawMode && _driver && (event.type == NSMouseMoved ||
|
||||
event.type == NSLeftMouseDragged || event.type == NSRightMouseDragged))
|
||||
{
|
||||
_driver->setMousePos(0.5, 0.5);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -492,17 +448,4 @@ void CCocoaEventEmitter::submitEvents(CEventServer& server, bool /* allWins */)
|
|||
_server = &server;
|
||||
}
|
||||
|
||||
void CCocoaEventEmitter::emulateMouseRawMode(bool enable)
|
||||
{
|
||||
_emulateRawMode = enable;
|
||||
|
||||
if(_emulateRawMode)
|
||||
{
|
||||
_setToEmulateRawMode = true;
|
||||
|
||||
if(_driver)
|
||||
_driver->setMousePos(0.5, 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,8 +31,6 @@ namespace NLMISC
|
|||
|
||||
class CCocoaEventEmitter : public IEventEmitter
|
||||
{
|
||||
bool _emulateRawMode;
|
||||
bool _setToEmulateRawMode;
|
||||
bool _eventLoop;
|
||||
NL3D::IDriver* _driver;
|
||||
CocoaOpenGLView* _glView;
|
||||
|
@ -42,8 +40,6 @@ class CCocoaEventEmitter : public IEventEmitter
|
|||
|
||||
public:
|
||||
CCocoaEventEmitter() :
|
||||
_emulateRawMode(false),
|
||||
_setToEmulateRawMode(false),
|
||||
_driver(NULL),
|
||||
_glView(nil),
|
||||
_server(NULL) { }
|
||||
|
|
|
@ -100,7 +100,6 @@ private:
|
|||
std::map<TKey, bool> _PressedKeys;
|
||||
XIM _im;
|
||||
XIC _ic;
|
||||
bool _emulateRawMode;
|
||||
NL3D::IDriver* _driver;
|
||||
CUnixEventServer _InternalServer;
|
||||
ucstring _CopiedString;
|
||||
|
|
Loading…
Reference in a new issue