static void ss_seat_handle_modifiers(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial_in, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) { struct ss_seat *seat = data; struct weston_compositor *c = seat->base.compositor; struct weston_keyboard *keyboard; uint32_t serial_out; /* If we get a key event followed by a modifier event with the * same serial number, then we try to preserve those semantics by * reusing the same serial number on the way out too. */ if (serial_in == seat->key_serial) serial_out = wl_display_get_serial(c->wl_display); else serial_out = wl_display_next_serial(c->wl_display); keyboard = weston_seat_get_keyboard(&seat->base); xkb_state_update_mask(keyboard->xkb_state.state, mods_depressed, mods_latched, mods_locked, 0, 0, group); notify_modifiers(&seat->base, serial_out); }
static void handle_button_event (ClaylandSeat *seat, const ClutterButtonEvent *event) { ClaylandPointer *pointer = &seat->pointer; gboolean state = event->type == CLUTTER_BUTTON_PRESS; uint32_t button; notify_motion (seat, (const ClutterEvent *) event); switch (event->button) { /* The evdev input right and middle button numbers are swapped relative to how Clutter numbers them */ case 2: button = BTN_MIDDLE; break; case 3: button = BTN_RIGHT; break; default: button = event->button + BTN_LEFT - 1; break; } if (state) { if (pointer->button_count == 0) { pointer->grab_button = button; pointer->grab_time = event->time; pointer->grab_x = pointer->x; pointer->grab_y = pointer->y; } pointer->button_count++; } else pointer->button_count--; pointer->grab->interface->button (pointer->grab, event->time, button, state); if (pointer->button_count == 1) pointer->grab_serial = wl_display_get_serial (seat->display); }
void ShellSeat::popup_grab_button(struct weston_pointer_grab *grab, uint32_t time, uint32_t button, uint32_t state_w) { ShellSeat *shseat = static_cast<PopupGrab *>(container_of(grab, PopupGrab, grab))->seat; struct wl_resource *resource = grab->pointer->focus_resource; if (resource) { struct wl_display *display = wl_client_get_display(resource->client); uint32_t serial = wl_display_get_serial(display); wl_pointer_send_button(resource, serial, time, button, state_w); } else if (state_w == WL_POINTER_BUTTON_STATE_RELEASED && (shseat->m_popupGrab.initial_up || time - shseat->m_seat->pointer->grab_time > 500)) { shseat->endPopupGrab(); } if (state_w == WL_POINTER_BUTTON_STATE_RELEASED) shseat->m_popupGrab.initial_up = 1; }
static void input_handle_modifiers(void *data, struct wl_keyboard *keyboard, uint32_t serial_in, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) { struct wayland_input *input = data; struct wayland_compositor *c = input->compositor; uint32_t serial_out; /* If we get a key event followed by a modifier event with the * same serial number, then we try to preserve those semantics by * reusing the same serial number on the way out too. */ if (serial_in == input->key_serial) serial_out = wl_display_get_serial(c->base.wl_display); else serial_out = wl_display_next_serial(c->base.wl_display); xkb_state_update_mask(input->base.xkb_state.state, mods_depressed, mods_latched, mods_locked, 0, 0, group); notify_modifiers(&input->base, serial_out); }