1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2010 Robert TIMM (rti) <mail@rtti.de>
6 // Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
8 // This program is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU Affero General Public License as
10 // published by the Free Software Foundation, either version 3 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU Affero General Public License for more details.
18 // You should have received a copy of the GNU Affero General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef NL_UNIX_EVENT_EMITTER_H
22 #define NL_UNIX_EVENT_EMITTER_H
24 #include "nel/misc/types_nl.h"
25 #include "nel/misc/event_emitter.h"
26 #include "nel/misc/events.h"
28 #include "nel/3d/driver.h"
30 #if defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
38 * CEventEmitter UNIX implementation
39 * \author Vianney Lecroart
40 * \author Nevrax France
43 class CUnixEventEmitter
: public IEventEmitter
49 virtual ~CUnixEventEmitter();
52 * initialize CUnixEventEmitter
54 void init(Display
*dpy
, Window win
, NL3D::IDriver
*driver
= NULL
);
57 * sends all events to server
58 * (should call CEventServer method postEvent() )
60 virtual void submitEvents(CEventServer
& server
, bool allWindows
);
63 * process input-related events (mouse and keyboard)
65 bool processMessage(XEvent
&event
, CEventServer
*server
= NULL
);
68 * Copy a string to system clipboard.
70 virtual bool copyTextToClipboard(const std::string
&text
);
73 * Paste a string from system clipboard.
75 virtual bool pasteTextFromClipboard(std::string
&text
);
82 // Private internal server message
83 class CUnixEventServer
: CEventServer
85 friend class CUnixEventEmitter
;
87 void setServer (CEventServer
*server
)
92 virtual bool pumpEvent(CEvent
* event
)
94 CEventServer::pumpEvent(event
);
95 _Server
->postEvent (event
);
99 CEventServer
*_Server
;
104 std::map
<TKey
, bool> _PressedKeys
;
107 NL3D::IDriver
* _driver
;
108 CUnixEventServer _InternalServer
;
109 std::string _CopiedString
;
110 bool _SelectionOwned
;
116 #endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
118 #endif // NL_UNIX_EVENT_EMITTER_H
120 /* End of unix_event_emitter.h */