Skip to content

Commit

Permalink
Magellan event cleanup
Browse files Browse the repository at this point in the history
Both magellan events don't need an event type, since there is only one
of them. Consistent with Statistic events, drop it.
  • Loading branch information
Stefan Eilemann authored and eile committed Jan 12, 2017
1 parent 0b1d510 commit c79ce87
Show file tree
Hide file tree
Showing 27 changed files with 130 additions and 100 deletions.
2 changes: 2 additions & 0 deletions doc/Changelog.md
Expand Up @@ -3,6 +3,8 @@ Changelog {#Changelog}

# git master

* [609](https://github.com/Eyescale/Equalizer/pull/609):
Clean up magellan event API
* [608](https://github.com/Eyescale/Equalizer/pull/608):
Make Frame::Buffer enum an enum class to ease bitmask handling;
enum values are now Frame::Buffer::value instead of Frame::BUFFER_VALUE
Expand Down
6 changes: 3 additions & 3 deletions eq/agl/eventHandler.cpp
@@ -1,5 +1,5 @@

/* Copyright (c) 2007-2016, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2007-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Cedric Stalder <cedric.stalder@gmail.com>
*
* This library is free software; you can redistribute it and/or modify it under
Expand Down Expand Up @@ -501,15 +501,15 @@ void _magellanEventHandler( io_connect_t, natural_t messageType,
event.xRotation = -state->axis[3];
event.yRotation = state->axis[4];
event.zRotation = state->axis[5];
_magellanNode->processEvent( EVENT_MAGELLAN_AXIS, event );
_magellanNode->processEvent( event );
return;
}

case kConnexionCmdHandleButtons:
{
ButtonEvent event;
event.buttons = state->buttons;
_magellanNode->processEvent( EVENT_MAGELLAN_BUTTON, event );
_magellanNode->processEvent( event );
return;
}

Expand Down
8 changes: 4 additions & 4 deletions eq/config.cpp
Expand Up @@ -620,10 +620,10 @@ bool Config::handleEvent( EventICommand command )
return handleEvent( type, command.read< KeyEvent >( ));

case EVENT_MAGELLAN_AXIS:
return handleEvent( type, command.read< AxisEvent >( ));
return handleEvent( command.read< AxisEvent >( ));

case EVENT_MAGELLAN_BUTTON:
return handleEvent( type, command.read< ButtonEvent >( ));
return handleEvent( command.read< ButtonEvent >( ));

case EVENT_WINDOW_CLOSE:
case EVENT_WINDOW_HIDE:
Expand Down Expand Up @@ -755,12 +755,12 @@ bool Config::handleEvent( const EventType type, const KeyEvent& event )
}
}

bool Config::handleEvent( const EventType, const AxisEvent& )
bool Config::handleEvent( const AxisEvent& )
{
return false;
}

bool Config::handleEvent( const EventType, const ButtonEvent& )
bool Config::handleEvent( const ButtonEvent& )
{
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions eq/config.h
@@ -1,5 +1,5 @@

/* Copyright (c) 2005-2016, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2005-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Cedric Stalder <cedric Stalder@gmail.com>
* Daniel Nachbaur <danielnachbaur@gmail.com>
*
Expand Down Expand Up @@ -388,8 +388,8 @@ class Config : public fabric::Config< Server, Config, Observer, Layout, Canvas,
EQ_API virtual bool handleEvent( EventType type, const SizeEvent& event );
EQ_API virtual bool handleEvent( EventType type, const PointerEvent& event);
EQ_API virtual bool handleEvent( EventType type, const KeyEvent& event );
EQ_API virtual bool handleEvent( EventType type, const AxisEvent& event );
EQ_API virtual bool handleEvent( EventType type, const ButtonEvent& event );
EQ_API virtual bool handleEvent( const AxisEvent& event );
EQ_API virtual bool handleEvent( const ButtonEvent& event );

/** @return true if events are pending. Thread safe. @version 1.0 */
EQ_API bool checkEvent() const;
Expand Down
8 changes: 3 additions & 5 deletions eq/glx/eventHandler.cpp
@@ -1,5 +1,5 @@

/* Copyright (c) 2006-2016, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2006-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Daniel Nachbaur <danielnachbaur@gmail.com>
* Cedric Stalder <cedric.stalder@gmail.com>
*
Expand Down Expand Up @@ -349,17 +349,15 @@ bool EventHandler::_processEvent( const XEvent& event )
axisEvent.xRotation = -spev.motion.rx;
axisEvent.yRotation = -spev.motion.ry;
axisEvent.zRotation = spev.motion.rz;
return _window->processEvent( EVENT_MAGELLAN_AXIS, event,
axisEvent );
return _window->processEvent( event, axisEvent );
}

case SPNAV_EVENT_BUTTON:
{
ButtonEvent buttonEvent;
buttonEvent.buttons = spev.button.press;
buttonEvent.button = spev.button.bnum;
return _window->processEvent( EVENT_MAGELLAN_BUTTON, event,
buttonEvent );
return _window->processEvent( event, buttonEvent );
}

default:
Expand Down
12 changes: 5 additions & 7 deletions eq/glx/window.h
@@ -1,5 +1,5 @@

/* Copyright (c) 2005-2016, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2005-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Daniel Nachbaur <danielnachbaur@gmail.com>
* Maxim Makhinya
*
Expand Down Expand Up @@ -61,14 +61,12 @@ class WindowIF : public GLWindow
{ return GLWindow::processEvent( type, event ); }

/** Process an axis event. @return true if the event was handled. */
virtual bool processEvent( EventType type, const XEvent&,
AxisEvent& event )
{ return GLWindow::processEvent( type, event ); }
virtual bool processEvent( const XEvent&, AxisEvent& event )
{ return GLWindow::processEvent( event ); }

/** Process a button event. @return true if the event was handled. */
virtual bool processEvent( EventType type, const XEvent&,
ButtonEvent& event )
{ return GLWindow::processEvent( type, event ); }
virtual bool processEvent( const XEvent&, ButtonEvent& event )
{ return GLWindow::processEvent( event ); }

/** Process a stateless event. @return true if the event was handled. */
virtual bool processEvent( EventType type, const XEvent& )
Expand Down
2 changes: 1 addition & 1 deletion eq/image.cpp
Expand Up @@ -20,6 +20,7 @@

#include "image.h"

#include "gl.h"
#include "half.h"
#include "log.h"
#include "pixelData.h"
Expand Down Expand Up @@ -1802,4 +1803,3 @@ co::DataIStream& operator >> ( co::DataIStream& is, Image& image )
}

}

8 changes: 4 additions & 4 deletions eq/node.cpp
Expand Up @@ -472,19 +472,19 @@ EventOCommand Node::sendError( const uint32_t error )
return getConfig()->sendError( EVENT_NODE_ERROR, Error( error, getID( )));
}

