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); }
static void pointer_handle_enter(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t sx_w, wl_fixed_t sy_w) { struct SDL_WaylandInput *input = data; SDL_WindowData *window; if (!surface) { /* enter event for a window we've just destroyed */ return; } /* This handler will be called twice in Wayland 1.4 * Once for the window surface which has valid user data * and again for the mouse cursor surface which does not have valid user data * We ignore the later */ window = (SDL_WindowData *)wl_surface_get_user_data(surface); if (window) { input->pointer_focus = window; SDL_SetMouseFocus(window->sdlwindow); } }
static void window_handle_pointer_focus(void *data, struct wl_input_device *input_device, uint32_t time, struct wl_surface *surface, int32_t x, int32_t y, int32_t sx, int32_t sy) { struct input *input = data; struct window *window; int pointer; if (surface) { input->pointer_focus = wl_surface_get_user_data(surface); window = input->pointer_focus; input->x = x; input->y = y; input->sx = sx; input->sy = sy; pointer = POINTER_LEFT_PTR; if (window->motion_handler) pointer = (*window->motion_handler)(window, input, time, x, y, sx, sy, window->user_data); set_pointer_image(input, time, pointer); } else { input->pointer_focus = NULL; input->current_pointer_image = POINTER_UNSET; } }
static void clutter_wayland_handle_pointer_leave (void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface) { ClutterInputDeviceWayland *device = data; ClutterStageCogl *stage_cogl; ClutterEvent *event; stage_cogl = wl_surface_get_user_data (surface); g_assert (device->pointer_focus == stage_cogl); event = clutter_event_new (CLUTTER_LEAVE); event->crossing.stage = stage_cogl->wrapper; event->crossing.time = 0; /* ?! */ event->crossing.x = device->x; event->crossing.y = device->y; event->crossing.source = CLUTTER_ACTOR (stage_cogl->wrapper); event->crossing.device = CLUTTER_INPUT_DEVICE (device); _clutter_event_push (event, FALSE); device->pointer_focus = NULL; _clutter_input_device_set_stage (CLUTTER_INPUT_DEVICE (device), NULL); }
void QWaylandInputDevice::inputHandlePointerFocus(void *data, struct wl_input_device *input_device, uint32_t time, struct wl_surface *surface, int32_t x, int32_t y, int32_t sx, int32_t sy) { Q_UNUSED(input_device); Q_UNUSED(x); Q_UNUSED(y); Q_UNUSED(sx); Q_UNUSED(sy); QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data; QWaylandWindow *window; if (inputDevice->mPointerFocus) { window = inputDevice->mPointerFocus; QWindowSystemInterface::handleLeaveEvent(window->widget()); inputDevice->mPointerFocus = NULL; } if (surface) { window = (QWaylandWindow *) wl_surface_get_user_data(surface); QWindowSystemInterface::handleEnterEvent(window->widget()); inputDevice->mPointerFocus = window; } inputDevice->mTime = time; }
static void handle_configure (void *data, struct wl_shell *shell, uint32_t timestamp, uint32_t edges, struct wl_surface *surface, int32_t width, int32_t height) { ClutterStageWayland *stage_wayland; stage_wayland = wl_surface_get_user_data (surface); if ((stage_wayland->allocation.width != width) || (stage_wayland->allocation.height != height)) { clutter_actor_queue_relayout (CLUTTER_ACTOR (stage_wayland->wrapper)); } stage_wayland->pending_allocation.width = width; stage_wayland->pending_allocation.height = height; stage_wayland->allocation = stage_wayland->pending_allocation; clutter_actor_set_size (CLUTTER_ACTOR (stage_wayland->wrapper), width, height); /* the resize process is complete, so we can ask the stage * to set up the GL viewport with the new size */ clutter_stage_ensure_viewport (stage_wayland->wrapper); }
static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface, struct wl_array *keys) { uint32_t *key, *pressedKey; UwacSeat *input = (UwacSeat *)data; int i, found; UwacKeyboardEnterLeaveEvent *event; event = (UwacKeyboardEnterLeaveEvent *)UwacDisplayNewEvent(input->display, UWAC_EVENT_KEYBOARD_ENTER); if (!event) return; event->window = input->keyboard_focus = (UwacWindow *)wl_surface_get_user_data(surface); /* look for keys that have been released */ found = false; for (pressedKey = input->pressed_keys.data, i = 0; i < input->pressed_keys.size; i += sizeof(uint32_t)) { wl_array_for_each(key, keys) { if (*key == *pressedKey) { found = true; break; } } if (!found) { keyboard_handle_key(data, keyboard, serial, 0, *pressedKey, WL_KEYBOARD_KEY_STATE_RELEASED); } else { pressedKey++; } } /* handle keys that are now pressed */ wl_array_for_each(key, keys) { keyboard_handle_key(data, keyboard, serial, 0, *key, WL_KEYBOARD_KEY_STATE_PRESSED); }
static void shell_handle_configure(void *data, struct wl_shell *shell, uint32_t time, uint32_t edges, struct wl_surface *surface, int32_t width, int32_t height) { GdkWindow *window; GdkDisplay *display; GdkEvent *event; window = wl_surface_get_user_data(surface); display = gdk_window_get_display (window); event = gdk_event_new (GDK_CONFIGURE); event->configure.window = window; event->configure.send_event = FALSE; event->configure.width = width; event->configure.height = height; _gdk_window_update_size (window); _gdk_wayland_window_update_size (window, width, height, edges); g_object_ref(window); _gdk_wayland_display_deliver_event (display, event); }
void QWaylandInputDevice::inputHandleKeyboardFocus(void *data, struct wl_input_device *input_device, uint32_t time, struct wl_surface *surface, struct wl_array *keys) { #ifndef QT_NO_WAYLAND_XKB Q_UNUSED(input_device); Q_UNUSED(time); QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data; QWaylandWindow *window; uint32_t *k, *end; uint32_t code; end = (uint32_t *) ((char *) keys->data + keys->size); inputDevice->mModifiers = 0; for (k = (uint32_t *) keys->data; k < end; k++) { code = *k + inputDevice->mXkb->min_key_code; inputDevice->mModifiers |= translateModifiers(inputDevice->mXkb->map->modmap[code]); } if (surface) { window = (QWaylandWindow *) wl_surface_get_user_data(surface); inputDevice->mKeyboardFocus = window; QWindowSystemInterface::handleWindowActivated(window->widget()); } else { inputDevice->mKeyboardFocus = NULL; QWindowSystemInterface::handleWindowActivated(0); } #endif }
Surface *SurfacePrivate::fromWlSurface(struct ::wl_surface *surface) { if (!surface) return Q_NULLPTR; QtWayland::wl_surface *wlSurface = static_cast<QtWayland::wl_surface *>(wl_surface_get_user_data(surface)); return static_cast<SurfacePrivate *>(wlSurface)->q_func(); }
static void keyboard_handle_leave(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, struct wl_surface *wl_surface) { struct keyboard *keyboard = data; keyboard->focus = NULL; fprintf(stderr, "test-client: got keyboard leave, surface %p\n", wl_surface_get_user_data(wl_surface)); }
static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *wl_surface) { struct pointer *pointer = data; pointer->focus = NULL; fprintf(stderr, "test-client: got pointer leave, surface %p\n", wl_surface_get_user_data(wl_surface)); }
static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface, struct wl_array *keys) { struct input *input = data; input->keyboard_focus = wl_surface_get_user_data(surface); fprintf(stderr, "test-client: got keyboard enter, surface %p\n", surface); }
static void keyboardHandleEnter(void* data, struct wl_keyboard* keyboard, uint32_t serial, struct wl_surface* surface, struct wl_array* keys) { _GLFWwindow* window = wl_surface_get_user_data(surface); _glfw.wl.keyboardFocus = window; _glfwInputWindowFocus(window, GLFW_TRUE); }
static void pointerHandleButton(void *data, struct wl_pointer *pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state_w) { XdevLWindowEventServerWayland* wes = (XdevLWindowEventServerWayland*)data; XdevLWindowWayland* window = (XdevLWindowWayland*)wl_surface_get_user_data(wes->getCurrentWindow()); // // TODO For now we just allow to move the window just with a button press. // if( (button == BTN_RIGHT) && (state_w == WL_POINTER_BUTTON_STATE_PRESSED)) { wl_shell_surface_move(window->getNativeShellSurface(), m_seat, serial); } else if( (button == BTN_MIDDLE) && (state_w == WL_POINTER_BUTTON_STATE_PRESSED)) { wl_shell_surface_resize(window->getNativeShellSurface(), m_seat, serial, 0); } // // Set which button we use. // XdevLEvent ev; xdl_uint32 state = state_w; switch (button) { case BTN_LEFT: ev.button.button = BUTTON_LEFT; break; case BTN_MIDDLE: ev.button.button = BUTTON_MIDDLE; break; case BTN_RIGHT: ev.button.button = BUTTON_RIGHT; break; case BTN_SIDE: ev.button.button = BUTTON_SIDE; break; case BTN_EXTRA: ev.button.button = BUTTON_EXTRA; break; default: return; } ev.common.timestamp = wes->getMediator()->getTimer().getTime64(); ev.type = state ? MouseButtonPressed.getHashCode() : MouseButtonReleased.getHashCode(); xdl_int x, y; wes->getCurrentPointerPosition(x, y); ev.button.x = x; ev.button.y = y; ev.window.windowid = window->getWindowID(); wes->getMediator()->fireEvent(ev); }
static void clutter_wayland_handle_pointer_enter (void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y) { ClutterInputDeviceWayland *device = data; ClutterStageCogl *stage_cogl; ClutterEvent *event; ClutterBackend *backend; ClutterBackendWayland *backend_wayland; stage_cogl = wl_surface_get_user_data (surface); device->pointer_focus = stage_cogl; _clutter_input_device_set_stage (CLUTTER_INPUT_DEVICE (device), stage_cogl->wrapper); event = clutter_event_new (CLUTTER_ENTER); event->crossing.stage = stage_cogl->wrapper; event->crossing.time = 0; /* ?! */ event->crossing.x = wl_fixed_to_double(x); event->crossing.y = wl_fixed_to_double(y); event->crossing.source = CLUTTER_ACTOR (stage_cogl->wrapper); event->crossing.device = CLUTTER_INPUT_DEVICE (device); device->x = event->crossing.x; device->y = event->crossing.y; _clutter_event_push (event, FALSE); /* Set the cursor to the cursor loaded at backend initialisation */ backend = clutter_get_default_backend (); backend_wayland = CLUTTER_BACKEND_WAYLAND (backend); wl_pointer_set_cursor (pointer, serial, backend_wayland->cursor_surface, backend_wayland->cursor_x, backend_wayland->cursor_y); wl_surface_attach (backend_wayland->cursor_surface, backend_wayland->cursor_buffer, 0, 0); wl_surface_damage (backend_wayland->cursor_surface, 0, 0, 32, /* XXX: FFS */ 32); wl_surface_commit (backend_wayland->cursor_surface); }
static void keyboard_handle_enter(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, struct wl_surface *wl_surface, struct wl_array *keys) { struct keyboard *keyboard = data; keyboard->focus = wl_surface_get_user_data(wl_surface); fprintf(stderr, "test-client: got keyboard enter, surface %p\n", keyboard->focus); }
static void pointer_handle_enter(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y) { struct input *input = data; input->pointer_focus = wl_surface_get_user_data(surface); input->x = wl_fixed_to_double(x); input->y = wl_fixed_to_double(y); fprintf(stderr, "test-client: got pointer enter %f %f, surface %p\n", input->x, input->y, surface); }
/* parent input interface */ static void input_handle_pointer_enter(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y) { struct wayland_input *input = data; /* XXX: If we get a modifier event immediately before the focus, * we should try to keep the same serial. */ input->enter_serial = serial; input->output = wl_surface_get_user_data(surface); check_focus(input, x, y); }
static void keyboardHandleEnter(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface, struct wl_array *keys) { XdevLWindowEventServerWayland* wes = (XdevLWindowEventServerWayland*)data; XdevLWindowWayland* window = (XdevLWindowWayland*)wl_surface_get_user_data(surface); wes->setFocusWindow(window); XdevLEvent ev; ev.common.timestamp = wes->getMediator()->getTimer().getTime64(); ev.type = XDEVL_WINDOW_EVENT; ev.window.event = XDEVL_WINDOW_INPUT_FOCUS_GAINED; ev.window.windowid = window->getWindowID(); wes->getMediator()->fireEvent(ev); }
void QWaylandDisplay::shellHandleConfigure(void *data, struct wl_shell *shell, uint32_t time, uint32_t edges, struct wl_surface *surface, int32_t width, int32_t height) { Q_UNUSED(data); Q_UNUSED(shell); Q_UNUSED(time); Q_UNUSED(edges); QWaylandWindow *ww = (QWaylandWindow *) wl_surface_get_user_data(surface); ww->configure(time, edges, 0, 0, width, height); }
static void pointer_button(void *data, struct wl_pointer *wl_pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state) { struct pointer_data *pointer_data; void (*callback)(uint32_t); pointer_data = wl_pointer_get_user_data(wl_pointer); callback = wl_surface_get_user_data( pointer_data->target_surface); if (callback != NULL) callback(button); }
static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *wl_surface, wl_fixed_t x, wl_fixed_t y) { struct pointer *pointer = data; pointer->focus = wl_surface_get_user_data(wl_surface); pointer->x = wl_fixed_to_int(x); pointer->y = wl_fixed_to_int(y); fprintf(stderr, "test-client: got pointer enter %d %d, surface %p\n", pointer->x, pointer->y, pointer->focus); }
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); }
static void pointerHandleMotion(void *data, struct wl_pointer *pointer, uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w) { XdevLWindowEventServerWayland* wes = (XdevLWindowEventServerWayland*)data; XdevLEvent ev; ev.common.timestamp = wes->getMediator()->getTimer().getTime64(); ev.type = MouseMotion.getHashCode(); ev.motion.x = wl_fixed_to_int(sx_w); ev.motion.y = wl_fixed_to_int(sy_w); XdevLWindowWayland* window = (XdevLWindowWayland*)wl_surface_get_user_data(wes->getCurrentWindow()); ev.window.windowid = window->getWindowID(); wes->getMediator()->fireEvent(ev); wes->setCurrentPointerPosition(ev.motion.x, ev.motion.y); }
static void handle_configure(void *data, struct wl_shell *shell, uint32_t time, uint32_t edges, struct wl_surface *surface, int32_t width, int32_t height) { struct window *window = wl_surface_get_user_data(surface); window->resize_edges = edges; window->allocation.width = width; window->allocation.height = height; if (window->resize_handler) (*window->resize_handler)(window, window->user_data); if (window->redraw_handler) window_schedule_redraw(window); }
static void pointerHandleEnter(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t sx_w, wl_fixed_t sy_w) { XdevLWindowEventServerWayland* wes = (XdevLWindowEventServerWayland*)data; wes->setCurrentWindow(surface); XdevLWindowWayland* window = (XdevLWindowWayland*)wl_surface_get_user_data(surface); XdevLEvent ev; ev.common.timestamp = wes->getMediator()->getTimer().getTime64(); ev.type = XDEVL_WINDOW_EVENT; ev.window.event = XDEVL_WINDOW_ENTER; ev.window.data1 = sx_w; ev.window.data2 = sy_w; ev.window.windowid = window->getWindowID(); wes->getMediator()->fireEvent(ev); }
static void _eventd_nd_wl_pointer_enter(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y) { EventdNdWlSeat *self = data; EventdNdBackendContext *context = self->context; self->surface = wl_surface_get_user_data(surface); if ( context->cursor.surface == NULL ) return; if ( context->cursor.cursor->image_count < 2 ) _eventd_nd_cursor_set_image(context, 0); else _eventd_nd_cursor_frame_callback(context, context->cursor.frame_cb, 0); wl_pointer_set_cursor(self->pointer, serial, context->cursor.surface, context->cursor.image->hotspot_x, context->cursor.image->hotspot_y); }
static void clutter_wayland_handle_keyboard_enter (void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface, struct wl_array *keys) { ClutterInputDeviceWayland *device = data; ClutterStageCogl *stage_cogl; stage_cogl = wl_surface_get_user_data (surface); g_assert (device->keyboard_focus == NULL); device->keyboard_focus = stage_cogl; _clutter_stage_update_state (stage_cogl->wrapper, 0, CLUTTER_STAGE_STATE_ACTIVATED); }
static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface, struct wl_array *keys) { struct SDL_WaylandInput *input = data; SDL_WindowData *window; if (!surface) { /* enter event for a window we've just destroyed */ return; } window = wl_surface_get_user_data(surface); if (window) { input->keyboard_focus = window; window->keyboard_device = input; SDL_SetKeyboardFocus(window->sdlwindow); } }