Exemple #1
0
static void pointerHandleEnter(void* data,
                               struct wl_pointer* pointer,
                               uint32_t serial,
                               struct wl_surface* surface,
                               wl_fixed_t sx,
                               wl_fixed_t sy)
{
    // Happens in the case we just destroyed the surface.
    if (!surface)
        return;

    int focus = 0;
    _GLFWwindow* window = wl_surface_get_user_data(surface);
    if (!window)
    {
        window = findWindowFromDecorationSurface(surface, &focus);
        if (!window)
            return;
    }

    window->wl.decorations.focus = focus;
    _glfw.wl.pointerSerial = serial;
    _glfw.wl.pointerFocus = window;

    window->wl.hovered = GLFW_TRUE;

    _glfwPlatformSetCursor(window, window->wl.currentCursor);
    _glfwInputCursorEnter(window, GLFW_TRUE);
}
Exemple #2
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));
        }
    }
}
Exemple #3
0
GLFWAPI void glfwSetCursor(GLFWwindow* windowHandle, GLFWcursor* cursorHandle)
{
    _GLFWwindow* window = (_GLFWwindow*) windowHandle;
    _GLFWcursor* cursor = (_GLFWcursor*) cursorHandle;

    _GLFW_REQUIRE_INIT();

    _glfwPlatformSetCursor(window, cursor);

    window->cursor = cursor;
}
Exemple #4
0
static void pointerHandleEnter(void* data,
                               struct wl_pointer* pointer,
                               uint32_t serial,
                               struct wl_surface* surface,
                               wl_fixed_t sx,
                               wl_fixed_t sy)
{
    _GLFWwindow* window = wl_surface_get_user_data(surface);

    _glfw.wl.pointerSerial = serial;
    _glfw.wl.pointerFocus = window;

    _glfwPlatformSetCursor(window, window->wl.currentCursor);
    _glfwInputCursorEnter(window, GLFW_TRUE);
}