bool Node::processEvent( const EventType type, AxisEvent& event )
bool Node::processEvent( AxisEvent& event )
{
Config* config = getConfig();
updateEvent( event, config->getTime( ));
config->sendEvent( type ) << event;
config->sendEvent( EVENT_MAGELLAN_AXIS ) << event;
return true;
}

bool Node::processEvent( const EventType type, ButtonEvent& event )
bool Node::processEvent( ButtonEvent& event )
{
Config* config = getConfig();
updateEvent( event, config->getTime( ));
config->sendEvent( type ) << event;
config->sendEvent( EVENT_MAGELLAN_BUTTON ) << event;
return true;
}

Expand Down
7 changes: 3 additions & 4 deletions eq/node.h
@@ -1,5 +1,5 @@

/* Copyright (c) 2005-2016, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2005-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Cedric Stalder<cedric.stalder@gmail.com>
*
* This library is free software; you can redistribute it and/or modify it under
Expand Down Expand Up @@ -133,13 +133,12 @@ class Node : public fabric::Node< Config, Node, Pipe, NodeVisitor >
* The task of this method is to update the node as necessary, and send it
* to the application using Config::sendEvent().
*
* @param type unused
* @param event the received event.
* @return true if the event was handled, false if not.
* @version 1.5.2
*/
EQ_API virtual bool processEvent( EventType type, AxisEvent& event );
EQ_API virtual bool processEvent( EventType type, ButtonEvent& event );
EQ_API virtual bool processEvent( AxisEvent& event );
EQ_API virtual bool processEvent( ButtonEvent& event );
EQ_API virtual bool processEvent( Statistic& event );

/** @internal @sa Serializable::setDirty() */
Expand Down
6 changes: 3 additions & 3 deletions eq/notifierInterface.h
@@ -1,5 +1,5 @@

