mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
Fixed: Compilation under Linux
This commit is contained in:
parent
b4e7d8cc1e
commit
d216c8610a
3 changed files with 54 additions and 7 deletions
|
@ -51,6 +51,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
Q_EXPORT_PLUGIN2(object_viewer_widget_qt, NLQT::CObjectViewerWidget)
|
Q_EXPORT_PLUGIN2(object_viewer_widget_qt, NLQT::CObjectViewerWidget)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(NL_OS_WINDOWS)
|
||||||
|
typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
#elif defined(NL_OS_MAC)
|
||||||
|
typedef bool (*cocoaProc)(NL3D::IDriver*, const void* e);
|
||||||
|
#else
|
||||||
|
typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e);
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
using namespace NL3D;
|
using namespace NL3D;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -735,11 +743,38 @@ namespace NLQT
|
||||||
_Scene->animate ( fdelta);
|
_Scene->animate ( fdelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_QT5
|
||||||
|
|
||||||
|
bool CObjectViewerWidget::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
||||||
|
{
|
||||||
|
if (getDriver() && getDriver()->isActive())
|
||||||
|
{
|
||||||
|
NL3D::IDriver *driver = dynamic_cast<NL3D::CDriverUser*>(getDriver())->getDriver();
|
||||||
|
if (driver)
|
||||||
|
{
|
||||||
|
// see what to do with result
|
||||||
|
#if defined(NL_OS_WINDOWS)
|
||||||
|
MSG *msg = (MSG*)message;
|
||||||
|
winProc proc = (winProc)driver->getWindowProc();
|
||||||
|
return proc(driver, msg->hwnd, msg->message, msg->wParam, msg->lParam);
|
||||||
|
#elif defined(NL_OS_MAC)
|
||||||
|
cocoaProc proc = (cocoaProc)driver->getWindowProc();
|
||||||
|
return proc(driver, message);
|
||||||
|
#else
|
||||||
|
x11Proc proc = (x11Proc)driver->getWindowProc();
|
||||||
|
return proc(driver, message);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#if defined(NL_OS_WINDOWS)
|
#if defined(NL_OS_WINDOWS)
|
||||||
|
|
||||||
typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
bool CObjectViewerWidget::winEvent(MSG *message, long *result)
|
||||||
|
|
||||||
bool CObjectViewerWidget::winEvent(MSG * message, long * result)
|
|
||||||
{
|
{
|
||||||
if (getDriver() && getDriver()->isActive())
|
if (getDriver() && getDriver()->isActive())
|
||||||
{
|
{
|
||||||
|
@ -756,8 +791,6 @@ namespace NLQT
|
||||||
|
|
||||||
#elif defined(NL_OS_MAC)
|
#elif defined(NL_OS_MAC)
|
||||||
|
|
||||||
typedef bool (*cocoaProc)(NL3D::IDriver*, const void* e);
|
|
||||||
|
|
||||||
bool CObjectViewerWidget::macEvent(EventHandlerCallRef caller, EventRef event)
|
bool CObjectViewerWidget::macEvent(EventHandlerCallRef caller, EventRef event)
|
||||||
{
|
{
|
||||||
if(caller)
|
if(caller)
|
||||||
|
@ -778,8 +811,6 @@ namespace NLQT
|
||||||
|
|
||||||
#elif defined(NL_OS_UNIX)
|
#elif defined(NL_OS_UNIX)
|
||||||
|
|
||||||
typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e);
|
|
||||||
|
|
||||||
bool CObjectViewerWidget::x11Event(XEvent *event)
|
bool CObjectViewerWidget::x11Event(XEvent *event)
|
||||||
{
|
{
|
||||||
if (getDriver() && getDriver()->isActive())
|
if (getDriver() && getDriver()->isActive())
|
||||||
|
@ -796,4 +827,6 @@ namespace NLQT
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -166,12 +166,18 @@ namespace NLQT
|
||||||
virtual QString name() const {return ("ObjectViewerWidget");}
|
virtual QString name() const {return ("ObjectViewerWidget");}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
#ifdef USE_QT5
|
||||||
|
virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result);
|
||||||
|
#else
|
||||||
|
|
||||||
#if defined(NL_OS_WINDOWS)
|
#if defined(NL_OS_WINDOWS)
|
||||||
virtual bool winEvent(MSG * message, long * result);
|
virtual bool winEvent(MSG * message, long * result);
|
||||||
#elif defined(NL_OS_MAC)
|
#elif defined(NL_OS_MAC)
|
||||||
virtual bool macEvent(EventHandlerCallRef caller, EventRef event);
|
virtual bool macEvent(EventHandlerCallRef caller, EventRef event);
|
||||||
#elif defined(NL_OS_UNIX)
|
#elif defined(NL_OS_UNIX)
|
||||||
virtual bool x11Event(XEvent *event);
|
virtual bool x11Event(XEvent *event);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
|
|
|
@ -56,4 +56,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <nel/misc/types_nl.h>
|
#include <nel/misc/types_nl.h>
|
||||||
#include <nel/misc/common.h>
|
#include <nel/misc/common.h>
|
||||||
|
|
||||||
|
#if defined(NL_OS_WINDOWS)
|
||||||
|
#define NOMINMAX
|
||||||
|
#include <Windows.h>
|
||||||
|
#elif defined(NL_OS_MAC)
|
||||||
|
#else
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue