Example #1
0
int _glfwPlatformInit(void)
{
    int error;

    _glfw.mir.connection = mir_connect_sync(NULL, __PRETTY_FUNCTION__);

    if (!mir_connection_is_valid(_glfw.mir.connection))
    {
        _glfwInputError(GLFW_PLATFORM_ERROR,
                        "Mir: Unable to connect to server: %s",
                        mir_connection_get_error_message(_glfw.mir.connection));

        return GLFW_FALSE;
    }

    _glfw.mir.display =
        mir_connection_get_egl_native_display(_glfw.mir.connection);

    createKeyTables();

    if (!_glfwInitThreadLocalStoragePOSIX())
        return GLFW_FALSE;

    if (!_glfwInitJoysticksLinux())
        return GLFW_FALSE;

    _glfwInitTimerPOSIX();

    // Need the default conf for when we set a NULL cursor
    _glfw.mir.defaultConf  = mir_cursor_configuration_from_name(mir_default_cursor_name);
    _glfw.mir.disabledConf = mir_cursor_configuration_from_name(mir_disabled_cursor_name);

    _glfw.mir.eventQueue = calloc(1, sizeof(EventQueue));
    _glfwInitEventQueueMir(_glfw.mir.eventQueue);

    error = pthread_mutex_init(&_glfw.mir.eventMutex, NULL);
    if (error)
    {
        _glfwInputError(GLFW_PLATFORM_ERROR,
                        "Mir: Failed to create event mutex: %s",
                        strerror(error));
        return GLFW_FALSE;
    }

    _glfwPollMonitorsMir();
    return GLFW_TRUE;
}
Example #2
0
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
{
    char const* cursor_name = getSystemCursorName(shape);

    if (cursor_name)
    {
        cursor->mir.conf          = mir_cursor_configuration_from_name(cursor_name);
        cursor->mir.custom_cursor = NULL;

        return GL_TRUE;
    }

    return GL_FALSE;
}