/* Copyright (c) 2014-2016, Daniel Nachbaur <danielnachbaur@gmail.com>
/* Copyright (c) 2014-2017, Daniel Nachbaur <danielnachbaur@gmail.com>
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License version 2.1 as published
Expand Down Expand Up @@ -50,8 +50,8 @@ class NotifierInterface
virtual bool processEvent( EventType type, SizeEvent& event ) = 0;
virtual bool processEvent( EventType type, PointerEvent& event ) = 0;
virtual bool processEvent( EventType type, KeyEvent& event ) = 0;
virtual bool processEvent( EventType type, AxisEvent& event ) = 0;
virtual bool processEvent( EventType type, ButtonEvent& event ) = 0;
virtual bool processEvent( AxisEvent& event ) = 0;
virtual bool processEvent( ButtonEvent& event ) = 0;
virtual bool processEvent( EventType type ) = 0; //!< stateless event
};
}
Expand Down
10 changes: 5 additions & 5 deletions eq/systemWindow.cpp
@@ -1,5 +1,5 @@

/* Copyright (c) 2005-2016, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2005-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Daniel Nachbaur <danielnachbaur@gmail.com>
* Maxim Makhinya
*
Expand Down Expand Up @@ -114,14 +114,14 @@ bool SystemWindow::processEvent( const EventType type, KeyEvent& event )
return _parent.processEvent( type, event );
}

bool SystemWindow::processEvent( EventType type, AxisEvent& event )
bool SystemWindow::processEvent( AxisEvent& event )
{
return _parent.processEvent( type, event );
return _parent.processEvent( event );
}

bool SystemWindow::processEvent( EventType type, ButtonEvent& event )
bool SystemWindow::processEvent( ButtonEvent& event )
{
return _parent.processEvent( type, event );
return _parent.processEvent( event );
}

}
6 changes: 3 additions & 3 deletions eq/systemWindow.h
@@ -1,5 +1,5 @@

/* Copyright (c) 2005-2016, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2005-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Daniel Nachbaur <danielnachbaur@gmail.com>
* Maxim Makhinya
*
Expand Down Expand Up @@ -165,10 +165,10 @@ class SystemWindow
EQ_API bool processEvent( EventType type, KeyEvent& event );

/** Process an axis event. @return true if the event was handled. */
EQ_API bool processEvent( EventType type, AxisEvent& event );
EQ_API bool processEvent( AxisEvent& event );

/** Process a button event. @return true if the event was handled. */
EQ_API bool processEvent( EventType type, ButtonEvent& event );
EQ_API bool processEvent( ButtonEvent& event );

/**
* Set the window's pixel viewport wrt its parent pipe.
Expand Down
6 changes: 3 additions & 3 deletions eq/wgl/eventHandler.cpp
@@ -1,5 +1,5 @@

/* Copyright (c) 2007-2016, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2007-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Cedric Stalder <cedric.stalder@gmail.com>
*
* This library is free software; you can redistribute it and/or modify it under
Expand Down Expand Up @@ -617,7 +617,7 @@ void EventHandler::_magellanEventHandler( LPARAM lParam )
event.buttons |= PTR_BUTTON2;
if( pRawHid->bRawData[3] )
event.buttons |= PTR_BUTTON3;
_magellanNode->processEvent( EVENT_MAGELLAN_BUTTON, event );
_magellanNode->processEvent( event );
}
else
{
Expand All @@ -638,7 +638,7 @@ void EventHandler::_magellanEventHandler( LPARAM lParam )

_magellanGotRotation = false;
_magellanGotTranslation = false;
_magellanNode->processEvent( EVENT_MAGELLAN_AXIS, event );
_magellanNode->processEvent( event );
}
}
#endif
Expand Down
10 changes: 5 additions & 5 deletions eq/wgl/window.h
@@ -1,5 +1,5 @@

/* Copyright (c) 2005-2016, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2005-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Maxim Makhinya
*
* This library is free software; you can redistribute it and/or modify it under
Expand Down Expand Up @@ -67,12 +67,12 @@ class WindowIF : public GLWindow
{ return GLWindow::processEvent( type, event ); }

/** Process an axis event. @return true if the event was handled. */
virtual bool processEvent( EventType type, AxisEvent& event )
{ return GLWindow::processEvent( type, event ); }
virtual bool processEvent( AxisEvent& event )
{ return GLWindow::processEvent( event ); }

