mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-12 18:29:04 +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;
|
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
|
// convert the modifiers for nel to pass them with the events
|
||||||
NLMISC::TKeyButton modifiers =
|
NLMISC::TKeyButton modifiers = modifierFlagsToNelKeyButton([event modifierFlags]);
|
||||||
modifierFlagsToNelKeyButton([event modifierFlags]);
|
|
||||||
|
|
||||||
switch(event.type)
|
switch(event.type)
|
||||||
{
|
{
|
||||||
case NSLeftMouseDown:
|
case NSLeftMouseDown:
|
||||||
{
|
{
|
||||||
server->postEvent(new NLMISC::CEventMouseDown(
|
server->postEvent(new NLMISC::CEventMouseDown(mousePos.x, mousePos.y, (NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this));
|
||||||
mousePos.x, mousePos.y,
|
|
||||||
(NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NSLeftMouseUp:
|
case NSLeftMouseUp:
|
||||||
|
@ -319,15 +305,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
|
||||||
{
|
{
|
||||||
NLMISC::CEvent* nelEvent;
|
NLMISC::CEvent* nelEvent;
|
||||||
|
|
||||||
// when emulating raw mode, send the delta in a CGDMouseMove event
|
nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y, (NLMISC::TMouseButton)modifiers, this);
|
||||||
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);
|
|
||||||
|
|
||||||
server->postEvent(nelEvent);
|
server->postEvent(nelEvent);
|
||||||
break;
|
break;
|
||||||
|
@ -336,15 +314,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
|
||||||
{
|
{
|
||||||
NLMISC::CEvent* nelEvent;
|
NLMISC::CEvent* nelEvent;
|
||||||
|
|
||||||
// when emulating raw mode, send the delta in a CGDMouseMove event
|
nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y, (NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this);
|
||||||
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);
|
|
||||||
|
|
||||||
server->postEvent(nelEvent);
|
server->postEvent(nelEvent);
|
||||||
break;
|
break;
|
||||||
|
@ -353,15 +323,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
|
||||||
{
|
{
|
||||||
NLMISC::CEvent* nelEvent;
|
NLMISC::CEvent* nelEvent;
|
||||||
|
|
||||||
// when emulating raw mode, send the delta in a CGDMouseMove event
|
nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y, (NLMISC::TMouseButton)(NLMISC::rightButton | modifiers), this);
|
||||||
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);
|
|
||||||
|
|
||||||
server->postEvent(nelEvent);
|
server->postEvent(nelEvent);
|
||||||
break;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,17 +448,4 @@ void CCocoaEventEmitter::submitEvents(CEventServer& server, bool /* allWins */)
|
||||||
_server = &server;
|
_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
|
class CCocoaEventEmitter : public IEventEmitter
|
||||||
{
|
{
|
||||||
bool _emulateRawMode;
|
|
||||||
bool _setToEmulateRawMode;
|
|
||||||
bool _eventLoop;
|
bool _eventLoop;
|
||||||
NL3D::IDriver* _driver;
|
NL3D::IDriver* _driver;
|
||||||
CocoaOpenGLView* _glView;
|
CocoaOpenGLView* _glView;
|
||||||
|
@ -42,8 +40,6 @@ class CCocoaEventEmitter : public IEventEmitter
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CCocoaEventEmitter() :
|
CCocoaEventEmitter() :
|
||||||
_emulateRawMode(false),
|
|
||||||
_setToEmulateRawMode(false),
|
|
||||||
_driver(NULL),
|
_driver(NULL),
|
||||||
_glView(nil),
|
_glView(nil),
|
||||||
_server(NULL) { }
|
_server(NULL) { }
|
||||||
|
|
|
@ -100,7 +100,6 @@ private:
|
||||||
std::map<TKey, bool> _PressedKeys;
|
std::map<TKey, bool> _PressedKeys;
|
||||||
XIM _im;
|
XIM _im;
|
||||||
XIC _ic;
|
XIC _ic;
|
||||||
bool _emulateRawMode;
|
|
||||||
NL3D::IDriver* _driver;
|
NL3D::IDriver* _driver;
|
||||||
CUnixEventServer _InternalServer;
|
CUnixEventServer _InternalServer;
|
||||||
ucstring _CopiedString;
|
ucstring _CopiedString;
|
||||||
|
|
Loading…
Reference in a new issue