• Main Page
  • Classes
  • Files
  • File List

CEvent.cpp

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2012 Bolton Software Ltd.
00004  * Copyright (C) 2004 Chris Schoeneman
00005  * 
00006  * This package is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * found in the file COPYING that should have accompanied this file.
00009  * 
00010  * This package is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #include "CEvent.h"
00020 #include "CEventQueue.h"
00021 
00022 //
00023 // CEvent
00024 //
00025 
00026 CEvent::CEvent() :
00027     m_type(kUnknown),
00028     m_target(NULL),
00029     m_data(NULL),
00030     m_flags(0),
00031     m_dataObject(nullptr)
00032 {
00033     // do nothing
00034 }
00035 
00036 CEvent::CEvent(Type type, void* target, void* data, Flags flags) :
00037     m_type(type),
00038     m_target(target),
00039     m_data(data),
00040     m_flags(flags),
00041     m_dataObject(nullptr)
00042 {
00043     // do nothing
00044 }
00045 
00046 CEvent::Type
00047 CEvent::getType() const
00048 {
00049     return m_type;
00050 }
00051 
00052 void*
00053 CEvent::getTarget() const
00054 {
00055     return m_target;
00056 }
00057 
00058 void*
00059 CEvent::getData() const
00060 {
00061     return m_data;
00062 }
00063 
00064 CEventData*
00065 CEvent::getDataObject() const
00066 {
00067     return m_dataObject;
00068 }
00069 
00070 CEvent::Flags
00071 CEvent::getFlags() const
00072 {
00073     return m_flags;
00074 }
00075 
00076 void
00077 CEvent::deleteData(const CEvent& event)
00078 {
00079     switch (event.getType()) {
00080     case kUnknown:
00081     case kQuit:
00082     case kSystem:
00083     case kTimer:
00084         break;
00085 
00086     default:
00087         if ((event.getFlags() & kDontFreeData) == 0) {
00088             free(event.getData());
00089             delete event.getDataObject();
00090         }
00091         break;
00092     }
00093 }
00094 
00095 void
00096 CEvent::setDataObject(CEventData* dataObject)
00097 {
00098     assert(m_dataObject == nullptr);
00099     m_dataObject = dataObject;
00100 }

Generated on Sun May 19 2013 00:00:04 for Synergy by  doxygen 1.7.1