Linux multi-monitor fullscreen support
[ryzomcore.git] / nel / src / 3d / driver / opengl / unix_event_emitter.h
blob297fdcb5aee8868b623663e6658c4141b3bf50b6
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
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>
7 //
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)
32 #include <X11/Xlib.h>
34 namespace NLMISC {
37 /**
38 * CEventEmitter UNIX implementation
39 * \author Vianney Lecroart
40 * \author Nevrax France
41 * \date 2000
43 class CUnixEventEmitter : public IEventEmitter
45 public:
47 /// Constructor
48 CUnixEventEmitter();
49 virtual ~CUnixEventEmitter();
51 /**
52 * initialize CUnixEventEmitter
54 void init(Display *dpy, Window win, NL3D::IDriver *driver = NULL);
56 /**
57 * sends all events to server
58 * (should call CEventServer method postEvent() )
60 virtual void submitEvents(CEventServer & server, bool allWindows);
62 /**
63 * process input-related events (mouse and keyboard)
65 bool processMessage(XEvent &event, CEventServer *server = NULL);
67 /**
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);
77 void createIM();
78 void closeIM();
80 private:
82 // Private internal server message
83 class CUnixEventServer : CEventServer
85 friend class CUnixEventEmitter;
86 public:
87 void setServer (CEventServer *server)
89 _Server=server;
91 private:
92 virtual bool pumpEvent(CEvent* event)
94 CEventServer::pumpEvent(event);
95 _Server->postEvent (event);
96 return false;
98 private:
99 CEventServer *_Server;
102 Display* _dpy;
103 Window _win;
104 std::map<TKey, bool> _PressedKeys;
105 XIM _im;
106 XIC _ic;
107 NL3D::IDriver* _driver;
108 CUnixEventServer _InternalServer;
109 std::string _CopiedString;
110 bool _SelectionOwned;
114 } // NLMISC
116 #endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
118 #endif // NL_UNIX_EVENT_EMITTER_H
120 /* End of unix_event_emitter.h */