compositor: Adapt to wl_surface going away
struct weston_surface is now the only surface type we have (in core, shell.c has shell_surface, of course). A lot of code gets simpler and we never have to try to guess whether an API takes a wl_surface or a weston_surface.
This commit is contained in:
+1
-2
@@ -186,8 +186,7 @@ weston_surface_animation_run(struct weston_surface *surface,
|
|||||||
weston_surface_animation_frame(&animation->animation, NULL, 0);
|
weston_surface_animation_frame(&animation->animation, NULL, 0);
|
||||||
|
|
||||||
animation->listener.notify = handle_animation_surface_destroy;
|
animation->listener.notify = handle_animation_surface_destroy;
|
||||||
wl_signal_add(&surface->surface.resource.destroy_signal,
|
wl_signal_add(&surface->resource.destroy_signal, &animation->listener);
|
||||||
&animation->listener);
|
|
||||||
|
|
||||||
wl_list_insert(&surface->output->animation_list,
|
wl_list_insert(&surface->output->animation_list,
|
||||||
&animation->animation.link);
|
&animation->animation.link);
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ rpi_element_create(struct rpi_output *output, struct weston_surface *surface)
|
|||||||
element->surface = surface;
|
element->surface = surface;
|
||||||
element->surface_destroy_listener.notify =
|
element->surface_destroy_listener.notify =
|
||||||
rpi_element_handle_surface_destroy;
|
rpi_element_handle_surface_destroy;
|
||||||
wl_signal_add(&surface->surface.resource.destroy_signal,
|
wl_signal_add(&surface->resource.destroy_signal,
|
||||||
&element->surface_destroy_listener);
|
&element->surface_destroy_listener);
|
||||||
|
|
||||||
wl_list_insert(output->element_list.prev, &element->link);
|
wl_list_insert(output->element_list.prev, &element->link);
|
||||||
@@ -722,7 +722,7 @@ find_rpi_element_from_surface(struct weston_surface *surface)
|
|||||||
struct wl_listener *listener;
|
struct wl_listener *listener;
|
||||||
struct rpi_element *element;
|
struct rpi_element *element;
|
||||||
|
|
||||||
listener = wl_signal_get(&surface->surface.resource.destroy_signal,
|
listener = wl_signal_get(&surface->resource.destroy_signal,
|
||||||
rpi_element_handle_surface_destroy);
|
rpi_element_handle_surface_destroy);
|
||||||
if (!listener)
|
if (!listener)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
+19
-23
@@ -271,12 +271,12 @@ weston_surface_create(struct weston_compositor *compositor)
|
|||||||
if (surface == NULL)
|
if (surface == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
wl_signal_init(&surface->surface.resource.destroy_signal);
|
wl_signal_init(&surface->resource.destroy_signal);
|
||||||
|
|
||||||
wl_list_init(&surface->link);
|
wl_list_init(&surface->link);
|
||||||
wl_list_init(&surface->layer_link);
|
wl_list_init(&surface->layer_link);
|
||||||
|
|
||||||
surface->surface.resource.client = NULL;
|
surface->resource.client = NULL;
|
||||||
|
|
||||||
surface->compositor = compositor;
|
surface->compositor = compositor;
|
||||||
surface->alpha = 1.0;
|
surface->alpha = 1.0;
|
||||||
@@ -490,10 +490,10 @@ weston_surface_update_output_mask(struct weston_surface *es, uint32_t mask)
|
|||||||
uint32_t left = es->output_mask & different;
|
uint32_t left = es->output_mask & different;
|
||||||
struct weston_output *output;
|
struct weston_output *output;
|
||||||
struct wl_resource *resource = NULL;
|
struct wl_resource *resource = NULL;
|
||||||
struct wl_client *client = es->surface.resource.client;
|
struct wl_client *client = es->resource.client;
|
||||||
|
|
||||||
es->output_mask = mask;
|
es->output_mask = mask;
|
||||||
if (es->surface.resource.client == NULL)
|
if (es->resource.client == NULL)
|
||||||
return;
|
return;
|
||||||
if (different == 0)
|
if (different == 0)
|
||||||
return;
|
return;
|
||||||
@@ -506,9 +506,9 @@ weston_surface_update_output_mask(struct weston_surface *es, uint32_t mask)
|
|||||||
if (resource == NULL)
|
if (resource == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (1 << output->id & entered)
|
if (1 << output->id & entered)
|
||||||
wl_surface_send_enter(&es->surface.resource, resource);
|
wl_surface_send_enter(&es->resource, resource);
|
||||||
if (1 << output->id & left)
|
if (1 << output->id & left)
|
||||||
wl_surface_send_leave(&es->surface.resource, resource);
|
wl_surface_send_leave(&es->resource, resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -849,7 +849,7 @@ weston_surface_set_transform_parent(struct weston_surface *surface,
|
|||||||
surface->geometry.parent_destroy_listener.notify =
|
surface->geometry.parent_destroy_listener.notify =
|
||||||
transform_parent_handle_parent_destroy;
|
transform_parent_handle_parent_destroy;
|
||||||
if (parent) {
|
if (parent) {
|
||||||
wl_signal_add(&parent->surface.resource.destroy_signal,
|
wl_signal_add(&parent->resource.destroy_signal,
|
||||||
&surface->geometry.parent_destroy_listener);
|
&surface->geometry.parent_destroy_listener);
|
||||||
wl_list_insert(&parent->geometry.child_list,
|
wl_list_insert(&parent->geometry.child_list,
|
||||||
&surface->geometry.parent_link);
|
&surface->geometry.parent_link);
|
||||||
@@ -946,11 +946,9 @@ weston_surface_unmap(struct weston_surface *surface)
|
|||||||
wl_list_remove(&surface->layer_link);
|
wl_list_remove(&surface->layer_link);
|
||||||
|
|
||||||
wl_list_for_each(seat, &surface->compositor->seat_list, link) {
|
wl_list_for_each(seat, &surface->compositor->seat_list, link) {
|
||||||
if (seat->keyboard &&
|
if (seat->keyboard && seat->keyboard->focus == surface)
|
||||||
seat->keyboard->focus == &surface->surface)
|
|
||||||
weston_keyboard_set_focus(seat->keyboard, NULL);
|
weston_keyboard_set_focus(seat->keyboard, NULL);
|
||||||
if (seat->pointer &&
|
if (seat->pointer && seat->pointer->focus == surface)
|
||||||
seat->pointer->focus == &surface->surface)
|
|
||||||
weston_pointer_set_focus(seat->pointer,
|
weston_pointer_set_focus(seat->pointer,
|
||||||
NULL,
|
NULL,
|
||||||
wl_fixed_from_int(0),
|
wl_fixed_from_int(0),
|
||||||
@@ -969,8 +967,7 @@ static void
|
|||||||
destroy_surface(struct wl_resource *resource)
|
destroy_surface(struct wl_resource *resource)
|
||||||
{
|
{
|
||||||
struct weston_surface *surface =
|
struct weston_surface *surface =
|
||||||
container_of(resource,
|
container_of(resource, struct weston_surface, resource);
|
||||||
struct weston_surface, surface.resource);
|
|
||||||
struct weston_compositor *compositor = surface->compositor;
|
struct weston_compositor *compositor = surface->compositor;
|
||||||
struct weston_frame_callback *cb, *next;
|
struct weston_frame_callback *cb, *next;
|
||||||
|
|
||||||
@@ -1012,11 +1009,10 @@ WL_EXPORT void
|
|||||||
weston_surface_destroy(struct weston_surface *surface)
|
weston_surface_destroy(struct weston_surface *surface)
|
||||||
{
|
{
|
||||||
/* Not a valid way to destroy a client surface */
|
/* Not a valid way to destroy a client surface */
|
||||||
assert(surface->surface.resource.client == NULL);
|
assert(surface->resource.client == NULL);
|
||||||
|
|
||||||
wl_signal_emit(&surface->surface.resource.destroy_signal,
|
wl_signal_emit(&surface->resource.destroy_signal, &surface->resource);
|
||||||
&surface->surface.resource);
|
destroy_surface(&surface->resource);
|
||||||
destroy_surface(&surface->surface.resource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1532,15 +1528,15 @@ compositor_create_surface(struct wl_client *client,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->surface.resource.destroy = destroy_surface;
|
surface->resource.destroy = destroy_surface;
|
||||||
|
|
||||||
surface->surface.resource.object.id = id;
|
surface->resource.object.id = id;
|
||||||
surface->surface.resource.object.interface = &wl_surface_interface;
|
surface->resource.object.interface = &wl_surface_interface;
|
||||||
surface->surface.resource.object.implementation =
|
surface->resource.object.implementation =
|
||||||
(void (**)(void)) &surface_interface;
|
(void (**)(void)) &surface_interface;
|
||||||
surface->surface.resource.data = surface;
|
surface->resource.data = surface;
|
||||||
|
|
||||||
wl_client_add_resource(client, &surface->surface.resource);
|
wl_client_add_resource(client, &surface->resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+14
-14
@@ -211,7 +211,7 @@ struct weston_output {
|
|||||||
struct weston_pointer_grab;
|
struct weston_pointer_grab;
|
||||||
struct weston_pointer_grab_interface {
|
struct weston_pointer_grab_interface {
|
||||||
void (*focus)(struct weston_pointer_grab *grab,
|
void (*focus)(struct weston_pointer_grab *grab,
|
||||||
struct wl_surface *surface,
|
struct weston_surface *surface,
|
||||||
wl_fixed_t x,
|
wl_fixed_t x,
|
||||||
wl_fixed_t y);
|
wl_fixed_t y);
|
||||||
void (*motion)(struct weston_pointer_grab *grab,
|
void (*motion)(struct weston_pointer_grab *grab,
|
||||||
@@ -225,7 +225,7 @@ struct weston_pointer_grab_interface {
|
|||||||
struct weston_pointer_grab {
|
struct weston_pointer_grab {
|
||||||
const struct weston_pointer_grab_interface *interface;
|
const struct weston_pointer_grab_interface *interface;
|
||||||
struct weston_pointer *pointer;
|
struct weston_pointer *pointer;
|
||||||
struct wl_surface *focus;
|
struct weston_surface *focus;
|
||||||
wl_fixed_t x, y;
|
wl_fixed_t x, y;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ struct weston_keyboard_grab_interface {
|
|||||||
struct weston_keyboard_grab {
|
struct weston_keyboard_grab {
|
||||||
const struct weston_keyboard_grab_interface *interface;
|
const struct weston_keyboard_grab_interface *interface;
|
||||||
struct weston_keyboard *keyboard;
|
struct weston_keyboard *keyboard;
|
||||||
struct wl_surface *focus;
|
struct weston_surface *focus;
|
||||||
uint32_t key;
|
uint32_t key;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ struct weston_touch_grab_interface {
|
|||||||
struct weston_touch_grab {
|
struct weston_touch_grab {
|
||||||
const struct weston_touch_grab_interface *interface;
|
const struct weston_touch_grab_interface *interface;
|
||||||
struct weston_touch *touch;
|
struct weston_touch *touch;
|
||||||
struct wl_surface *focus;
|
struct weston_surface *focus;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wl_data_offer {
|
struct wl_data_offer {
|
||||||
@@ -289,7 +289,7 @@ struct weston_pointer {
|
|||||||
struct weston_seat *seat;
|
struct weston_seat *seat;
|
||||||
|
|
||||||
struct wl_list resource_list;
|
struct wl_list resource_list;
|
||||||
struct wl_surface *focus;
|
struct weston_surface *focus;
|
||||||
struct wl_resource *focus_resource;
|
struct wl_resource *focus_resource;
|
||||||
struct wl_listener focus_listener;
|
struct wl_listener focus_listener;
|
||||||
uint32_t focus_serial;
|
uint32_t focus_serial;
|
||||||
@@ -303,7 +303,7 @@ struct weston_pointer {
|
|||||||
uint32_t grab_time;
|
uint32_t grab_time;
|
||||||
|
|
||||||
wl_fixed_t x, y;
|
wl_fixed_t x, y;
|
||||||
struct wl_surface *current;
|
struct weston_surface *current;
|
||||||
struct wl_listener current_listener;
|
struct wl_listener current_listener;
|
||||||
wl_fixed_t current_x, current_y;
|
wl_fixed_t current_x, current_y;
|
||||||
|
|
||||||
@@ -315,7 +315,7 @@ struct weston_touch {
|
|||||||
struct weston_seat *seat;
|
struct weston_seat *seat;
|
||||||
|
|
||||||
struct wl_list resource_list;
|
struct wl_list resource_list;
|
||||||
struct wl_surface *focus;
|
struct weston_surface *focus;
|
||||||
struct wl_resource *focus_resource;
|
struct wl_resource *focus_resource;
|
||||||
struct wl_listener focus_listener;
|
struct wl_listener focus_listener;
|
||||||
uint32_t focus_serial;
|
uint32_t focus_serial;
|
||||||
@@ -334,7 +334,7 @@ void
|
|||||||
weston_pointer_destroy(struct weston_pointer *pointer);
|
weston_pointer_destroy(struct weston_pointer *pointer);
|
||||||
void
|
void
|
||||||
weston_pointer_set_focus(struct weston_pointer *pointer,
|
weston_pointer_set_focus(struct weston_pointer *pointer,
|
||||||
struct wl_surface *surface,
|
struct weston_surface *surface,
|
||||||
wl_fixed_t sx, wl_fixed_t sy);
|
wl_fixed_t sx, wl_fixed_t sy);
|
||||||
void
|
void
|
||||||
weston_pointer_start_grab(struct weston_pointer *pointer,
|
weston_pointer_start_grab(struct weston_pointer *pointer,
|
||||||
@@ -343,7 +343,7 @@ void
|
|||||||
weston_pointer_end_grab(struct weston_pointer *pointer);
|
weston_pointer_end_grab(struct weston_pointer *pointer);
|
||||||
void
|
void
|
||||||
weston_pointer_set_current(struct weston_pointer *pointer,
|
weston_pointer_set_current(struct weston_pointer *pointer,
|
||||||
struct wl_surface *surface);
|
struct weston_surface *surface);
|
||||||
|
|
||||||
struct weston_keyboard *
|
struct weston_keyboard *
|
||||||
weston_keyboard_create(void);
|
weston_keyboard_create(void);
|
||||||
@@ -351,7 +351,7 @@ void
|
|||||||
weston_keyboard_destroy(struct weston_keyboard *keyboard);
|
weston_keyboard_destroy(struct weston_keyboard *keyboard);
|
||||||
void
|
void
|
||||||
weston_keyboard_set_focus(struct weston_keyboard *keyboard,
|
weston_keyboard_set_focus(struct weston_keyboard *keyboard,
|
||||||
struct wl_surface *surface);
|
struct weston_surface *surface);
|
||||||
void
|
void
|
||||||
weston_keyboard_start_grab(struct weston_keyboard *device,
|
weston_keyboard_start_grab(struct weston_keyboard *device,
|
||||||
struct weston_keyboard_grab *grab);
|
struct weston_keyboard_grab *grab);
|
||||||
@@ -401,7 +401,7 @@ struct weston_keyboard {
|
|||||||
struct weston_seat *seat;
|
struct weston_seat *seat;
|
||||||
|
|
||||||
struct wl_list resource_list;
|
struct wl_list resource_list;
|
||||||
struct wl_surface *focus;
|
struct weston_surface *focus;
|
||||||
struct wl_resource *focus_resource;
|
struct wl_resource *focus_resource;
|
||||||
struct wl_listener focus_listener;
|
struct wl_listener focus_listener;
|
||||||
uint32_t focus_serial;
|
uint32_t focus_serial;
|
||||||
@@ -441,7 +441,7 @@ struct weston_seat {
|
|||||||
int32_t hotspot_x, hotspot_y;
|
int32_t hotspot_x, hotspot_y;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
enum weston_keyboard_modifier modifier_state;
|
enum weston_keyboard_modifier modifier_state;
|
||||||
struct wl_surface *saved_kbd_focus;
|
struct weston_surface *saved_kbd_focus;
|
||||||
struct wl_listener saved_kbd_focus_listener;
|
struct wl_listener saved_kbd_focus_listener;
|
||||||
|
|
||||||
uint32_t selection_serial;
|
uint32_t selection_serial;
|
||||||
@@ -453,7 +453,7 @@ struct weston_seat {
|
|||||||
struct wl_client *drag_client;
|
struct wl_client *drag_client;
|
||||||
struct wl_data_source *drag_data_source;
|
struct wl_data_source *drag_data_source;
|
||||||
struct wl_listener drag_data_source_listener;
|
struct wl_listener drag_data_source_listener;
|
||||||
struct wl_surface *drag_focus;
|
struct weston_surface *drag_focus;
|
||||||
struct wl_resource *drag_focus_resource;
|
struct wl_resource *drag_focus_resource;
|
||||||
struct wl_listener drag_focus_listener;
|
struct wl_listener drag_focus_listener;
|
||||||
struct weston_pointer_grab drag_grab;
|
struct weston_pointer_grab drag_grab;
|
||||||
@@ -618,7 +618,7 @@ struct weston_region {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
struct weston_surface {
|
struct weston_surface {
|
||||||
struct wl_surface surface;
|
struct wl_resource resource;
|
||||||
struct weston_compositor *compositor;
|
struct weston_compositor *compositor;
|
||||||
pixman_region32_t clip;
|
pixman_region32_t clip;
|
||||||
pixman_region32_t damage;
|
pixman_region32_t damage;
|
||||||
|
|||||||
+3
-3
@@ -193,7 +193,7 @@ device_setup_new_drag_surface(struct weston_seat *seat,
|
|||||||
struct weston_surface *surface)
|
struct weston_surface *surface)
|
||||||
{
|
{
|
||||||
if (surface->configure) {
|
if (surface->configure) {
|
||||||
wl_resource_post_error(&surface->surface.resource,
|
wl_resource_post_error(&surface->resource,
|
||||||
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
||||||
"surface->configure already set");
|
"surface->configure already set");
|
||||||
return 0;
|
return 0;
|
||||||
@@ -206,7 +206,7 @@ device_setup_new_drag_surface(struct weston_seat *seat,
|
|||||||
surface->configure = drag_surface_configure;
|
surface->configure = drag_surface_configure;
|
||||||
surface->configure_private = seat;
|
surface->configure_private = seat;
|
||||||
|
|
||||||
wl_signal_add(&surface->surface.resource.destroy_signal,
|
wl_signal_add(&surface->resource.destroy_signal,
|
||||||
&seat->drag_surface_destroy_listener);
|
&seat->drag_surface_destroy_listener);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -235,7 +235,7 @@ destroy_drag_focus(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
drag_grab_focus(struct weston_pointer_grab *grab,
|
drag_grab_focus(struct weston_pointer_grab *grab,
|
||||||
struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y)
|
struct weston_surface *surface, wl_fixed_t x, wl_fixed_t y)
|
||||||
{
|
{
|
||||||
struct weston_seat *seat =
|
struct weston_seat *seat =
|
||||||
container_of(grab, struct weston_seat, drag_grab);
|
container_of(grab, struct weston_seat, drag_grab);
|
||||||
|
|||||||
+15
-16
@@ -59,12 +59,11 @@ weston_seat_repick(struct weston_seat *seat)
|
|||||||
&pointer->current_x,
|
&pointer->current_x,
|
||||||
&pointer->current_y);
|
&pointer->current_y);
|
||||||
|
|
||||||
if (&surface->surface != pointer->current) {
|
if (surface != pointer->current) {
|
||||||
interface = pointer->grab->interface;
|
interface = pointer->grab->interface;
|
||||||
weston_pointer_set_current(pointer, &surface->surface);
|
weston_pointer_set_current(pointer, surface);
|
||||||
interface->focus(pointer->grab, &surface->surface,
|
interface->focus(pointer->grab, surface,
|
||||||
pointer->current_x,
|
pointer->current_x, pointer->current_y);
|
||||||
pointer->current_y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
focus = (struct weston_surface *) pointer->grab->focus;
|
focus = (struct weston_surface *) pointer->grab->focus;
|
||||||
@@ -119,7 +118,7 @@ lose_touch_focus(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
default_grab_focus(struct weston_pointer_grab *grab,
|
default_grab_focus(struct weston_pointer_grab *grab,
|
||||||
struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y)
|
struct weston_surface *surface, wl_fixed_t x, wl_fixed_t y)
|
||||||
{
|
{
|
||||||
struct weston_pointer *pointer = grab->pointer;
|
struct weston_pointer *pointer = grab->pointer;
|
||||||
|
|
||||||
@@ -239,7 +238,7 @@ default_grab_key(struct weston_keyboard_grab *grab,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct wl_resource *
|
static struct wl_resource *
|
||||||
find_resource_for_surface(struct wl_list *list, struct wl_surface *surface)
|
find_resource_for_surface(struct wl_list *list, struct weston_surface *surface)
|
||||||
{
|
{
|
||||||
struct wl_resource *r;
|
struct wl_resource *r;
|
||||||
|
|
||||||
@@ -402,7 +401,7 @@ seat_send_updated_caps(struct weston_seat *seat)
|
|||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
weston_pointer_set_focus(struct weston_pointer *pointer,
|
weston_pointer_set_focus(struct weston_pointer *pointer,
|
||||||
struct wl_surface *surface,
|
struct weston_surface *surface,
|
||||||
wl_fixed_t sx, wl_fixed_t sy)
|
wl_fixed_t sx, wl_fixed_t sy)
|
||||||
{
|
{
|
||||||
struct weston_keyboard *kbd = pointer->seat->keyboard;
|
struct weston_keyboard *kbd = pointer->seat->keyboard;
|
||||||
@@ -453,7 +452,7 @@ weston_pointer_set_focus(struct weston_pointer *pointer,
|
|||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
weston_keyboard_set_focus(struct weston_keyboard *keyboard,
|
weston_keyboard_set_focus(struct weston_keyboard *keyboard,
|
||||||
struct wl_surface *surface)
|
struct weston_surface *surface)
|
||||||
{
|
{
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
struct wl_display *display;
|
struct wl_display *display;
|
||||||
@@ -545,7 +544,7 @@ current_surface_destroy(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
weston_pointer_set_current(struct weston_pointer *pointer,
|
weston_pointer_set_current(struct weston_pointer *pointer,
|
||||||
struct wl_surface *surface)
|
struct weston_surface *surface)
|
||||||
{
|
{
|
||||||
if (pointer->current)
|
if (pointer->current)
|
||||||
wl_list_remove(&pointer->current_listener.link);
|
wl_list_remove(&pointer->current_listener.link);
|
||||||
@@ -682,7 +681,7 @@ weston_surface_activate(struct weston_surface *surface,
|
|||||||
struct weston_compositor *compositor = seat->compositor;
|
struct weston_compositor *compositor = seat->compositor;
|
||||||
|
|
||||||
if (seat->keyboard) {
|
if (seat->keyboard) {
|
||||||
weston_keyboard_set_focus(seat->keyboard, &surface->surface);
|
weston_keyboard_set_focus(seat->keyboard, surface);
|
||||||
wl_data_device_set_keyboard_focus(seat);
|
wl_data_device_set_keyboard_focus(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -927,7 +926,7 @@ notify_keyboard_focus_in(struct weston_seat *seat, struct wl_array *keys,
|
|||||||
{
|
{
|
||||||
struct weston_compositor *compositor = seat->compositor;
|
struct weston_compositor *compositor = seat->compositor;
|
||||||
struct weston_keyboard *keyboard = seat->keyboard;
|
struct weston_keyboard *keyboard = seat->keyboard;
|
||||||
struct wl_surface *surface;
|
struct weston_surface *surface;
|
||||||
uint32_t *k, serial;
|
uint32_t *k, serial;
|
||||||
|
|
||||||
serial = wl_display_next_serial(compositor->wl_display);
|
serial = wl_display_next_serial(compositor->wl_display);
|
||||||
@@ -986,7 +985,7 @@ notify_keyboard_focus_out(struct weston_seat *seat)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
touch_set_focus(struct weston_seat *seat, struct wl_surface *surface)
|
touch_set_focus(struct weston_seat *seat, struct weston_surface *surface)
|
||||||
{
|
{
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
|
|
||||||
@@ -1047,7 +1046,7 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
|
|||||||
* until all touch points are up again. */
|
* until all touch points are up again. */
|
||||||
if (seat->num_tp == 1) {
|
if (seat->num_tp == 1) {
|
||||||
es = weston_compositor_pick_surface(ec, x, y, &sx, &sy);
|
es = weston_compositor_pick_surface(ec, x, y, &sx, &sy);
|
||||||
touch_set_focus(seat, &es->surface);
|
touch_set_focus(seat, es);
|
||||||
} else if (touch->focus) {
|
} else if (touch->focus) {
|
||||||
es = (struct weston_surface *) touch->focus;
|
es = (struct weston_surface *) touch->focus;
|
||||||
weston_surface_from_global_fixed(es, x, y, &sx, &sy);
|
weston_surface_from_global_fixed(es, x, y, &sx, &sy);
|
||||||
@@ -1152,7 +1151,7 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource,
|
|||||||
|
|
||||||
if (surface && surface != seat->sprite) {
|
if (surface && surface != seat->sprite) {
|
||||||
if (surface->configure) {
|
if (surface->configure) {
|
||||||
wl_resource_post_error(&surface->surface.resource,
|
wl_resource_post_error(&surface->resource,
|
||||||
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
||||||
"surface->configure already "
|
"surface->configure already "
|
||||||
"set");
|
"set");
|
||||||
@@ -1166,7 +1165,7 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource,
|
|||||||
if (!surface)
|
if (!surface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wl_signal_add(&surface->surface.resource.destroy_signal,
|
wl_signal_add(&surface->resource.destroy_signal,
|
||||||
&seat->sprite_destroy_listener);
|
&seat->sprite_destroy_listener);
|
||||||
|
|
||||||
surface->configure = pointer_cursor_surface_configure;
|
surface->configure = pointer_cursor_surface_configure;
|
||||||
|
|||||||
+20
-25
@@ -324,11 +324,11 @@ shell_grab_start(struct shell_grab *grab,
|
|||||||
&grab->shsurf_destroy_listener);
|
&grab->shsurf_destroy_listener);
|
||||||
|
|
||||||
grab->pointer = pointer;
|
grab->pointer = pointer;
|
||||||
grab->grab.focus = &shsurf->surface->surface;
|
grab->grab.focus = shsurf->surface;
|
||||||
|
|
||||||
weston_pointer_start_grab(pointer, &grab->grab);
|
weston_pointer_start_grab(pointer, &grab->grab);
|
||||||
desktop_shell_send_grab_cursor(shell->child.desktop_shell, cursor);
|
desktop_shell_send_grab_cursor(shell->child.desktop_shell, cursor);
|
||||||
weston_pointer_set_focus(pointer, &shell->grab_surface->surface,
|
weston_pointer_set_focus(pointer, shell->grab_surface,
|
||||||
wl_fixed_from_int(0), wl_fixed_from_int(0));
|
wl_fixed_from_int(0), wl_fixed_from_int(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,11 +498,10 @@ static void
|
|||||||
restore_focus_state(struct desktop_shell *shell, struct workspace *ws)
|
restore_focus_state(struct desktop_shell *shell, struct workspace *ws)
|
||||||
{
|
{
|
||||||
struct focus_state *state, *next;
|
struct focus_state *state, *next;
|
||||||
struct wl_surface *surface;
|
struct weston_surface *surface;
|
||||||
|
|
||||||
wl_list_for_each_safe(state, next, &ws->focus_list, link) {
|
wl_list_for_each_safe(state, next, &ws->focus_list, link) {
|
||||||
surface = state->keyboard_focus ?
|
surface = state->keyboard_focus;
|
||||||
&state->keyboard_focus->surface : NULL;
|
|
||||||
|
|
||||||
weston_keyboard_set_focus(state->seat->keyboard, surface);
|
weston_keyboard_set_focus(state->seat->keyboard, surface);
|
||||||
}
|
}
|
||||||
@@ -513,7 +512,7 @@ replace_focus_state(struct desktop_shell *shell, struct workspace *ws,
|
|||||||
struct weston_seat *seat)
|
struct weston_seat *seat)
|
||||||
{
|
{
|
||||||
struct focus_state *state;
|
struct focus_state *state;
|
||||||
struct wl_surface *surface;
|
struct weston_surface *surface;
|
||||||
|
|
||||||
wl_list_for_each(state, &ws->focus_list, link) {
|
wl_list_for_each(state, &ws->focus_list, link) {
|
||||||
if (state->seat == seat) {
|
if (state->seat == seat) {
|
||||||
@@ -900,8 +899,7 @@ move_surface_to_workspace(struct desktop_shell *shell,
|
|||||||
|
|
||||||
drop_focus_state(shell, from, surface);
|
drop_focus_state(shell, from, surface);
|
||||||
wl_list_for_each(seat, &shell->compositor->seat_list, link)
|
wl_list_for_each(seat, &shell->compositor->seat_list, link)
|
||||||
if (seat->keyboard &&
|
if (seat->keyboard && seat->keyboard->focus == surface)
|
||||||
seat->keyboard->focus == &surface->surface)
|
|
||||||
weston_keyboard_set_focus(seat->keyboard, NULL);
|
weston_keyboard_set_focus(seat->keyboard, NULL);
|
||||||
|
|
||||||
weston_surface_damage_below(surface);
|
weston_surface_damage_below(surface);
|
||||||
@@ -1017,7 +1015,7 @@ bind_workspace_manager(struct wl_client *client,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
noop_grab_focus(struct weston_pointer_grab *grab,
|
noop_grab_focus(struct weston_pointer_grab *grab,
|
||||||
struct wl_surface *surface, wl_fixed_t x, wl_fixed_t y)
|
struct weston_surface *surface, wl_fixed_t x, wl_fixed_t y)
|
||||||
{
|
{
|
||||||
grab->focus = NULL;
|
grab->focus = NULL;
|
||||||
}
|
}
|
||||||
@@ -1101,7 +1099,7 @@ shell_surface_move(struct wl_client *client, struct wl_resource *resource,
|
|||||||
|
|
||||||
if (seat->pointer->button_count == 0 ||
|
if (seat->pointer->button_count == 0 ||
|
||||||
seat->pointer->grab_serial != serial ||
|
seat->pointer->grab_serial != serial ||
|
||||||
seat->pointer->focus != &shsurf->surface->surface)
|
seat->pointer->focus != shsurf->surface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (surface_move(shsurf, seat) < 0)
|
if (surface_move(shsurf, seat) < 0)
|
||||||
@@ -1228,7 +1226,7 @@ shell_surface_resize(struct wl_client *client, struct wl_resource *resource,
|
|||||||
|
|
||||||
if (seat->pointer->button_count == 0 ||
|
if (seat->pointer->button_count == 0 ||
|
||||||
seat->pointer->grab_serial != serial ||
|
seat->pointer->grab_serial != serial ||
|
||||||
seat->pointer->focus != &shsurf->surface->surface)
|
seat->pointer->focus != shsurf->surface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (surface_resize(shsurf, seat, edges) < 0)
|
if (surface_resize(shsurf, seat, edges) < 0)
|
||||||
@@ -1237,7 +1235,7 @@ shell_surface_resize(struct wl_client *client, struct wl_resource *resource,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
busy_cursor_grab_focus(struct weston_pointer_grab *base,
|
busy_cursor_grab_focus(struct weston_pointer_grab *base,
|
||||||
struct wl_surface *surface, int32_t x, int32_t y)
|
struct weston_surface *surface, int32_t x, int32_t y)
|
||||||
{
|
{
|
||||||
struct shell_grab *grab = (struct shell_grab *) base;
|
struct shell_grab *grab = (struct shell_grab *) base;
|
||||||
|
|
||||||
@@ -1326,7 +1324,7 @@ ping_timeout_handler(void *data)
|
|||||||
shsurf->unresponsive = 1;
|
shsurf->unresponsive = 1;
|
||||||
|
|
||||||
wl_list_for_each(seat, &shsurf->surface->compositor->seat_list, link)
|
wl_list_for_each(seat, &shsurf->surface->compositor->seat_list, link)
|
||||||
if (seat->pointer->focus == &shsurf->surface->surface)
|
if (seat->pointer->focus == shsurf->surface)
|
||||||
set_busy_cursor(shsurf, seat->pointer);
|
set_busy_cursor(shsurf, seat->pointer);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -1421,10 +1419,8 @@ shell_surface_pong(struct wl_client *client, struct wl_resource *resource,
|
|||||||
/* Received pong from previously unresponsive client */
|
/* Received pong from previously unresponsive client */
|
||||||
wl_list_for_each(seat, &ec->seat_list, link) {
|
wl_list_for_each(seat, &ec->seat_list, link) {
|
||||||
pointer = seat->pointer;
|
pointer = seat->pointer;
|
||||||
if (pointer->focus ==
|
if (pointer->focus == shell->grab_surface &&
|
||||||
&shell->grab_surface->surface &&
|
pointer->current == shsurf->surface)
|
||||||
pointer->current ==
|
|
||||||
&shsurf->surface->surface)
|
|
||||||
end_busy_cursor(shsurf, pointer);
|
end_busy_cursor(shsurf, pointer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1918,7 +1914,7 @@ get_shell_seat(struct weston_seat *seat)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
popup_grab_focus(struct weston_pointer_grab *grab,
|
popup_grab_focus(struct weston_pointer_grab *grab,
|
||||||
struct wl_surface *surface,
|
struct weston_surface *surface,
|
||||||
wl_fixed_t x,
|
wl_fixed_t x,
|
||||||
wl_fixed_t y)
|
wl_fixed_t y)
|
||||||
{
|
{
|
||||||
@@ -2015,7 +2011,7 @@ add_popup_grab(struct shell_surface *shsurf, struct shell_seat *shseat)
|
|||||||
struct weston_seat *seat = shseat->seat;
|
struct weston_seat *seat = shseat->seat;
|
||||||
|
|
||||||
if (wl_list_empty(&shseat->popup_grab.surfaces_list)) {
|
if (wl_list_empty(&shseat->popup_grab.surfaces_list)) {
|
||||||
shseat->popup_grab.client = shsurf->surface->surface.resource.client;
|
shseat->popup_grab.client = shsurf->resource.client;
|
||||||
shseat->popup_grab.grab.interface = &popup_grab_interface;
|
shseat->popup_grab.grab.interface = &popup_grab_interface;
|
||||||
/* We must make sure here that this popup was opened after
|
/* We must make sure here that this popup was opened after
|
||||||
* a mouse press, and not just by moving around with other
|
* a mouse press, and not just by moving around with other
|
||||||
@@ -2190,7 +2186,7 @@ create_shell_surface(void *shell, struct weston_surface *surface,
|
|||||||
|
|
||||||
wl_signal_init(&shsurf->resource.destroy_signal);
|
wl_signal_init(&shsurf->resource.destroy_signal);
|
||||||
shsurf->surface_destroy_listener.notify = shell_handle_surface_destroy;
|
shsurf->surface_destroy_listener.notify = shell_handle_surface_destroy;
|
||||||
wl_signal_add(&surface->surface.resource.destroy_signal,
|
wl_signal_add(&surface->resource.destroy_signal,
|
||||||
&shsurf->surface_destroy_listener);
|
&shsurf->surface_destroy_listener);
|
||||||
|
|
||||||
/* init link so its safe to always remove it in destroy_shell_surface */
|
/* init link so its safe to always remove it in destroy_shell_surface */
|
||||||
@@ -2841,7 +2837,7 @@ activate(struct desktop_shell *shell, struct weston_surface *es,
|
|||||||
|
|
||||||
state->keyboard_focus = es;
|
state->keyboard_focus = es;
|
||||||
wl_list_remove(&state->surface_destroy_listener.link);
|
wl_list_remove(&state->surface_destroy_listener.link);
|
||||||
wl_signal_add(&es->surface.resource.destroy_signal,
|
wl_signal_add(&es->resource.destroy_signal,
|
||||||
&state->surface_destroy_listener);
|
&state->surface_destroy_listener);
|
||||||
|
|
||||||
switch (get_shell_surface_type(es)) {
|
switch (get_shell_surface_type(es)) {
|
||||||
@@ -3607,7 +3603,7 @@ create_input_panel_surface(struct desktop_shell *shell,
|
|||||||
|
|
||||||
wl_signal_init(&input_panel_surface->resource.destroy_signal);
|
wl_signal_init(&input_panel_surface->resource.destroy_signal);
|
||||||
input_panel_surface->surface_destroy_listener.notify = input_panel_handle_surface_destroy;
|
input_panel_surface->surface_destroy_listener.notify = input_panel_handle_surface_destroy;
|
||||||
wl_signal_add(&surface->surface.resource.destroy_signal,
|
wl_signal_add(&surface->resource.destroy_signal,
|
||||||
&input_panel_surface->surface_destroy_listener);
|
&input_panel_surface->surface_destroy_listener);
|
||||||
|
|
||||||
wl_list_init(&input_panel_surface->link);
|
wl_list_init(&input_panel_surface->link);
|
||||||
@@ -3778,8 +3774,7 @@ switcher_next(struct switcher *switcher)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
wl_list_remove(&switcher->listener.link);
|
wl_list_remove(&switcher->listener.link);
|
||||||
wl_signal_add(&next->surface.resource.destroy_signal,
|
wl_signal_add(&next->resource.destroy_signal, &switcher->listener);
|
||||||
&switcher->listener);
|
|
||||||
|
|
||||||
switcher->current = next;
|
switcher->current = next;
|
||||||
next->alpha = 1.0;
|
next->alpha = 1.0;
|
||||||
@@ -4023,7 +4018,7 @@ static void
|
|||||||
force_kill_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
|
force_kill_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct wl_surface *focus_surface;
|
struct weston_surface *focus_surface;
|
||||||
struct wl_client *client;
|
struct wl_client *client;
|
||||||
struct desktop_shell *shell = data;
|
struct desktop_shell *shell = data;
|
||||||
struct weston_compositor *compositor = shell->compositor;
|
struct weston_compositor *compositor = shell->compositor;
|
||||||
|
|||||||
+3
-4
@@ -150,7 +150,7 @@ tablet_shell_surface_configure(struct weston_surface *surface,
|
|||||||
}
|
}
|
||||||
} else if (shell->current_client &&
|
} else if (shell->current_client &&
|
||||||
shell->current_client->surface != surface &&
|
shell->current_client->surface != surface &&
|
||||||
shell->current_client->client == surface->surface.resource.client) {
|
shell->current_client->client == surface->resource.client) {
|
||||||
tablet_shell_set_state(shell, STATE_TASK);
|
tablet_shell_set_state(shell, STATE_TASK);
|
||||||
shell->current_client->surface = surface;
|
shell->current_client->surface = surface;
|
||||||
weston_zoom_run(surface, 0.3, 1.0, NULL, NULL);
|
weston_zoom_run(surface, 0.3, 1.0, NULL, NULL);
|
||||||
@@ -184,7 +184,7 @@ tablet_shell_set_lockscreen(struct wl_client *client,
|
|||||||
shell->lockscreen_surface = es;
|
shell->lockscreen_surface = es;
|
||||||
shell->lockscreen_surface->configure = tablet_shell_surface_configure;
|
shell->lockscreen_surface->configure = tablet_shell_surface_configure;
|
||||||
shell->lockscreen_listener.notify = handle_lockscreen_surface_destroy;
|
shell->lockscreen_listener.notify = handle_lockscreen_surface_destroy;
|
||||||
wl_signal_add(&es->surface.resource.destroy_signal,
|
wl_signal_add(&es->resource.destroy_signal,
|
||||||
&shell->lockscreen_listener);
|
&shell->lockscreen_listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,8 +216,7 @@ tablet_shell_set_switcher(struct wl_client *client,
|
|||||||
weston_surface_set_position(shell->switcher_surface, 0, 0);
|
weston_surface_set_position(shell->switcher_surface, 0, 0);
|
||||||
|
|
||||||
shell->switcher_listener.notify = handle_switcher_surface_destroy;
|
shell->switcher_listener.notify = handle_switcher_surface_destroy;
|
||||||
wl_signal_add(&es->surface.resource.destroy_signal,
|
wl_signal_add(&es->resource.destroy_signal, &shell->switcher_listener);
|
||||||
&shell->switcher_listener);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
+2
-2
@@ -39,7 +39,7 @@ struct text_input {
|
|||||||
|
|
||||||
struct wl_list input_methods;
|
struct wl_list input_methods;
|
||||||
|
|
||||||
struct wl_surface *surface;
|
struct weston_surface *surface;
|
||||||
|
|
||||||
pixman_box32_t cursor_rectangle;
|
pixman_box32_t cursor_rectangle;
|
||||||
|
|
||||||
@@ -794,7 +794,7 @@ handle_keyboard_focus(struct wl_listener *listener, void *data)
|
|||||||
struct weston_keyboard *keyboard = data;
|
struct weston_keyboard *keyboard = data;
|
||||||
struct input_method *input_method =
|
struct input_method *input_method =
|
||||||
container_of(listener, struct input_method, keyboard_focus_listener);
|
container_of(listener, struct input_method, keyboard_focus_listener);
|
||||||
struct wl_surface *surface = keyboard->focus;
|
struct weston_surface *surface = keyboard->focus;
|
||||||
|
|
||||||
if (!input_method->model)
|
if (!input_method->model)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1016,7 +1016,7 @@ weston_wm_window_handle_moveresize(struct weston_wm_window *window,
|
|||||||
&wm->server->compositor->shell_interface;
|
&wm->server->compositor->shell_interface;
|
||||||
|
|
||||||
if (seat->pointer->button_count != 1 ||
|
if (seat->pointer->button_count != 1 ||
|
||||||
seat->pointer->focus != &window->surface->surface)
|
seat->pointer->focus != window->surface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
detail = client_message->data.data32[2];
|
detail = client_message->data.data32[2];
|
||||||
@@ -1715,7 +1715,7 @@ surface_destroy(struct wl_listener *listener, void *data)
|
|||||||
static struct weston_wm_window *
|
static struct weston_wm_window *
|
||||||
get_wm_window(struct weston_surface *surface)
|
get_wm_window(struct weston_surface *surface)
|
||||||
{
|
{
|
||||||
struct wl_resource *resource = &surface->surface.resource;
|
struct wl_resource *resource = &surface->resource;
|
||||||
struct wl_listener *listener;
|
struct wl_listener *listener;
|
||||||
|
|
||||||
listener = wl_signal_get(&resource->destroy_signal, surface_destroy);
|
listener = wl_signal_get(&resource->destroy_signal, surface_destroy);
|
||||||
@@ -1852,7 +1852,7 @@ xserver_set_window_id(struct wl_client *client, struct wl_resource *resource,
|
|||||||
{
|
{
|
||||||
struct weston_xserver *wxs = resource->data;
|
struct weston_xserver *wxs = resource->data;
|
||||||
struct weston_wm *wm = wxs->wm;
|
struct weston_wm *wm = wxs->wm;
|
||||||
struct wl_surface *surface = surface_resource->data;
|
struct weston_surface *surface = surface_resource->data;
|
||||||
struct weston_wm_window *window;
|
struct weston_wm_window *window;
|
||||||
|
|
||||||
if (client != wxs->client)
|
if (client != wxs->client)
|
||||||
|
|||||||
Reference in New Issue
Block a user