struct surface {
void (*configure)(void *data,
struct desktop_shell *desktop_shell,
- uint32_t time, uint32_t edges,
- struct window *window,
+ uint32_t edges, struct window *window,
int32_t width, int32_t height);
};
static int
panel_launcher_enter_handler(struct widget *widget, struct input *input,
- uint32_t time, int32_t x, int32_t y, void *data)
+ int32_t x, int32_t y, void *data)
{
struct panel_launcher *launcher = data;
static void
panel_configure(void *data,
struct desktop_shell *desktop_shell,
- uint32_t time, uint32_t edges,
- struct window *window,
+ uint32_t edges, struct window *window,
int32_t width, int32_t height)
{
struct surface *surface = window_get_user_data(window);
static void
background_configure(void *data,
struct desktop_shell *desktop_shell,
- uint32_t time, uint32_t edges,
- struct window *window,
+ uint32_t edges, struct window *window,
int32_t width, int32_t height)
{
struct background *background =
static int
unlock_dialog_widget_enter_handler(struct widget *widget,
- struct input *input, uint32_t time,
+ struct input *input,
int32_t x, int32_t y, void *data)
{
struct unlock_dialog *dialog = data;
static void
desktop_shell_configure(void *data,
struct desktop_shell *desktop_shell,
- uint32_t time, uint32_t edges,
+ uint32_t edges,
struct wl_shell_surface *shell_surface,
int32_t width, int32_t height)
{
struct window *window = wl_shell_surface_get_user_data(shell_surface);
struct surface *s = window_get_user_data(window);
- s->configure(data, desktop_shell, time, edges, window, width, height);
+ s->configure(data, desktop_shell, edges, window, width, height);
}
static void
struct wl_compositor *compositor;
struct wl_buffer *buffer;
unsigned int i;
+ uint32_t serial;
widget_get_allocation(dnd->widget, &allocation);
input_get_position(input, &x, &y);
display = window_get_display(dnd->window);
compositor = display_get_compositor(display);
+ serial = display_get_serial(display);
dnd_drag->drag_surface =
wl_compositor_create_surface(compositor);
dnd_drag->data_source,
window_get_wl_surface(dnd->window),
dnd_drag->drag_surface,
- time);
+ serial);
input_set_pointer_image(input, time, POINTER_DRAGGING);
static int
dnd_enter_handler(struct widget *widget,
- struct input *input, uint32_t time,
- int32_t x, int32_t y, void *data)
+ struct input *input, int32_t x, int32_t y, void *data)
{
return lookup_cursor(data, x, y);
}
static void
dnd_data_handler(struct window *window,
- struct input *input, uint32_t time,
+ struct input *input,
int32_t x, int32_t y, const char **types, void *data)
{
struct dnd *dnd = data;
if (!dnd_get_item(dnd, x, y)) {
- input_accept(input, time, types[0]);
+ input_accept(input, types[0]);
} else {
- input_accept(input, time, NULL);
+ input_accept(input, NULL);
}
}
switch (button) {
case BTN_LEFT:
if (state)
- window_move(flower->window, input, time);
+ window_move(flower->window, input,
+ display_get_serial(flower->display));
break;
case BTN_MIDDLE:
if (state)
static void
input_device_handle_button(void *data,
struct wl_input_device *input_device,
- uint32_t time, uint32_t button, uint32_t state)
+ uint32_t serial, uint32_t time,
+ uint32_t button, uint32_t state)
{
}
static void
input_device_handle_key(void *data, struct wl_input_device *input_device,
- uint32_t time, uint32_t key, uint32_t state)
+ uint32_t serial, uint32_t time,
+ uint32_t key, uint32_t state)
{
}
static void
input_device_handle_pointer_enter(void *data,
struct wl_input_device *input_device,
- uint32_t time, struct wl_surface *surface,
+ uint32_t serial, struct wl_surface *surface,
int32_t sx, int32_t sy)
{
}
static void
input_device_handle_pointer_leave(void *data,
struct wl_input_device *input_device,
- uint32_t time, struct wl_surface *surface)
+ uint32_t serial, struct wl_surface *surface)
{
}
static void
input_device_handle_keyboard_enter(void *data,
struct wl_input_device *input_device,
- uint32_t time,
+ uint32_t serial,
struct wl_surface *surface,
struct wl_array *keys)
{
static void
input_device_handle_keyboard_leave(void *data,
struct wl_input_device *input_device,
- uint32_t time,
+ uint32_t serial,
struct wl_surface *surface)
{
}
static void
input_device_handle_touch_down(void *data,
struct wl_input_device *wl_input_device,
- uint32_t time, struct wl_surface *surface,
+ uint32_t serial, uint32_t time,
+ struct wl_surface *surface,
int32_t id, int32_t x, int32_t y)
{
struct touch *touch = data;
static void
input_device_handle_touch_up(void *data,
struct wl_input_device *wl_input_device,
- uint32_t time, int32_t id)
+ uint32_t serial, uint32_t time, int32_t id)
{
}
EGLConfig argb_config;
EGLContext argb_ctx;
cairo_device_t *argb_device;
+ uint32_t serial;
int display_fd;
uint32_t mask;
struct window *keyboard_focus;
int current_pointer_image;
uint32_t modifiers;
+ uint32_t pointer_enter_serial;
int32_t sx, sy;
struct wl_list link;
static int
frame_enter_handler(struct widget *widget,
- struct input *input, uint32_t time,
- int32_t x, int32_t y, void *data)
+ struct input *input, int32_t x, int32_t y, void *data)
{
return frame_get_pointer_image_for_location(data, input);
}
if (!window->shell_surface)
break;
input_set_pointer_image(input, time, POINTER_DRAGGING);
- input_ungrab(input, time);
+ input_ungrab(input);
wl_shell_surface_move(window->shell_surface,
input_get_input_device(input),
- time);
+ display->serial);
break;
case WINDOW_RESIZING_TOP:
case WINDOW_RESIZING_BOTTOM:
case WINDOW_RESIZING_BOTTOM_RIGHT:
if (!window->shell_surface)
break;
- input_ungrab(input, time);
+ input_ungrab(input);
if (!display->dpy) {
/* If we're using shm, allocate a big
wl_shell_surface_resize(window->shell_surface,
input_get_input_device(input),
- time, location);
+ display->serial, location);
break;
}
} else if (button == BTN_RIGHT && state == 1) {
static void
input_set_focus_widget(struct input *input, struct widget *focus,
- uint32_t time, int32_t x, int32_t y)
+ int32_t x, int32_t y)
{
struct widget *old, *widget;
int pointer = POINTER_LEFT_PTR;
if (input->grab)
widget = input->grab;
if (widget->enter_handler)
- pointer = widget->enter_handler(focus, input, time,
- x, y,
+ pointer = widget->enter_handler(focus, input, x, y,
widget->user_data);
input->focus_widget = focus;
- input_set_pointer_image(input, time, pointer);
+ input_set_pointer_image(input, input->pointer_enter_serial,
+ pointer);
}
}
if (!(input->grab && input->grab_button)) {
widget = widget_find_widget(window->widget, sx, sy);
- input_set_focus_widget(input, widget, time, sx, sy);
+ input_set_focus_widget(input, widget, sx, sy);
}
if (input->grab)
}
void
-input_ungrab(struct input *input, uint32_t time)
+input_ungrab(struct input *input)
{
struct widget *widget;
if (input->pointer_focus) {
widget = widget_find_widget(input->pointer_focus->widget,
input->sx, input->sy);
- input_set_focus_widget(input, widget,
- time, input->sx, input->sy);
+ input_set_focus_widget(input, widget, input->sx, input->sy);
}
}
static void
input_handle_button(void *data,
- struct wl_input_device *input_device,
+ struct wl_input_device *input_device, uint32_t serial,
uint32_t time, uint32_t button, uint32_t state)
{
struct input *input = data;
struct widget *widget;
+ input->display->serial = serial;
if (input->focus_widget && input->grab == NULL && state)
input_grab(input, input->focus_widget, button);
input->grab->user_data);
if (input->grab && input->grab_button == button && !state)
- input_ungrab(input, time);
+ input_ungrab(input);
}
static void
static void
input_handle_key(void *data, struct wl_input_device *input_device,
- uint32_t time, uint32_t key, uint32_t state)
+ uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
{
struct input *input = data;
struct window *window = input->keyboard_focus;
struct display *d = input->display;
uint32_t code, sym, level;
+ input->display->serial = serial;
code = key + 8;
if (!window || window->keyboard_device != input)
return;
}
static void
-input_remove_pointer_focus(struct input *input, uint32_t time)
+input_remove_pointer_focus(struct input *input)
{
struct window *window = input->pointer_focus;
if (!window)
return;
- input_set_focus_widget(input, NULL, 0, 0, 0);
+ input_set_focus_widget(input, NULL, 0, 0);
input->pointer_focus = NULL;
input->current_pointer_image = POINTER_UNSET;
static void
input_handle_pointer_enter(void *data,
struct wl_input_device *input_device,
- uint32_t time, struct wl_surface *surface,
+ uint32_t serial, struct wl_surface *surface,
int32_t sx, int32_t sy)
{
struct input *input = data;
struct window *window;
struct widget *widget;
+ input->display->serial = serial;
+ input->pointer_enter_serial = serial;
input->pointer_focus = wl_surface_get_user_data(surface);
window = input->pointer_focus;
input->sy = sy;
widget = widget_find_widget(window->widget, sx, sy);
- input_set_focus_widget(input, widget, time, sx, sy);
+ input_set_focus_widget(input, widget, sx, sy);
}
static void
input_handle_pointer_leave(void *data,
struct wl_input_device *input_device,
- uint32_t time, struct wl_surface *surface)
+ uint32_t serial, struct wl_surface *surface)
{
struct input *input = data;
- input_remove_pointer_focus(input, time);
+ input->display->serial = serial;
+ input_remove_pointer_focus(input);
}
static void
static void
input_handle_keyboard_enter(void *data,
struct wl_input_device *input_device,
- uint32_t time,
+ uint32_t serial,
struct wl_surface *surface,
struct wl_array *keys)
{
struct display *d = input->display;
uint32_t *k, *end;
+ input->display->serial = serial;
input->keyboard_focus = wl_surface_get_user_data(surface);
end = keys->data + keys->size;
static void
input_handle_keyboard_leave(void *data,
struct wl_input_device *input_device,
- uint32_t time,
+ uint32_t serial,
struct wl_surface *surface)
{
struct input *input = data;
+ input->display->serial = serial;
input_remove_keyboard_focus(input);
}
static void
input_handle_touch_down(void *data,
struct wl_input_device *wl_input_device,
- uint32_t time, struct wl_surface *surface,
+ uint32_t serial, uint32_t time,
+ struct wl_surface *surface,
int32_t id, int32_t x, int32_t y)
{
}
static void
input_handle_touch_up(void *data,
struct wl_input_device *wl_input_device,
- uint32_t time, int32_t id)
+ uint32_t serial, uint32_t time, int32_t id)
{
}
static void
data_device_enter(void *data, struct wl_data_device *data_device,
- uint32_t time, struct wl_surface *surface,
+ uint32_t serial, struct wl_surface *surface,
int32_t x, int32_t y, struct wl_data_offer *offer)
{
struct input *input = data;
struct window *window;
char **p;
+ input->pointer_enter_serial = serial;
input->drag_offer = wl_data_offer_get_user_data(offer);
window = wl_surface_get_user_data(surface);
input->pointer_focus = window;
window = input->pointer_focus;
if (window->data_handler)
- window->data_handler(window, input, time, x, y,
+ window->data_handler(window, input, x, y,
input->drag_offer->types.data,
window->user_data);
}
input->sy = y;
if (window->data_handler)
- window->data_handler(window, input, time, x, y,
+ window->data_handler(window, input, x, y,
input->drag_offer->types.data,
window->user_data);
}
}
void
-input_accept(struct input *input, uint32_t time, const char *type)
+input_accept(struct input *input, const char *type)
{
- wl_data_offer_accept(input->drag_offer->offer, time, type);
+ wl_data_offer_accept(input->drag_offer->offer,
+ input->pointer_enter_serial, type);
}
static void
}
void
-window_move(struct window *window, struct input *input, uint32_t time)
+window_move(struct window *window, struct input *input, uint32_t serial)
{
if (!window->shell_surface)
return;
wl_shell_surface_move(window->shell_surface,
- input->input_device, time);
+ input->input_device, serial);
}
static void
static void
handle_configure(void *data, struct wl_shell_surface *shell_surface,
- uint32_t time, uint32_t edges,
- int32_t width, int32_t height)
+ uint32_t edges, int32_t width, int32_t height)
{
struct window *window = data;
* time. */
menu->func(window->parent, menu->current, window->parent->user_data);
- input_ungrab(menu->input, 0);
+ input_ungrab(menu->input);
menu_destroy(menu);
}
static int
menu_enter_handler(struct widget *widget,
- struct input *input, uint32_t time,
- int32_t x, int32_t y, void *data)
+ struct input *input, int32_t x, int32_t y, void *data)
{
struct menu *menu = data;
* click-motion-click. */
menu->func(menu->window->parent,
menu->current, menu->window->parent->user_data);
- input_ungrab(input, time);
+ input_ungrab(input);
menu_destroy(menu);
}
}
input_destroy(struct input *input)
{
input_remove_keyboard_focus(input);
- input_remove_pointer_focus(input, 0);
+ input_remove_pointer_focus(input);
if (input->drag_offer)
data_offer_destroy(input->drag_offer);
return display->compositor;
}
+uint32_t
+display_get_serial(struct display *display)
+{
+ return display->serial;
+}
+
EGLDisplay
display_get_egl_display(struct display *d)
{
struct output *
display_get_output(struct display *display);
+uint32_t
+display_get_serial(struct display *display);
+
typedef void (*display_output_handler_t)(struct output *output, void *data);
/*
struct input *device, void *data);
typedef void (*window_data_handler_t)(struct window *window,
- struct input *input, uint32_t time,
+ struct input *input,
int32_t x, int32_t y,
const char **types,
void *data);
typedef void (*widget_redraw_handler_t)(struct widget *widget, void *data);
typedef int (*widget_enter_handler_t)(struct widget *widget,
- struct input *input, uint32_t time,
+ struct input *input,
int32_t x, int32_t y, void *data);
typedef void (*widget_leave_handler_t)(struct widget *widget,
struct input *input, void *data);
input_grab(struct input *input, struct widget *widget, uint32_t button);
void
-input_ungrab(struct input *input, uint32_t time);
+input_ungrab(struct input *input);
struct widget *
input_get_focus_widget(struct input *input);
struct wl_data_source *source, uint32_t time);
void
-input_accept(struct input *input, uint32_t time, const char *type);
+input_accept(struct input *input, const char *type);
void
<!-- We'll fold most of wl_shell into this interface and then
they'll share the configure event. -->
<event name="configure">
- <arg name="time" type="uint"/>
<arg name="edges" type="uint"/>
<arg name="surface" type="object" interface="wl_shell_surface"/>
<arg name="width" type="int"/>
static void
output_handle_scanout_buffer_destroy(struct wl_listener *listener,
- struct wl_resource *resource,
- uint32_t time)
+ struct wl_resource *resource)
{
struct drm_output *output =
container_of(listener, struct drm_output,
static void
output_handle_pending_scanout_buffer_destroy(struct wl_listener *listener,
- struct wl_resource *resource,
- uint32_t time)
+ struct wl_resource *resource)
{
struct drm_output *output =
container_of(listener, struct drm_output,
static void
sprite_handle_buffer_destroy(struct wl_listener *listener,
- struct wl_resource *resource,
- uint32_t time)
+ struct wl_resource *resource)
{
struct drm_sprite *sprite =
container_of(listener, struct drm_sprite,
static void
sprite_handle_pending_buffer_destroy(struct wl_listener *listener,
- struct wl_resource *resource,
- uint32_t time)
+ struct wl_resource *resource)
{
struct drm_sprite *sprite =
container_of(listener, struct drm_sprite,
static void
input_handle_button(void *data,
- struct wl_input_device *input_device,
- uint32_t time, uint32_t button, uint32_t state)
+ struct wl_input_device *input_device,
+ uint32_t serial, uint32_t time, uint32_t button, uint32_t state)
{
struct wayland_input *input = data;
struct wayland_compositor *c = input->compositor;
static void
input_handle_axis(void *data, struct wl_input_device *input_device,
- uint32_t time, uint32_t axis, int32_t value)
+ uint32_t time, uint32_t axis, int32_t value)
{
struct wayland_input *input = data;
struct wayland_compositor *c = input->compositor;
static void
input_handle_key(void *data, struct wl_input_device *input_device,
- uint32_t time, uint32_t key, uint32_t state)
+ uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
{
struct wayland_input *input = data;
struct wayland_compositor *c = input->compositor;
struct wayland_compositor *c = input->compositor;
output = wl_surface_get_user_data(surface);
- notify_pointer_focus(c->base.input_device,
- time, &output->base, sx, sy);
+ notify_pointer_focus(c->base.input_device, &output->base, sx, sy);
wl_input_device_attach(input->input_device, time, NULL, 0, 0);
}
struct wayland_input *input = data;
struct wayland_compositor *c = input->compositor;
- notify_pointer_focus(c->base.input_device, time, NULL, 0, 0);
+ notify_pointer_focus(c->base.input_device, NULL, 0, 0);
}
static void
struct wayland_input *input = data;
struct wayland_compositor *c = input->compositor;
- notify_keyboard_focus(c->base.input_device, time, keys);
+ notify_keyboard_focus(c->base.input_device, keys);
}
static void
struct wayland_input *input = data;
struct wayland_compositor *c = input->compositor;
- notify_keyboard_focus(c->base.input_device, time, NULL);
+ notify_keyboard_focus(c->base.input_device, NULL);
}
static const struct wl_input_device_listener input_device_listener = {
}
output = x11_compositor_find_output(c, focus_in->event);
- notify_keyboard_focus(c->base.input_device,
- weston_compositor_get_time(),
- &c->keys);
+ notify_keyboard_focus(c->base.input_device, &c->keys);
free(prev);
prev = NULL;
break;
output = x11_compositor_find_output(c, enter_notify->event);
notify_pointer_focus(c->base.input_device,
- weston_compositor_get_time(),
&output->base,
output->base.x + enter_notify->event_x,
output->base.y + enter_notify->event_y);
if (enter_notify->state >= Button1Mask)
break;
output = x11_compositor_find_output(c, enter_notify->event);
- notify_pointer_focus(c->base.input_device,
- weston_compositor_get_time(),
- NULL,
+ notify_pointer_focus(c->base.input_device, NULL,
output->base.x + enter_notify->event_x,
output->base.y + enter_notify->event_y);
break;
if (focus_in->mode == XCB_NOTIFY_MODE_WHILE_GRABBED ||
focus_in->mode == XCB_NOTIFY_MODE_UNGRAB)
break;
- notify_keyboard_focus(c->base.input_device,
- weston_compositor_get_time(),
- NULL);
+ notify_keyboard_focus(c->base.input_device, NULL);
break;
default:
static void
surface_handle_buffer_destroy(struct wl_listener *listener,
- struct wl_resource *resource, uint32_t time)
+ struct wl_resource *resource)
{
struct weston_surface *es =
container_of(listener, struct weston_surface,
WL_EXPORT uint32_t
weston_compositor_get_time(void)
{
- struct timeval tv;
+ struct timeval tv;
- gettimeofday(&tv, NULL);
+ gettimeofday(&tv, NULL);
- return tv.tv_sec * 1000 + tv.tv_usec / 1000;
+ return tv.tv_sec * 1000 + tv.tv_usec / 1000;
}
static struct weston_surface *
}
static void
-weston_device_repick(struct wl_input_device *device, uint32_t time)
+weston_device_repick(struct wl_input_device *device)
{
struct weston_input_device *wd = (struct weston_input_device *) device;
const struct wl_pointer_grab_interface *interface;
if (&surface->surface != device->current) {
interface = device->pointer_grab->interface;
- interface->focus(device->pointer_grab, time, &surface->surface,
+ interface->focus(device->pointer_grab, &surface->surface,
device->current_x, device->current_y);
device->current = &surface->surface;
}
weston_compositor_repick(struct weston_compositor *compositor)
{
struct weston_input_device *device;
- uint32_t time;
if (!compositor->focus)
return;
- time = weston_compositor_get_time();
wl_list_for_each(device, &compositor->input_device_list, link)
- weston_device_repick(&device->input_device, time);
+ weston_device_repick(&device->input_device);
}
static void
wl_list_remove(&surface->layer_link);
if (device->keyboard_focus == &surface->surface)
- wl_input_device_set_keyboard_focus(device, NULL,
- weston_compositor_get_time());
+ wl_input_device_set_keyboard_focus(device, NULL);
if (device->pointer_focus == &surface->surface)
- wl_input_device_set_pointer_focus(device, NULL, 0, 0,
- weston_compositor_get_time());
+ wl_input_device_set_pointer_focus(device, NULL, 0, 0);
weston_compositor_schedule_repaint(surface->compositor);
}
wl_list_for_each_safe(cb, cnext, &output->frame_callback_list, link) {
wl_callback_send_done(&cb->resource, msecs);
- wl_resource_destroy(&cb->resource, 0);
+ wl_resource_destroy(&cb->resource);
}
wl_list_for_each_safe(animation, next, &ec->animation_list, link)
static void
surface_destroy(struct wl_client *client, struct wl_resource *resource)
{
- wl_resource_destroy(resource, weston_compositor_get_time());
+ wl_resource_destroy(resource);
}
WL_EXPORT void
static void
region_destroy(struct wl_client *client, struct wl_resource *resource)
{
- wl_resource_destroy(resource, weston_compositor_get_time());
+ wl_resource_destroy(resource);
}
static void
pixman_region32_contains_point(&output->region, x, y, NULL))
weston_output_update_zoom(output, x, y);
- weston_device_repick(device, time);
+ weston_device_repick(device);
interface = device->pointer_grab->interface;
interface->motion(device->pointer_grab, time,
device->pointer_grab->x, device->pointer_grab->y);
WL_EXPORT void
weston_surface_activate(struct weston_surface *surface,
- struct weston_input_device *device, uint32_t time)
+ struct weston_input_device *device)
{
wl_input_device_set_keyboard_focus(&device->input_device,
- &surface->surface, time);
+ &surface->surface);
wl_data_device_set_keyboard_focus(&device->input_device);
}
device->pointer_grab->interface->button(device->pointer_grab, time, button, state);
+ if (device->button_count == 1)
+ device->grab_serial =
+ wl_display_get_serial(compositor->wl_display);
}
WL_EXPORT void
WL_EXPORT void
notify_pointer_focus(struct wl_input_device *device,
- uint32_t time, struct weston_output *output,
- int32_t x, int32_t y)
+ struct weston_output *output, int32_t x, int32_t y)
{
struct weston_input_device *wd = (struct weston_input_device *) device;
struct weston_compositor *compositor = wd->compositor;
static void
destroy_device_saved_kbd_focus(struct wl_listener *listener,
- struct wl_resource *resource, uint32_t time)
+ struct wl_resource *resource)
{
struct weston_input_device *wd;
}
WL_EXPORT void
-notify_keyboard_focus(struct wl_input_device *device,
- uint32_t time, struct wl_array *keys)
+notify_keyboard_focus(struct wl_input_device *device, struct wl_array *keys)
{
struct weston_input_device *wd =
(struct weston_input_device *) device;
if (surface) {
wl_list_remove(&wd->saved_kbd_focus_listener.link);
wl_input_device_set_keyboard_focus(&wd->input_device,
- surface, time);
+ surface);
wd->saved_kbd_focus = NULL;
}
} else {
&wd->saved_kbd_focus_listener.link);
}
- wl_input_device_set_keyboard_focus(&wd->input_device,
- NULL, time);
+ wl_input_device_set_keyboard_focus(&wd->input_device, NULL);
/* FIXME: We really need keyboard grab cancel here to
* let the grab shut down properly. As it is we leak
* the grab data. */
- wl_input_device_end_keyboard_grab(&wd->input_device, time);
+ wl_input_device_end_keyboard_grab(&wd->input_device);
}
}
static void
lose_touch_focus_resource(struct wl_listener *listener,
- struct wl_resource *resource, uint32_t time)
+ struct wl_resource *resource)
{
struct weston_input_device *device =
container_of(listener, struct weston_input_device,
static void
lose_touch_focus(struct wl_listener *listener,
- struct wl_resource *resource, uint32_t time)
+ struct wl_resource *resource)
{
struct weston_input_device *device =
container_of(listener, struct weston_input_device,
static void
touch_set_focus(struct weston_input_device *device,
- struct wl_surface *surface, uint32_t time)
+ struct wl_surface *surface)
{
struct wl_input_device *input_device = &device->input_device;
struct wl_resource *resource;
struct weston_compositor *ec = wd->compositor;
struct weston_surface *es;
int32_t sx, sy;
+ uint32_t serial = 0;
switch (touch_type) {
case WL_INPUT_DEVICE_TOUCH_DOWN:
* until all touch points are up again. */
if (wd->num_tp == 1) {
es = weston_compositor_pick_surface(ec, x, y, &sx, &sy);
- touch_set_focus(wd, &es->surface, time);
+ touch_set_focus(wd, &es->surface);
} else if (wd->touch_focus) {
es = (struct weston_surface *) wd->touch_focus;
weston_surface_from_global(es, x, y, &sx, &sy);
if (wd->touch_focus_resource && wd->touch_focus)
wl_input_device_send_touch_down(wd->touch_focus_resource,
- time, &wd->touch_focus->resource,
+ serial, time, &wd->touch_focus->resource,
touch_id, sx, sy);
break;
case WL_INPUT_DEVICE_TOUCH_MOTION:
if (wd->touch_focus_resource)
wl_input_device_send_touch_up(wd->touch_focus_resource,
- time, touch_id);
+ serial, time, touch_id);
if (wd->num_tp == 0)
- touch_set_focus(wd, NULL, time);
+ touch_set_focus(wd, NULL);
break;
}
}
static void
input_device_attach(struct wl_client *client,
struct wl_resource *resource,
- uint32_t time,
+ uint32_t serial,
struct wl_resource *buffer_resource, int32_t x, int32_t y)
{
struct weston_input_device *device = resource->data;
struct weston_compositor *compositor = device->compositor;
struct wl_buffer *buffer = NULL;
- if (time < device->input_device.pointer_focus_time)
+ if (serial < device->input_device.pointer_focus_serial)
return;
if (device->input_device.pointer_focus == NULL)
return;
static void
handle_drag_surface_destroy(struct wl_listener *listener,
- struct wl_resource *resource, uint32_t time)
+ struct wl_resource *resource)
{
struct weston_input_device *device;
static void
device_handle_new_drag_icon(struct wl_listener *listener,
- struct wl_resource *resource, uint32_t time)
+ struct wl_resource *resource)
{
struct weston_input_device *device;
void
weston_surface_activate(struct weston_surface *surface,
- struct weston_input_device *device, uint32_t time);
+ struct weston_input_device *device);
void
weston_surface_draw(struct weston_surface *es,
struct weston_output *output, pixman_region32_t *damage);
void
notify_pointer_focus(struct wl_input_device *device,
- uint32_t time,
struct weston_output *output,
int32_t x, int32_t y);
void
-notify_keyboard_focus(struct wl_input_device *device,
- uint32_t time, struct wl_array *keys);
+notify_keyboard_focus(struct wl_input_device *device, struct wl_array *keys);
void
notify_touch(struct wl_input_device *device, uint32_t time, int touch_id,
}
}
- notify_keyboard_focus(&input->base.input_device,
- weston_compositor_get_time(), &keys);
+ notify_keyboard_focus(&input->base.input_device, &keys);
wl_array_release(&keys);
}
wl_list_for_each_safe(device, next, &input->devices_list, link)
device_removed(device);
- notify_keyboard_focus(&input->base.input_device,
- weston_compositor_get_time(), NULL);
+ notify_keyboard_focus(&input->base.input_device, NULL);
}
void
if (client != shooter->client) {
wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
"screenshooter failed: permission denied");
- wl_resource_destroy(resource, 0);
+ wl_resource_destroy(resource);
}
}
static void
destroy_shell_grab_shsurf(struct wl_listener *listener,
- struct wl_resource *resource, uint32_t time)
+ struct wl_resource *resource)
{
struct shell_grab *grab;
}
static void
-noop_grab_focus(struct wl_pointer_grab *grab, uint32_t time,
+noop_grab_focus(struct wl_pointer_grab *grab,
struct wl_surface *surface, int32_t x, int32_t y)
{
grab->focus = NULL;
if (device->button_count == 0 && state == 0) {
shell_grab_finish(shell_grab);
- wl_input_device_end_pointer_grab(device, time);
+ wl_input_device_end_pointer_grab(device);
free(grab);
}
}
static int
weston_surface_move(struct weston_surface *es,
- struct weston_input_device *wd, uint32_t time)
+ struct weston_input_device *wd)
{
struct weston_move_grab *move;
struct shell_surface *shsurf = get_shell_surface(es);
move->dy = es->geometry.y - wd->input_device.grab_y;
wl_input_device_start_pointer_grab(&wd->input_device,
- &move->base.grab, time);
+ &move->base.grab);
- wl_input_device_set_pointer_focus(&wd->input_device, NULL, time, 0, 0);
+ wl_input_device_set_pointer_focus(&wd->input_device, NULL, 0, 0);
return 0;
}
static void
shell_surface_move(struct wl_client *client, struct wl_resource *resource,
- struct wl_resource *input_resource, uint32_t time)
+ struct wl_resource *input_resource, uint32_t serial)
{
struct weston_input_device *wd = input_resource->data;
struct shell_surface *shsurf = resource->data;
if (wd->input_device.button_count == 0 ||
- wd->input_device.grab_time != time ||
+ wd->input_device.grab_serial != serial ||
wd->input_device.pointer_focus != &shsurf->surface->surface)
return;
- if (weston_surface_move(shsurf->surface, wd, time) < 0)
+ if (weston_surface_move(shsurf->surface, wd) < 0)
wl_resource_post_no_memory(resource);
}
}
wl_shell_surface_send_configure(&resize->base.shsurf->resource,
- time, resize->edges, width, height);
+ resize->edges, width, height);
}
static void
if (device->button_count == 0 && state == 0) {
shell_grab_finish(&resize->base);
- wl_input_device_end_pointer_grab(device, time);
+ wl_input_device_end_pointer_grab(device);
free(grab);
}
}
static int
weston_surface_resize(struct shell_surface *shsurf,
- struct weston_input_device *wd,
- uint32_t time, uint32_t edges)
+ struct weston_input_device *wd, uint32_t edges)
{
struct weston_resize_grab *resize;
resize->height = shsurf->surface->geometry.height;
wl_input_device_start_pointer_grab(&wd->input_device,
- &resize->base.grab, time);
+ &resize->base.grab);
- wl_input_device_set_pointer_focus(&wd->input_device, NULL, time, 0, 0);
+ wl_input_device_set_pointer_focus(&wd->input_device, NULL, 0, 0);
return 0;
}
static void
shell_surface_resize(struct wl_client *client, struct wl_resource *resource,
- struct wl_resource *input_resource, uint32_t time,
+ struct wl_resource *input_resource, uint32_t serial,
uint32_t edges)
{
struct weston_input_device *wd = input_resource->data;
return;
if (wd->input_device.button_count == 0 ||
- wd->input_device.grab_time != time ||
+ wd->input_device.grab_serial != serial ||
wd->input_device.pointer_focus != &shsurf->surface->surface)
return;
- if (weston_surface_resize(shsurf, wd, time, edges) < 0)
+ if (weston_surface_resize(shsurf, wd, edges) < 0)
wl_resource_post_no_memory(resource);
}
panel_height = get_output_panel_height(wlshell, es->output);
edges = WL_SHELL_SURFACE_RESIZE_TOP|WL_SHELL_SURFACE_RESIZE_LEFT;
- wl_shell_surface_send_configure(&shsurf->resource,
- weston_compositor_get_time(), edges,
+ wl_shell_surface_send_configure(&shsurf->resource, edges,
es->output->current->width,
es->output->current->height - panel_height);
if (weston_surface_is_mapped(es))
shsurf->force_configure = 1;
- wl_shell_surface_send_configure(&shsurf->resource,
- weston_compositor_get_time(), 0,
+ wl_shell_surface_send_configure(&shsurf->resource, 0,
shsurf->output->current->width,
shsurf->output->current->height);
}
static void
-popup_grab_focus(struct wl_pointer_grab *grab, uint32_t time,
+popup_grab_focus(struct wl_pointer_grab *grab,
struct wl_surface *surface, int32_t x, int32_t y)
{
struct wl_input_device *device = grab->input_device;
struct wl_client *client = priv->surface->surface.resource.client;
if (surface && surface->resource.client == client) {
- wl_input_device_set_pointer_focus(device, surface, time, x, y);
+ wl_input_device_set_pointer_focus(device, surface, x, y);
grab->focus = surface;
} else {
- wl_input_device_set_pointer_focus(device, NULL, time, 0, 0);
+ wl_input_device_set_pointer_focus(device, NULL, 0, 0);
grab->focus = NULL;
}
}
struct wl_resource *resource;
struct shell_surface *shsurf =
container_of(grab, struct shell_surface, popup.grab);
+ struct wl_display *display;
+ uint32_t serial;
resource = grab->input_device->pointer_focus_resource;
if (resource) {
- wl_input_device_send_button(resource, time, button, state);
+ display = wl_client_get_display(resource->client);
+ serial = wl_display_get_serial(display);
+ wl_input_device_send_button(resource, serial,
+ time, button, state);
} else if (state == 0 &&
(shsurf->popup.initial_up ||
time - shsurf->popup.time > 500)) {
wl_shell_surface_send_popup_done(&shsurf->resource);
- wl_input_device_end_pointer_grab(grab->input_device, time);
+ wl_input_device_end_pointer_grab(grab->input_device);
shsurf->popup.grab.input_device = NULL;
}
};
static void
-shell_map_popup(struct shell_surface *shsurf, uint32_t time)
+shell_map_popup(struct shell_surface *shsurf, uint32_t serial)
{
struct wl_input_device *device;
struct weston_surface *es = shsurf->surface;
shsurf->popup.initial_up = 0;
wl_input_device_start_pointer_grab(shsurf->popup.grab.input_device,
- &shsurf->popup.grab, shsurf->popup.time);
+ &shsurf->popup.grab);
}
static void
struct shell_surface *shsurf = resource->data;
if (shsurf->popup.grab.input_device)
- wl_input_device_end_pointer_grab(shsurf->popup.grab.input_device, 0);
+ wl_input_device_end_pointer_grab(shsurf->popup.grab.input_device);
/* in case cleaning up a dead client destroys shell_surface first */
if (shsurf->surface) {
static void
shell_handle_surface_destroy(struct wl_listener *listener,
- struct wl_resource *resource, uint32_t time)
+ struct wl_resource *resource)
{
struct shell_surface *shsurf = container_of(listener,
struct shell_surface,
surface_destroy_listener);
shsurf->surface = NULL;
- wl_resource_destroy(&shsurf->resource, time);
+ wl_resource_destroy(&shsurf->resource);
}
static struct shell_surface *
weston_surface_set_position(surface, shsurf->output->x,
shsurf->output->y);
- desktop_shell_send_configure(resource,
- weston_compositor_get_time(), 0,
+ desktop_shell_send_configure(resource, 0,
surface_resource,
shsurf->output->current->width,
shsurf->output->current->height);
weston_surface_set_position(surface, shsurf->output->x,
shsurf->output->y);
- desktop_shell_send_configure(resource,
- weston_compositor_get_time(), 0,
+ desktop_shell_send_configure(resource, 0,
surface_resource,
shsurf->output->current->width,
shsurf->output->current->height);
static void
handle_lock_surface_destroy(struct wl_listener *listener,
- struct wl_resource *resource, uint32_t time)
+ struct wl_resource *resource)
{
struct wl_shell *shell =
container_of(listener, struct wl_shell, lock_surface_listener);
break;
}
- weston_surface_move(surface, (struct weston_input_device *) device, time);
+ weston_surface_move(surface, (struct weston_input_device *) device);
}
static void
edges |= WL_SHELL_SURFACE_RESIZE_BOTTOM;
weston_surface_resize(shsurf, (struct weston_input_device *) device,
- time, edges);
+ edges);
}
static void
weston_matrix_multiply(&shsurf->rotation.rotation,
&rotate->rotation);
shell_grab_finish(&rotate->base);
- wl_input_device_end_pointer_grab(device, time);
+ wl_input_device_end_pointer_grab(device);
free(rotate);
}
}
surface->surface->geometry.height / 2,
&rotate->center.x, &rotate->center.y);
- wl_input_device_start_pointer_grab(device, &rotate->base.grab, time);
+ wl_input_device_start_pointer_grab(device, &rotate->base.grab);
dx = device->x - rotate->center.x;
dy = device->y - rotate->center.y;
weston_matrix_init(&rotate->rotation);
}
- wl_input_device_set_pointer_focus(device, NULL, time, 0, 0);
+ wl_input_device_set_pointer_focus(device, NULL, 0, 0);
}
static void
activate(struct weston_shell *base, struct weston_surface *es,
- struct weston_input_device *device, uint32_t time)
+ struct weston_input_device *device)
{
struct wl_shell *shell = container_of(base, struct wl_shell, shell);
struct weston_compositor *compositor = shell->compositor;
struct weston_surface *surf, *prev;
- weston_surface_activate(es, device, time);
+ weston_surface_activate(es, device);
if (compositor->wxs)
weston_xserver_surface_activate(es);
focus = upper;
if (state && device->pointer_grab == &device->default_pointer_grab)
- activate(compositor->shell, focus, wd, time);
+ activate(compositor->shell, focus, wd);
}
static void
struct weston_input_device *device;
struct shell_surface *shsurf;
struct weston_output *output;
- uint32_t time;
if (shell->locked) {
wl_list_for_each(output, &shell->compositor->output_list, link)
weston_compositor_schedule_repaint(shell->compositor);
/* reset keyboard foci */
- time = weston_compositor_get_time();
wl_list_for_each(device, &shell->compositor->input_device_list, link) {
wl_input_device_set_keyboard_focus(&device->input_device,
- NULL, time);
+ NULL);
}
/* TODO: disable bindings that should not work while locked. */
if (!shell->locked)
activate(base, surface,
(struct weston_input_device *)
- compositor->input_device,
- weston_compositor_get_time());
+ compositor->input_device);
break;
default:
break;
wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
"permission to bind desktop_shell denied");
- wl_resource_destroy(resource, 0);
+ wl_resource_destroy(resource);
}
static void
wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
"interface object already bound");
- wl_resource_destroy(resource, 0);
+ wl_resource_destroy(resource);
}
struct switcher {
static void
switcher_handle_surface_destroy(struct wl_listener *listener,
- struct wl_resource *resource, uint32_t time)
+ struct wl_resource *resource)
{
struct switcher *switcher =
container_of(listener, struct switcher, listener);
}
if (switcher->current)
- activate(compositor->shell, switcher->current, device, time);
+ activate(compositor->shell, switcher->current, device);
wl_list_remove(&switcher->listener.link);
- wl_input_device_end_keyboard_grab(&device->input_device, time);
+ wl_input_device_end_keyboard_grab(&device->input_device);
free(switcher);
}
wl_list_init(&switcher->listener.link);
switcher->grab.interface = &switcher_grab;
- wl_input_device_start_keyboard_grab(device, &switcher->grab, time);
- wl_input_device_set_keyboard_focus(device, NULL,
- weston_compositor_get_time());
+ wl_input_device_start_keyboard_grab(device, &switcher->grab);
+ wl_input_device_set_keyboard_focus(device, NULL);
switcher_next(switcher);
}
static void
handle_lockscreen_surface_destroy(struct wl_listener *listener,
- struct wl_resource *resource, uint32_t time)
+ struct wl_resource *resource)
{
struct tablet_shell *shell =
container_of(listener,
static void
handle_switcher_surface_destroy(struct wl_listener *listener,
- struct wl_resource *resource, uint32_t time)
+ struct wl_resource *resource)
{
struct tablet_shell *shell =
container_of(listener,
struct weston_input_device *device =
(struct weston_input_device *) compositor->input_device;
- weston_surface_activate(shell->home_surface,
- device, weston_compositor_get_time());
+ weston_surface_activate(shell->home_surface, device);
}
static void
}
} else {
fprintf(stderr, "switch to %p\n", surface);
- weston_surface_activate(surface, device,
- weston_compositor_get_time());
+ weston_surface_activate(surface, device);
tablet_shell_set_state(shell, STATE_TASK);
weston_zoom_run(surface, 0.3, 1.0, NULL, NULL);
}
tablet_client_destroy(struct wl_client *client,
struct wl_resource *resource)
{
- wl_resource_destroy(resource, weston_compositor_get_time());
+ wl_resource_destroy(resource);
}
static void
if (shell->state == STATE_SWITCHER)
tablet_shell_send_hide_switcher(&shell->resource);
- weston_surface_activate(shell->home_surface, device,
- weston_compositor_get_time());
+ weston_surface_activate(shell->home_surface, device);
tablet_shell_set_state(shell, STATE_HOME);
}
static void
handle_zoom_surface_destroy(struct wl_listener *listener,
- struct wl_resource *resource, uint32_t time)
+ struct wl_resource *resource)
{
struct weston_zoom *zoom =
container_of(listener, struct weston_zoom, listener);
struct binding_keyboard_grab *b =
container_of(grab, struct binding_keyboard_grab, grab);
struct wl_resource *resource;
+ struct wl_display *display;
+ uint32_t serial;
resource = grab->input_device->keyboard_focus_resource;
if (key == b->key) {
if (!state) {
- wl_input_device_end_keyboard_grab(grab->input_device,
- time);
+ wl_input_device_end_keyboard_grab(grab->input_device);
free(b);
}
- } else if (resource)
- wl_input_device_send_key(resource, time, key, state);
+ } else if (resource) {
+ display = wl_client_get_display(resource->client);
+ serial = wl_display_next_serial(display);
+ wl_input_device_send_key(resource, serial, time, key, state);
+ }
}
static const struct wl_keyboard_grab_interface binding_grab = {
grab = malloc(sizeof *grab);
grab->key = key;
grab->grab.interface = &binding_grab;
- wl_input_device_start_keyboard_grab(device, &grab->grab, time);
+ wl_input_device_start_keyboard_grab(device, &grab->grab);
}
WL_EXPORT void
static void
data_offer_destroy(struct wl_client *client, struct wl_resource *resource)
{
- wl_resource_destroy(resource, weston_compositor_get_time());
+ wl_resource_destroy(resource);
}
static const struct wl_data_offer_interface data_offer_interface = {
}
device = wm->server->compositor->input_device;
- wl_input_device_set_selection(device, source,
- weston_compositor_get_time());
+ wl_input_device_set_selection(device, source);
free(reply);
}
}
static void
-surface_destroy(struct wl_listener *listener,
- struct wl_resource *resource, uint32_t time)
+surface_destroy(struct wl_listener *listener, struct wl_resource *resource)
{
struct weston_wm_window *window =
container_of(listener,