/** Process a button event. @return true if the event was handled. */
virtual bool processEvent( EventType type, ButtonEvent& event )
{ return GLWindow::processEvent( type, event ); }
virtual bool processEvent( ButtonEvent& event )
{ return GLWindow::processEvent( event ); }

/** Process a stateless event. @return true if the event was handled. */
virtual bool processEvent( EventType ) { return false; }
Expand Down
10 changes: 5 additions & 5 deletions eq/window.cpp
@@ -1,5 +1,5 @@

/* Copyright (c) 2005-2016, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2005-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Cedric Stalder <cedric.stalder@gmail.com>
* Daniel Nachbaur <danielnachbaur@gmail.com>
*
Expand Down Expand Up @@ -797,19 +797,19 @@ bool Window::processEvent( const EventType type, KeyEvent& event )
return true;
}

bool Window::processEvent( const EventType type, AxisEvent& event )
bool Window::processEvent( AxisEvent& event )
{
Config* config = getConfig();
updateEvent( event, config->getTime( ));
config->sendEvent( type ) << event;
config->sendEvent( EVENT_MAGELLAN_AXIS ) << event;
return true;
}

bool Window::processEvent( const EventType type, ButtonEvent& event )
bool Window::processEvent( ButtonEvent& event )
{
Config* config = getConfig();
updateEvent( event, config->getTime( ));
config->sendEvent( type ) << event;
config->sendEvent( EVENT_MAGELLAN_BUTTON ) << event;
return true;
}

Expand Down
6 changes: 3 additions & 3 deletions eq/window.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2005-2016, Stefan Eilemann <eile@equalizergraphics.com>
/* Copyright (c) 2005-2017, Stefan Eilemann <eile@equalizergraphics.com>
* Cedric Stalder <cedric.stalder@gmail.com>
* Daniel Nachbaur <danielnachbaur@gmail.com>
*
Expand Down Expand Up @@ -304,10 +304,10 @@ class Window : public fabric::Window< Pipe, Window, Channel, WindowSettings >,
EQ_API bool processEvent( EventType type, KeyEvent& event ) override;

/** @sa NotifierInterface::processEvent(). */
EQ_API bool processEvent( EventType type, AxisEvent& event ) override;
EQ_API bool processEvent( AxisEvent& event ) override;

/** @sa NotifierInterface::processEvent(). */
EQ_API bool processEvent( EventType type, ButtonEvent& event ) override;
EQ_API bool processEvent( ButtonEvent& event ) override;

EQ_API bool processEvent( Statistic& event );
//@}
Expand Down
7 changes: 3 additions & 4 deletions examples/eqPly/config.cpp
Expand Up @@ -688,7 +688,7 @@ bool Config::handleEvent( const eq::EventType type,
return eq::Config::handleEvent( type, event );
}

bool Config::handleEvent( const eq::EventType, const eq::AxisEvent& event )
bool Config::handleEvent( const eq::AxisEvent& event )
{
_spinX = 0;
_spinY = 0;
Expand All @@ -700,15 +700,14 @@ bool Config::handleEvent( const eq::EventType, const eq::AxisEvent& event )
return true;
}

bool Config::handleEvent( const eq::EventType type,
const eq::ButtonEvent& event )
bool Config::handleEvent( const eq::ButtonEvent& event )
{
if( event.button == eq::PTR_BUTTON1 )
{
_frameData.toggleColorMode();
return true;
}
return eq::Config::handleEvent( type, event );
return eq::Config::handleEvent( event );
}

bool Config::handleEvent( const eq::EventType type, const eq::Event& event )
Expand Down
4 changes: 2 additions & 2 deletions examples/eqPly/config.h
Expand Up @@ -75,8 +75,8 @@ class Config : public eq::Config
bool handleEvent( eq::EventType type, const eq::Event& event ) override;
bool handleEvent( eq::EventType type, const eq::KeyEvent& event ) override;
bool handleEvent( eq::EventType type, const eq::PointerEvent& ) override;
bool handleEvent( eq::EventType type, const eq::AxisEvent& event ) override;
bool handleEvent( eq::EventType type, const eq::ButtonEvent& ) override;
bool handleEvent( const eq::AxisEvent& event ) override;
bool handleEvent( const eq::ButtonEvent& ) override;

/** @return true if the application is idling. */
bool isIdleAA();
Expand Down

0 comments on commit c79ce87

Please sign in to comment.