Ejemplo n.º 1
0
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
{
    if (mode == GLFW_CURSOR_DISABLED)
    {
        _glfw.mir.disabledCursorWindow = window;
        setSurfaceConfinement(window, mir_pointer_confined_to_surface);
        mir_wait_for(mir_surface_configure_cursor(window->mir.surface, _glfw.mir.disabledConf));
    }
    else
    {
        // If we were disabled before lets undo that!
        if (_glfw.mir.disabledCursorWindow == window)
        {
            _glfw.mir.disabledCursorWindow = NULL;
            setSurfaceConfinement(window, mir_pointer_unconfined);
        }

        if (window->cursorMode == GLFW_CURSOR_NORMAL)
        {
            _glfwPlatformSetCursor(window, window->mir.currentCursor);
        }
        else if (window->cursorMode == GLFW_CURSOR_HIDDEN)
        {
            mir_wait_for(mir_surface_configure_cursor(window->mir.surface, _glfw.mir.disabledConf));
        }
    }
}
Ejemplo n.º 2
0
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
{
    if (cursor && cursor->mir.conf)
    {
        window->mir.currentCursor = cursor;

        mir_wait_for(mir_surface_configure_cursor(window->mir.surface, cursor->mir.conf));
        if (cursor->mir.customCursor)
        {
            mir_buffer_stream_swap_buffers_sync(cursor->mir.customCursor);
        }
    }
    else
    {
        mir_wait_for(mir_surface_configure_cursor(window->mir.surface, _glfw.mir.defaultConf));
    }
}
Ejemplo n.º 3
0
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
{
    if (cursor && cursor->mir.conf)
    {
        mir_wait_for(mir_surface_configure_cursor(window->mir.surface, cursor->mir.conf));
        if (cursor->mir.custom_cursor)
        {
            /* FIXME Bug https://bugs.launchpad.net/mir/+bug/1477285
                     Requires a triple buffer swap to get the cursor buffer on top! (since mir is tripled buffered)
            */
            mir_buffer_stream_swap_buffers_sync(cursor->mir.custom_cursor);
            mir_buffer_stream_swap_buffers_sync(cursor->mir.custom_cursor);
            mir_buffer_stream_swap_buffers_sync(cursor->mir.custom_cursor);
        }
    }
    else
    {
        mir_wait_for(mir_surface_configure_cursor(window->mir.surface, _glfw.mir.default_conf));
    }
}