Esempio n. 1
0
GLFWAPI void glfwSetWindowAttrib(GLFWwindow* handle, int attrib, int value)
{
    _GLFWwindow* window = (_GLFWwindow*) handle;
    assert(window != NULL);

    _GLFW_REQUIRE_INIT();

    value = value ? GLFW_TRUE : GLFW_FALSE;

    switch (attrib)
    {
        case GLFW_RESIZABLE:
            if (window->resizable != value)
            {
                window->resizable = value;
                if (!window->monitor)
                    _glfwPlatformSetWindowResizable(window, value);
            }
            return;

        case GLFW_DECORATED:
            if (window->decorated != value)
            {
                window->decorated = value;
                if (!window->monitor)
                    _glfwPlatformSetWindowDecorated(window, value);
            }
            return;

        case GLFW_FLOATING:
            if (window->floating != value)
            {
                window->floating = value;
                if (!window->monitor)
                    _glfwPlatformSetWindowFloating(window, value);
            }
            return;

        case GLFW_AUTO_ICONIFY:
            window->autoIconify = value;
            return;
    }

    _glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib);
}
Esempio n. 2
0
File: window.c Progetto: hanxi/glfw
GLFWAPI void glfwSetWindowAttrib(GLFWwindow* handle, int attrib, int value)
{
    _GLFWwindow* window = (_GLFWwindow*) handle;
    assert(window != NULL);

    _GLFW_REQUIRE_INIT();

    value = value ? GLFW_TRUE : GLFW_FALSE;

    if (attrib == GLFW_AUTO_ICONIFY)
        window->autoIconify = value;
    else if (attrib == GLFW_RESIZABLE)
    {
        if (window->resizable == value)
            return;

        window->resizable = value;
        if (!window->monitor)
            _glfwPlatformSetWindowResizable(window, value);
    }
    else if (attrib == GLFW_DECORATED)
    {
        if (window->decorated == value)
            return;

        window->decorated = value;
        if (!window->monitor)
            _glfwPlatformSetWindowDecorated(window, value);
    }
    else if (attrib == GLFW_FLOATING)
    {
        if (window->floating == value)
            return;

        window->floating = value;
        if (!window->monitor)
            _glfwPlatformSetWindowFloating(window, value);
    }
    else if (attrib == GLFW_FOCUS_ON_SHOW)
        window->focusOnShow = value;
    else
        _glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib);
}