Some fixes
This commit is contained in:
parent
70dc99ca6c
commit
23c428160f
@ -449,6 +449,15 @@ bool ContextManagerEGL::swapBuffers()
|
||||
}
|
||||
|
||||
|
||||
bool ContextManagerEGL::makeCurrent()
|
||||
{
|
||||
bool success = eglMakeCurrent(m_egl_display, m_egl_surface, m_egl_surface,
|
||||
m_egl_context);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
void ContextManagerEGL::reloadEGLSurface(void* window)
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_
|
||||
|
@ -78,6 +78,7 @@ public:
|
||||
|
||||
void reloadEGLSurface(void* window);
|
||||
bool swapBuffers();
|
||||
bool makeCurrent();
|
||||
bool isLegacyDevice() {return m_is_legacy_device;}
|
||||
bool getSurfaceDimensions(int* width, int* height);
|
||||
};
|
||||
|
@ -68,8 +68,13 @@ public:
|
||||
|
||||
CIrrDeviceWayland *device = static_cast<CIrrDeviceWayland *>(data);
|
||||
|
||||
|
||||
if (device->default_cursor)
|
||||
//TODO: move it to better place
|
||||
if (!device->getCursorControl()->isVisible() &&
|
||||
device->CreationParams.Fullscreen)
|
||||
{
|
||||
wl_pointer_set_cursor(pointer, serial, NULL, 0, 0);
|
||||
}
|
||||
else if (device->default_cursor)
|
||||
{
|
||||
wl_cursor_image* image = device->default_cursor->images[0];
|
||||
wl_buffer* buffer = wl_cursor_image_get_buffer(image);
|
||||
@ -167,9 +172,30 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
if (irrevent.MouseInput.Event != irr::EMIE_COUNT)
|
||||
{
|
||||
irrevent.MouseInput.ButtonStates = device->ButtonStates;
|
||||
|
||||
device->signalEvent(irrevent);
|
||||
|
||||
// It's not exactly true for middle/right button, but keep consistency with x11 device
|
||||
if ( irrevent.MouseInput.Event >= EMIE_LMOUSE_PRESSED_DOWN && irrevent.MouseInput.Event <= EMIE_MMOUSE_PRESSED_DOWN )
|
||||
{
|
||||
u32 clicks = device->checkSuccessiveClicks(irrevent.MouseInput.X, irrevent.MouseInput.Y, irrevent.MouseInput.Event);
|
||||
if ( clicks == 2 )
|
||||
{
|
||||
printf("doubleclick\n");
|
||||
irrevent.MouseInput.Event = (EMOUSE_INPUT_EVENT)(EMIE_LMOUSE_DOUBLE_CLICK + irrevent.MouseInput.Event-EMIE_LMOUSE_PRESSED_DOWN);
|
||||
device->signalEvent(irrevent);
|
||||
}
|
||||
else if ( clicks == 3 )
|
||||
{
|
||||
printf("tripleclick\n");
|
||||
irrevent.MouseInput.Event = (EMOUSE_INPUT_EVENT)(EMIE_LMOUSE_TRIPLE_CLICK + irrevent.MouseInput.Event-EMIE_LMOUSE_PRESSED_DOWN);
|
||||
device->signalEvent(irrevent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -611,8 +637,6 @@ const wl_registry_listener WaylandCallbacks::registry_listener = {
|
||||
|
||||
|
||||
|
||||
//const char* wmDeleteWindow = "WM_DELETE_WINDOW";
|
||||
|
||||
bool CIrrDeviceWayland::isWaylandDeviceWorking()
|
||||
{
|
||||
bool is_working = false;
|
||||
@ -743,24 +767,6 @@ CIrrDeviceWayland::~CIrrDeviceWayland()
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CIrrDeviceWayland::restoreResolution()
|
||||
{
|
||||
if (!CreationParams.Fullscreen)
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CIrrDeviceWayland::changeResolution()
|
||||
{
|
||||
if (!CreationParams.Fullscreen)
|
||||
return true;
|
||||
|
||||
getVideoModeList();
|
||||
|
||||
return CreationParams.Fullscreen;
|
||||
}
|
||||
|
||||
|
||||
void CIrrDeviceWayland::initEGL()
|
||||
{
|
||||
@ -820,52 +826,34 @@ void CIrrDeviceWayland::createDriver()
|
||||
os::Printer::log("Wayland driver only supports OpenGL.", ELL_ERROR);
|
||||
break;
|
||||
case video::EDT_OPENGL:
|
||||
// #ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
// if (Context)
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, this);
|
||||
/* #else
|
||||
#else
|
||||
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);
|
||||
#endif*/
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CIrrDeviceWayland::swapBuffers()
|
||||
{
|
||||
wl_display_dispatch_pending(display);
|
||||
EglContext->swapBuffers();
|
||||
}
|
||||
|
||||
|
||||
//! runs the device. Returns false if device wants to be deleted
|
||||
bool CIrrDeviceWayland::run()
|
||||
{
|
||||
os::Timer::tick();
|
||||
|
||||
// printf("vents size is %d\n", events.size());
|
||||
for (unsigned i = 0; i < events.size(); i++)
|
||||
{
|
||||
postEventFromUser(events[i]);
|
||||
}
|
||||
|
||||
/* if (irrevent.MouseInput.Event != irr::EMIE_COUNT)
|
||||
{
|
||||
printf("posteventfromuser\n");
|
||||
bool v = postEventFromUser(irrevent);
|
||||
printf("v is %d\n", v);
|
||||
|
||||
if ( irrevent.MouseInput.Event >= EMIE_LMOUSE_PRESSED_DOWN && irrevent.MouseInput.Event <= EMIE_MMOUSE_PRESSED_DOWN )
|
||||
{
|
||||
u32 clicks = checkSuccessiveClicks(irrevent.MouseInput.X, irrevent.MouseInput.Y, irrevent.MouseInput.Event);
|
||||
if ( clicks == 2 )
|
||||
{
|
||||
irrevent.MouseInput.Event = (EMOUSE_INPUT_EVENT)(EMIE_LMOUSE_DOUBLE_CLICK + irrevent.MouseInput.Event-EMIE_LMOUSE_PRESSED_DOWN);
|
||||
postEventFromUser(irrevent);
|
||||
}
|
||||
else if ( clicks == 3 )
|
||||
{
|
||||
irrevent.MouseInput.Event = (EMOUSE_INPUT_EVENT)(EMIE_LMOUSE_TRIPLE_CLICK + irrevent.MouseInput.Event-EMIE_LMOUSE_PRESSED_DOWN);
|
||||
postEventFromUser(irrevent);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
events.clear();
|
||||
|
||||
|
||||
if (!Close)
|
||||
pollJoysticks();
|
||||
|
||||
@ -1409,9 +1397,6 @@ void CIrrDeviceWayland::clearSystemMessages()
|
||||
{
|
||||
}
|
||||
|
||||
void CIrrDeviceWayland::initXAtoms()
|
||||
{
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
|
||||
|
@ -125,11 +125,6 @@ namespace irr
|
||||
|
||||
void pollJoysticks();
|
||||
|
||||
void initXAtoms();
|
||||
|
||||
bool restoreResolution();
|
||||
bool changeResolution();
|
||||
|
||||
//! Implementation of the linux cursor control
|
||||
class CCursorControl : public gui::ICursorControl
|
||||
{
|
||||
@ -274,6 +269,7 @@ namespace irr
|
||||
u32 ButtonStates;
|
||||
|
||||
ContextManagerEGL* getEGLContext() {return EglContext;}
|
||||
void swapBuffers();
|
||||
|
||||
private:
|
||||
// XVisualInfo* visual;
|
||||
|
@ -702,9 +702,15 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
|
||||
}
|
||||
|
||||
|
||||
bool COpenGLDriver::changeRenderContext(const SExposedVideoData& videoData, CIrrDeviceWayland* device)
|
||||
bool COpenGLDriver::changeRenderContext(const SExposedVideoData& videoData,
|
||||
CIrrDeviceWayland* device)
|
||||
{
|
||||
//TODO
|
||||
if (!device->getEGLContext()->makeCurrent())
|
||||
{
|
||||
os::Printer::log("Render Context switch failed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -712,12 +718,6 @@ bool COpenGLDriver::changeRenderContext(const SExposedVideoData& videoData, CIrr
|
||||
//! inits the open gl driver
|
||||
bool COpenGLDriver::initDriver(CIrrDeviceWayland* device)
|
||||
{
|
||||
/* ExposedData.OpenGLLinux.X11Context = glXGetCurrentContext();
|
||||
ExposedData.OpenGLLinux.X11Display = glXGetCurrentDisplay();
|
||||
ExposedData.OpenGLLinux.X11Window = (unsigned long)Params.WindowId;
|
||||
Drawable = glXGetCurrentDrawable();
|
||||
X11Display = (Display*)ExposedData.OpenGLLinux.X11Display;*/
|
||||
|
||||
genericDriverInit();
|
||||
|
||||
return true;
|
||||
@ -982,9 +982,7 @@ bool COpenGLDriver::endScene()
|
||||
#ifdef _IRR_COMPILE_WITH_WAYLAND
|
||||
if (DeviceType == EIDT_WAYLAND)
|
||||
{
|
||||
wl_display_dispatch_pending(wl_device->display);
|
||||
wl_device->getEGLContext()->swapBuffers();
|
||||
|
||||
wl_device->swapBuffers();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
@ -1056,6 +1054,11 @@ bool COpenGLDriver::beginScene(bool backBuffer, bool zBuffer, SColor color,
|
||||
case EIDT_X11:
|
||||
changeRenderContext(videoData, X11Device);
|
||||
break;
|
||||
#endif
|
||||
#ifdef _IRR_COMPILE_WITH_WAYLAND
|
||||
case EIDT_WAYLAND:
|
||||
changeRenderContext(videoData, wl_device);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
changeRenderContext(videoData, (void*)0);
|
||||
|
@ -764,7 +764,7 @@ void IrrDriver::initDevice()
|
||||
#ifndef SERVER_ONLY
|
||||
// set cursor visible by default (what's the default is not too clearly documented,
|
||||
// so let's decide ourselves...)
|
||||
//m_device->getCursorControl()->setVisible(true);
|
||||
m_device->getCursorControl()->setVisible(true);
|
||||
m_pointer_shown = true;
|
||||
#endif
|
||||
} // initDevice
|
||||
@ -837,7 +837,7 @@ void IrrDriver::showPointer()
|
||||
if (!m_pointer_shown)
|
||||
{
|
||||
m_pointer_shown = true;
|
||||
// this->getDevice()->getCursorControl()->setVisible(true);
|
||||
this->getDevice()->getCursorControl()->setVisible(true);
|
||||
}
|
||||
} // showPointer
|
||||
|
||||
@ -847,14 +847,14 @@ void IrrDriver::hidePointer()
|
||||
// always visible in artist debug mode, to be able to use the context menu
|
||||
if (UserConfigParams::m_artist_debug_mode)
|
||||
{
|
||||
// this->getDevice()->getCursorControl()->setVisible(true);
|
||||
this->getDevice()->getCursorControl()->setVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_pointer_shown)
|
||||
{
|
||||
m_pointer_shown = false;
|
||||
// this->getDevice()->getCursorControl()->setVisible(false);
|
||||
this->getDevice()->getCursorControl()->setVisible(false);
|
||||
}
|
||||
} // hidePointer
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user