mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-02 09:01:39 -05:00
Don't hardcode offered dnd types in window.c
This commit is contained in:
parent
88b272d9ff
commit
41da90897c
3 changed files with 18 additions and 14 deletions
|
|
@ -477,6 +477,7 @@ dnd_button_handler(struct window *window,
|
||||||
struct item *item;
|
struct item *item;
|
||||||
struct rectangle rectangle;
|
struct rectangle rectangle;
|
||||||
struct dnd_drag *dnd_drag;
|
struct dnd_drag *dnd_drag;
|
||||||
|
struct wl_drag *drag;
|
||||||
|
|
||||||
window_get_child_rectangle(dnd->window, &rectangle);
|
window_get_child_rectangle(dnd->window, &rectangle);
|
||||||
input_get_position(input, &x, &y);
|
input_get_position(input, &x, &y);
|
||||||
|
|
@ -497,8 +498,11 @@ dnd_button_handler(struct window *window,
|
||||||
dnd_drag->translucent =
|
dnd_drag->translucent =
|
||||||
create_drag_cursor(dnd_drag, item, x, y, 0.2);
|
create_drag_cursor(dnd_drag, item, x, y, 0.2);
|
||||||
|
|
||||||
window_start_drag(window, input, time,
|
drag = window_create_drag(window);
|
||||||
&drag_listener, dnd_drag);
|
wl_drag_offer(drag, "text/plain");
|
||||||
|
wl_drag_offer(drag, "text/html");
|
||||||
|
window_activate_drag(drag, window, input, time);
|
||||||
|
wl_drag_add_listener(drag, &drag_listener, dnd_drag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -988,20 +988,18 @@ input_get_input_device(struct input *input)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wl_drag *
|
struct wl_drag *
|
||||||
window_start_drag(struct window *window, struct input *input, uint32_t time,
|
window_create_drag(struct window *window)
|
||||||
const struct wl_drag_listener *listener, void *data)
|
|
||||||
{
|
{
|
||||||
struct wl_drag *drag;
|
|
||||||
|
|
||||||
cairo_device_flush (window->display->device);
|
cairo_device_flush (window->display->device);
|
||||||
|
|
||||||
drag = wl_shell_create_drag(window->display->shell);
|
return wl_shell_create_drag(window->display->shell);
|
||||||
wl_drag_offer(drag, "text/plain");
|
}
|
||||||
wl_drag_offer(drag, "text/html");
|
|
||||||
wl_drag_activate(drag, window->surface, input->input_device, time);
|
|
||||||
wl_drag_add_listener(drag, listener, data);
|
|
||||||
|
|
||||||
return drag;
|
void
|
||||||
|
window_activate_drag(struct wl_drag *drag, struct window *window,
|
||||||
|
struct input *input, uint32_t time)
|
||||||
|
{
|
||||||
|
wl_drag_activate(drag, window->surface, input->input_device, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -222,9 +222,11 @@ display_set_drag_offer_handler(struct display *display,
|
||||||
display_drag_offer_handler_t handler);
|
display_drag_offer_handler_t handler);
|
||||||
|
|
||||||
struct wl_drag *
|
struct wl_drag *
|
||||||
window_start_drag(struct window *window, struct input *input, uint32_t time,
|
window_create_drag(struct window *window);
|
||||||
const struct wl_drag_listener *listener, void *data);
|
|
||||||
|
|
||||||
|
void
|
||||||
|
window_activate_drag(struct wl_drag *drag, struct window *window,
|
||||||
|
struct input *input, uint32_t time);
|
||||||
|
|
||||||
void
|
void
|
||||||
input_get_position(struct input *input, int32_t *x, int32_t *y);
|
input_get_position(struct input *input, int32_t *x, int32_t *y);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue