WaylandWindow: Populate relative mouse coordinates when in grab mode

This commit is contained in:
mrkubax10 2023-09-26 10:29:43 +02:00
parent 2b8c81822f
commit 5e03acbc95
2 changed files with 4 additions and 5 deletions

View File

@ -92,6 +92,7 @@ void EGLGLContext::initialize() {
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 8,
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_NONE
};

View File

@ -347,10 +347,8 @@ WaylandWindow::~WaylandWindow() {
libdecor_frame_unref(m_frame);
libdecor_unref(m_libdecor_context);
#if defined(RENDERER_GL)
if(m_egl_context) {
delete m_egl_context;
if(m_egl_context)
wl_egl_window_destroy(m_egl_window);
}
#endif
wl_surface_destroy(m_mouse_surface);
wl_surface_destroy(m_surface);
@ -600,8 +598,8 @@ void WaylandWindow::handle_relative_pointer_motion(void* data, struct zwp_relati
if(window->m_mouse_grabbed) {
Event new_event;
new_event.m_type = EventType::EVENT_TYPE_MOUSE_MOVE;
window->m_mouse_x = new_event.m_data.m_mouse_event.m_x = window->m_width/2+wl_fixed_to_int(dx);
window->m_mouse_x = new_event.m_data.m_mouse_event.m_y = window->m_height/2+wl_fixed_to_int(dy);
window->m_mouse_x = new_event.m_data.m_mouse_event.m_relative_x = wl_fixed_to_int(dx);
window->m_mouse_x = new_event.m_data.m_mouse_event.m_relative_y = -wl_fixed_to_int(dy);
window->push_event(new_event);
}
}