| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * synergy -- mouse and keyboard sharing utility
|
|---|
| 3 | * Copyright (C) 2004 Chris Schoeneman
|
|---|
| 4 | *
|
|---|
| 5 | * This package is free software; you can redistribute it and/or
|
|---|
| 6 | * modify it under the terms of the GNU General Public License
|
|---|
| 7 | * found in the file COPYING that should have accompanied this file.
|
|---|
| 8 | *
|
|---|
| 9 | * This package is distributed in the hope that it will be useful,
|
|---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 12 | * GNU General Public License for more details.
|
|---|
| 13 | */
|
|---|
| 14 |
|
|---|
| 15 | #include "CEvent.h"
|
|---|
| 16 | #include "CEventQueue.h"
|
|---|
| 17 |
|
|---|
| 18 | //
|
|---|
| 19 | // CEvent
|
|---|
| 20 | //
|
|---|
| 21 |
|
|---|
| 22 | CEvent::CEvent() :
|
|---|
| 23 | m_type(kUnknown),
|
|---|
| 24 | m_target(NULL),
|
|---|
| 25 | m_data(NULL),
|
|---|
| 26 | m_flags(0)
|
|---|
| 27 | {
|
|---|
| 28 | // do nothing
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | CEvent::CEvent(Type type, void* target, void* data, Flags flags) :
|
|---|
| 32 | m_type(type),
|
|---|
| 33 | m_target(target),
|
|---|
| 34 | m_data(data),
|
|---|
| 35 | m_flags(flags)
|
|---|
| 36 | {
|
|---|
| 37 | // do nothing
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | CEvent::Type
|
|---|
| 41 | CEvent::getType() const
|
|---|
| 42 | {
|
|---|
| 43 | return m_type;
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | void*
|
|---|
| 47 | CEvent::getTarget() const
|
|---|
| 48 | {
|
|---|
| 49 | return m_target;
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | void*
|
|---|
| 53 | CEvent::getData() const
|
|---|
| 54 | {
|
|---|
| 55 | return m_data;
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | CEvent::Flags
|
|---|
| 59 | CEvent::getFlags() const
|
|---|
| 60 | {
|
|---|
| 61 | return m_flags;
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | CEvent::Type
|
|---|
| 65 | CEvent::registerType(const char* name)
|
|---|
| 66 | {
|
|---|
| 67 | return EVENTQUEUE->registerType(name);
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 | CEvent::Type
|
|---|
| 71 | CEvent::registerTypeOnce(Type& type, const char* name)
|
|---|
| 72 | {
|
|---|
| 73 | return EVENTQUEUE->registerTypeOnce(type, name);
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 | const char*
|
|---|
| 77 | CEvent::getTypeName(Type type)
|
|---|
| 78 | {
|
|---|
| 79 | return EVENTQUEUE->getTypeName(type);
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| 82 | void
|
|---|
| 83 | CEvent::deleteData(const CEvent& event)
|
|---|
| 84 | {
|
|---|
| 85 | switch (event.getType()) {
|
|---|
| 86 | case kUnknown:
|
|---|
| 87 | case kQuit:
|
|---|
| 88 | case kSystem:
|
|---|
| 89 | case kTimer:
|
|---|
| 90 | break;
|
|---|
| 91 |
|
|---|
| 92 | default:
|
|---|
| 93 | if ((event.getFlags() & kDontFreeData) == 0) {
|
|---|
| 94 | free(event.getData());
|
|---|
| 95 | }
|
|---|
| 96 | break;
|
|---|
| 97 | }
|
|---|
| 98 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.