Don't use the wlr_ prefix for static functions

This commit is contained in:
emersion 2018-04-25 23:51:00 +01:00
parent 71ca45e2c0
commit 625a7a48dc
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
22 changed files with 306 additions and 302 deletions

View file

@ -107,7 +107,7 @@ static void output_cursor_destroy(
free(output_cursor);
}
static void wlr_cursor_detach_output_layout(struct wlr_cursor *cur) {
static void cursor_detach_output_layout(struct wlr_cursor *cur) {
if (!cur->state->layout) {
return;
}
@ -125,7 +125,7 @@ static void wlr_cursor_detach_output_layout(struct wlr_cursor *cur) {
cur->state->layout = NULL;
}
static void wlr_cursor_device_destroy(struct wlr_cursor_device *c_device) {
static void cursor_device_destroy(struct wlr_cursor_device *c_device) {
struct wlr_input_device *dev = c_device->device;
if (dev->type == WLR_INPUT_DEVICE_POINTER) {
wl_list_remove(&c_device->motion.link);
@ -150,11 +150,11 @@ static void wlr_cursor_device_destroy(struct wlr_cursor_device *c_device) {
}
void wlr_cursor_destroy(struct wlr_cursor *cur) {
wlr_cursor_detach_output_layout(cur);
cursor_detach_output_layout(cur);
struct wlr_cursor_device *device, *device_tmp = NULL;
wl_list_for_each_safe(device, device_tmp, &cur->state->devices, link) {
wlr_cursor_device_destroy(device);
cursor_device_destroy(device);
}
free(cur->state);
@ -174,7 +174,7 @@ static struct wlr_cursor_device *get_cursor_device(struct wlr_cursor *cur,
return ret;
}
static void wlr_cursor_warp_unchecked(struct wlr_cursor *cur,
static void cursor_warp_unchecked(struct wlr_cursor *cur,
double x, double y) {
assert(cur->state->layout);
@ -241,12 +241,12 @@ bool wlr_cursor_warp(struct wlr_cursor *cur, struct wlr_input_device *dev,
if (mapping) {
if (wlr_box_contains_point(mapping, x, y)) {
wlr_cursor_warp_unchecked(cur, x, y);
cursor_warp_unchecked(cur, x, y);
result = true;
}
} else if (wlr_output_layout_contains_point(cur->state->layout, NULL,
x, y)) {
wlr_cursor_warp_unchecked(cur, x, y);
cursor_warp_unchecked(cur, x, y);
result = true;
}
@ -265,7 +265,7 @@ void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
x = x >= 0 ? mapping->width * x + mapping->x : cur->x;
y = y >= 0 ? mapping->height * y + mapping->y : cur->y;
wlr_cursor_warp_unchecked(cur, x, y);
cursor_warp_unchecked(cur, x, y);
}
void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
@ -295,7 +295,7 @@ void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
}
}
wlr_cursor_warp_unchecked(cur, x, y);
cursor_warp_unchecked(cur, x, y);
}
void wlr_cursor_set_image(struct wlr_cursor *cur, const uint8_t *pixels,
@ -414,7 +414,7 @@ static void handle_device_destroy(struct wl_listener *listener, void *data) {
wlr_cursor_detach_input_device(c_device->cursor, c_device->device);
}
static struct wlr_cursor_device *wlr_cursor_device_create(
static struct wlr_cursor_device *cursor_device_create(
struct wlr_cursor *cursor, struct wlr_input_device *device) {
struct wlr_cursor_device *c_device =
calloc(1, sizeof(struct wlr_cursor_device));
@ -496,7 +496,7 @@ void wlr_cursor_attach_input_device(struct wlr_cursor *cur,
}
}
wlr_cursor_device_create(cur, dev);
cursor_device_create(cur, dev);
}
void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
@ -504,7 +504,7 @@ void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
struct wlr_cursor_device *c_device, *tmp = NULL;
wl_list_for_each_safe(c_device, tmp, &cur->state->devices, link) {
if (c_device->device == dev) {
wlr_cursor_device_destroy(c_device);
cursor_device_destroy(c_device);
}
}
}
@ -512,7 +512,7 @@ void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
static void handle_layout_destroy(struct wl_listener *listener, void *data) {
struct wlr_cursor_state *state =
wl_container_of(listener, state, layout_destroy);
wlr_cursor_detach_output_layout(state->cursor);
cursor_detach_output_layout(state->cursor);
}
static void handle_layout_output_destroy(struct wl_listener *listener,
@ -567,13 +567,13 @@ static void handle_layout_change(struct wl_listener *listener, void *data) {
wlr_output_layout_closest_point(layout, NULL, state->cursor->x,
state->cursor->y, &x, &y);
wlr_cursor_warp_unchecked(state->cursor, x, y);
cursor_warp_unchecked(state->cursor, x, y);
}
}
void wlr_cursor_attach_output_layout(struct wlr_cursor *cur,
struct wlr_output_layout *l) {
wlr_cursor_detach_output_layout(cur);
cursor_detach_output_layout(cur);
if (l == NULL) {
return;

View file

@ -219,7 +219,7 @@ static void handle_offer_source_destroyed(struct wl_listener *listener,
offer->source = NULL;
}
static struct wlr_data_offer *wlr_data_source_send_offer(
static struct wlr_data_offer *data_source_send_offer(
struct wlr_data_source *source,
struct wlr_seat_client *target) {
if (wl_list_empty(&target->data_devices)) {
@ -268,7 +268,7 @@ void wlr_seat_client_send_selection(struct wlr_seat_client *seat_client) {
}
if (seat_client->seat->selection_source) {
struct wlr_data_offer *offer = wlr_data_source_send_offer(
struct wlr_data_offer *offer = data_source_send_offer(
seat_client->seat->selection_source, seat_client);
if (offer == NULL) {
return;
@ -375,7 +375,7 @@ static void handle_drag_seat_client_destroy(struct wl_listener *listener,
wl_list_remove(&drag->seat_client_destroy.link);
}
static void wlr_drag_set_focus(struct wlr_drag *drag,
static void drag_set_focus(struct wlr_drag *drag,
struct wlr_surface *surface, double sx, double sy) {
if (drag->focus == surface) {
return;
@ -420,7 +420,7 @@ static void wlr_drag_set_focus(struct wlr_drag *drag,
struct wl_resource *offer_resource = NULL;
if (drag->source) {
drag->source->accepted = false;
struct wlr_data_offer *offer = wlr_data_source_send_offer(drag->source,
struct wlr_data_offer *offer = data_source_send_offer(drag->source,
focus_client);
if (offer != NULL) {
data_offer_update_action(offer);
@ -454,7 +454,7 @@ static void wlr_drag_set_focus(struct wlr_drag *drag,
wlr_signal_emit_safe(&drag->events.focus, drag);
}
static void wlr_drag_end(struct wlr_drag *drag) {
static void drag_end(struct wlr_drag *drag) {
if (!drag->cancelling) {
drag->cancelling = true;
if (drag->is_pointer_grab) {
@ -468,7 +468,7 @@ static void wlr_drag_end(struct wlr_drag *drag) {
wl_list_remove(&drag->source_destroy.link);
}
wlr_drag_set_focus(drag, NULL, 0, 0);
drag_set_focus(drag, NULL, 0, 0);
if (drag->icon) {
drag->icon->mapped = false;
@ -484,7 +484,7 @@ static void wlr_drag_end(struct wlr_drag *drag) {
static void pointer_drag_enter(struct wlr_seat_pointer_grab *grab,
struct wlr_surface *surface, double sx, double sy) {
struct wlr_drag *drag = grab->data;
wlr_drag_set_focus(drag, surface, sx, sy);
drag_set_focus(drag, surface, sx, sy);
}
static void pointer_drag_motion(struct wlr_seat_pointer_grab *grab,
@ -540,7 +540,7 @@ static uint32_t pointer_drag_button(struct wlr_seat_pointer_grab *grab,
if (grab->seat->pointer_state.button_count == 0 &&
state == WL_POINTER_BUTTON_STATE_RELEASED) {
wlr_drag_end(drag);
drag_end(drag);
}
return 0;
@ -553,7 +553,7 @@ static void pointer_drag_axis(struct wlr_seat_pointer_grab *grab, uint32_t time,
static void pointer_drag_cancel(struct wlr_seat_pointer_grab *grab) {
struct wlr_drag *drag = grab->data;
wlr_drag_end(drag);
drag_end(drag);
}
static const struct wlr_pointer_grab_interface
@ -585,7 +585,7 @@ static void touch_drag_up(struct wlr_seat_touch_grab *grab, uint32_t time,
}
}
wlr_drag_end(drag);
drag_end(drag);
}
static void touch_drag_motion(struct wlr_seat_touch_grab *grab, uint32_t time,
@ -604,12 +604,12 @@ static void touch_drag_motion(struct wlr_seat_touch_grab *grab, uint32_t time,
static void touch_drag_enter(struct wlr_seat_touch_grab *grab, uint32_t time,
struct wlr_touch_point *point) {
struct wlr_drag *drag = grab->data;
wlr_drag_set_focus(drag, point->focus_surface, point->sx, point->sy);
drag_set_focus(drag, point->focus_surface, point->sx, point->sy);
}
static void touch_drag_cancel(struct wlr_seat_touch_grab *grab) {
struct wlr_drag *drag = grab->data;
wlr_drag_end(drag);
drag_end(drag);
}
static const struct wlr_touch_grab_interface
@ -641,7 +641,7 @@ static void keyboard_drag_modifiers(struct wlr_seat_keyboard_grab *grab,
static void keyboard_drag_cancel(struct wlr_seat_keyboard_grab *grab) {
struct wlr_drag *drag = grab->data;
wlr_drag_end(drag);
drag_end(drag);
}
static const struct wlr_keyboard_grab_interface
@ -660,10 +660,10 @@ static void drag_handle_icon_destroy(struct wl_listener *listener, void *data) {
static void drag_handle_drag_source_destroy(struct wl_listener *listener,
void *data) {
struct wlr_drag *drag = wl_container_of(listener, drag, source_destroy);
wlr_drag_end(drag);
drag_end(drag);
}
static void wlr_drag_icon_destroy(struct wlr_drag_icon *icon) {
static void drag_icon_destroy(struct wlr_drag_icon *icon) {
if (!icon) {
return;
}
@ -679,7 +679,7 @@ static void handle_drag_icon_surface_destroy(struct wl_listener *listener,
void *data) {
struct wlr_drag_icon *icon =
wl_container_of(listener, icon, surface_destroy);
wlr_drag_icon_destroy(icon);
drag_icon_destroy(icon);
}
static void handle_drag_icon_surface_commit(struct wlr_surface *surface,
@ -694,10 +694,10 @@ static void handle_drag_icon_seat_client_destroy(struct wl_listener *listener,
struct wlr_drag_icon *icon =
wl_container_of(listener, icon, seat_client_destroy);
wlr_drag_icon_destroy(icon);
drag_icon_destroy(icon);
}
static struct wlr_drag_icon *wlr_drag_icon_create(
static struct wlr_drag_icon *drag_icon_create(
struct wlr_surface *icon_surface, struct wlr_seat_client *client,
bool is_pointer, int32_t touch_id) {
struct wlr_drag_icon *icon = calloc(1, sizeof(struct wlr_drag_icon));
@ -780,7 +780,7 @@ static bool seat_client_start_drag(struct wlr_seat_client *client,
if (icon_surface) {
int32_t touch_id = (point ? point->touch_id : 0);
struct wlr_drag_icon *icon =
wlr_drag_icon_create(icon_surface, client, drag->is_pointer_grab,
drag_icon_create(icon_surface, client, drag->is_pointer_grab,
touch_id);
if (!icon) {
free(drag);
@ -817,7 +817,7 @@ static bool seat_client_start_drag(struct wlr_seat_client *client,
} else {
assert(point);
wlr_seat_touch_start_grab(seat, &drag->touch_grab);
wlr_drag_set_focus(drag, point->surface, point->sx, point->sy);
drag_set_focus(drag, point->surface, point->sx, point->sy);
}
seat->drag = drag; // TODO: unset this thing somewhere

View file

@ -8,9 +8,9 @@
#include "wayland-server.h"
#include "idle-inhibit-unstable-v1-protocol.h"
static struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl;
static const struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl;
static struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl;
static const struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl;
static struct wlr_idle_inhibit_manager_v1 *
wlr_idle_inhibit_manager_v1_from_resource(struct wl_resource *resource) {
@ -50,11 +50,11 @@ static void idle_inhibitor_v1_handle_destroy(struct wl_client *client,
wl_resource_destroy(manager_resource);
}
static struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl = {
static const struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl = {
.destroy = idle_inhibitor_v1_handle_destroy,
};
static void wlr_create_inhibitor(struct wl_client *client,
static void manager_create_inhibitor(struct wl_client *client,
struct wl_resource *resource, uint32_t id,
struct wl_resource *surface_resource) {
struct wlr_surface *surface = wlr_surface_from_resource(surface_resource);
@ -96,14 +96,14 @@ static void idle_inhibit_manager_v1_destroy(struct wl_resource *resource) {
wl_list_remove(wl_resource_get_link(resource));
}
static void idle_inhibit_manager_v1_handle_destroy(struct wl_client *client,
static void manager_destroy(struct wl_client *client,
struct wl_resource *manager_resource) {
wl_resource_destroy(manager_resource);
}
static struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl = {
.destroy = idle_inhibit_manager_v1_handle_destroy,
.create_inhibitor = wlr_create_inhibitor,
static const struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl = {
.destroy = manager_destroy,
.create_inhibitor = manager_create_inhibitor,
};
static void handle_display_destroy(struct wl_listener *listener, void *data) {

View file

@ -195,7 +195,7 @@ static void layer_surface_resource_destroy(struct wl_resource *resource) {
}
}
static bool wlr_layer_surface_state_changed(struct wlr_layer_surface *surface) {
static bool layer_surface_state_changed(struct wlr_layer_surface *surface) {
struct wlr_layer_surface_state *state;
if (wl_list_empty(&surface->configure_list)) {
if (surface->acked_configure) {
@ -220,7 +220,7 @@ void wlr_layer_surface_configure(struct wlr_layer_surface *surface,
uint32_t width, uint32_t height) {
surface->server_pending.actual_width = width;
surface->server_pending.actual_height = height;
if (wlr_layer_surface_state_changed(surface)) {
if (layer_surface_state_changed(surface)) {
struct wl_display *display =
wl_client_get_display(wl_resource_get_client(surface->resource));
struct wlr_layer_surface_configure *configure =
@ -249,7 +249,7 @@ void wlr_layer_surface_close(struct wlr_layer_surface *surface) {
zwlr_layer_surface_v1_send_closed(surface->resource);
}
static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
static void handle_surface_committed(struct wlr_surface *wlr_surface,
void *role_data) {
struct wlr_layer_surface *surface = role_data;
@ -372,7 +372,7 @@ static void layer_shell_handle_get_layer_surface(struct wl_client *wl_client,
wl_signal_init(&surface->events.new_popup);
wlr_surface_set_role_committed(surface->surface,
handle_wlr_surface_committed, surface);
handle_surface_committed, surface);
wlr_log(L_DEBUG, "new layer_surface %p (res %p)",
surface, surface->resource);

View file

@ -48,7 +48,7 @@ static void wl_output_send_to_resource(struct wl_resource *resource) {
}
}
static void wlr_output_send_current_mode_to_resource(
static void output_send_current_mode_to_resource(
struct wl_resource *resource) {
struct wlr_output *output = wlr_output_from_resource(resource);
const uint32_t version = wl_resource_get_version(resource);
@ -138,7 +138,7 @@ void wlr_output_update_enabled(struct wlr_output *output, bool enabled) {
wlr_signal_emit_safe(&output->events.enable, output);
}
static void wlr_output_update_matrix(struct wlr_output *output) {
static void output_update_matrix(struct wlr_output *output) {
wlr_matrix_projection(output->transform_matrix, output->width,
output->height, output->transform);
}
@ -185,13 +185,13 @@ void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
output->width = width;
output->height = height;
wlr_output_update_matrix(output);
output_update_matrix(output);
output->refresh = refresh;
struct wl_resource *resource;
wl_resource_for_each(resource, &output->wl_resources) {
wlr_output_send_current_mode_to_resource(resource);
output_send_current_mode_to_resource(resource);
}
wlr_signal_emit_safe(&output->events.mode, output);
@ -200,7 +200,7 @@ void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
void wlr_output_set_transform(struct wlr_output *output,
enum wl_output_transform transform) {
output->impl->transform(output, transform);
wlr_output_update_matrix(output);
output_update_matrix(output);
// TODO: only send geometry and done
struct wl_resource *resource;

View file

@ -45,7 +45,7 @@ struct wlr_output_layout *wlr_output_layout_create() {
return layout;
}
static void wlr_output_layout_output_destroy(
static void output_layout_output_destroy(
struct wlr_output_layout_output *l_output) {
wlr_signal_emit_safe(&l_output->events.destroy, l_output);
wlr_output_destroy_global(l_output->output);
@ -67,14 +67,14 @@ void wlr_output_layout_destroy(struct wlr_output_layout *layout) {
struct wlr_output_layout_output *l_output, *temp;
wl_list_for_each_safe(l_output, temp, &layout->outputs, link) {
wlr_output_layout_output_destroy(l_output);
output_layout_output_destroy(l_output);
}
free(layout->state);
free(layout);
}
static struct wlr_box *wlr_output_layout_output_get_box(
static struct wlr_box *output_layout_output_get_box(
struct wlr_output_layout_output *l_output) {
l_output->state->_box.x = l_output->x;
l_output->state->_box.y = l_output->y;
@ -92,7 +92,7 @@ static struct wlr_box *wlr_output_layout_output_get_box(
* Auto configured outputs are placed to the right of the north east corner of
* the rightmost output in the layout in a horizontal line.
*/
static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
static void output_layout_reconfigure(struct wlr_output_layout *layout) {
int max_x = INT_MIN;
int max_x_y = INT_MIN; // y value for the max_x output
@ -104,7 +104,7 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
continue;
}
struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
struct wlr_box *box = output_layout_output_get_box(l_output);
if (box->x + box->width > max_x) {
max_x = box->x + box->width;
max_x_y = box->y;
@ -121,7 +121,7 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
if (!l_output->state->auto_configured) {
continue;
}
struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
struct wlr_box *box = output_layout_output_get_box(l_output);
l_output->x = max_x;
l_output->y = max_x_y;
max_x += box->width;
@ -137,30 +137,30 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
static void handle_output_mode(struct wl_listener *listener, void *data) {
struct wlr_output_layout_output_state *state =
wl_container_of(listener, state, mode);
wlr_output_layout_reconfigure(state->layout);
output_layout_reconfigure(state->layout);
}
static void handle_output_scale(struct wl_listener *listener, void *data) {
struct wlr_output_layout_output_state *state =
wl_container_of(listener, state, scale);
wlr_output_layout_reconfigure(state->layout);
output_layout_reconfigure(state->layout);
}
static void handle_output_transform(struct wl_listener *listener, void *data) {
struct wlr_output_layout_output_state *state =
wl_container_of(listener, state, transform);
wlr_output_layout_reconfigure(state->layout);
output_layout_reconfigure(state->layout);
}
static void handle_output_destroy(struct wl_listener *listener, void *data) {
struct wlr_output_layout_output_state *state =
wl_container_of(listener, state, output_destroy);
struct wlr_output_layout *layout = state->layout;
wlr_output_layout_output_destroy(state->l_output);
wlr_output_layout_reconfigure(layout);
output_layout_output_destroy(state->l_output);
output_layout_reconfigure(layout);
}
static struct wlr_output_layout_output *wlr_output_layout_output_create(
static struct wlr_output_layout_output *output_layout_output_create(
struct wlr_output_layout *layout, struct wlr_output *output) {
struct wlr_output_layout_output *l_output =
calloc(1, sizeof(struct wlr_output_layout_output));
@ -195,7 +195,7 @@ void wlr_output_layout_add(struct wlr_output_layout *layout,
struct wlr_output_layout_output *l_output =
wlr_output_layout_get(layout, output);
if (!l_output) {
l_output = wlr_output_layout_output_create(layout, output);
l_output = output_layout_output_create(layout, output);
if (!l_output) {
wlr_log(L_ERROR, "Failed to create wlr_output_layout_output");
return;
@ -204,7 +204,7 @@ void wlr_output_layout_add(struct wlr_output_layout *layout,
l_output->x = lx;
l_output->y = ly;
l_output->state->auto_configured = false;
wlr_output_layout_reconfigure(layout);
output_layout_reconfigure(layout);
wlr_output_create_global(output);
wlr_signal_emit_safe(&layout->events.add, l_output);
}
@ -225,7 +225,7 @@ bool wlr_output_layout_contains_point(struct wlr_output_layout *layout,
if (reference) {
struct wlr_output_layout_output *l_output =
wlr_output_layout_get(layout, reference);
struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
struct wlr_box *box = output_layout_output_get_box(l_output);
return wlr_box_contains_point(box, lx, ly);
} else {
return !!wlr_output_layout_output_at(layout, lx, ly);
@ -240,7 +240,7 @@ bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
struct wlr_output_layout_output *l_output;
wl_list_for_each(l_output, &layout->outputs, link) {
struct wlr_box *output_box =
wlr_output_layout_output_get_box(l_output);
output_layout_output_get_box(l_output);
if (wlr_box_intersection(output_box, target_lbox, &out_box)) {
return true;
}
@ -253,7 +253,7 @@ bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
return false;
}
struct wlr_box *output_box = wlr_output_layout_output_get_box(l_output);
struct wlr_box *output_box = output_layout_output_get_box(l_output);
return wlr_box_intersection(output_box, target_lbox, &out_box);
}
}
@ -262,7 +262,7 @@ struct wlr_output *wlr_output_layout_output_at(struct wlr_output_layout *layout,
double lx, double ly) {
struct wlr_output_layout_output *l_output;
wl_list_for_each(l_output, &layout->outputs, link) {
struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
struct wlr_box *box = output_layout_output_get_box(l_output);
if (wlr_box_contains_point(box, lx, ly)) {
return l_output->output;
}
@ -278,7 +278,7 @@ void wlr_output_layout_move(struct wlr_output_layout *layout,
l_output->x = lx;
l_output->y = ly;
l_output->state->auto_configured = false;
wlr_output_layout_reconfigure(layout);
output_layout_reconfigure(layout);
} else {
wlr_log(L_ERROR, "output not found in this layout: %s", output->name);
}
@ -289,8 +289,8 @@ void wlr_output_layout_remove(struct wlr_output_layout *layout,
struct wlr_output_layout_output *l_output =
wlr_output_layout_get(layout, output);
if (l_output) {
wlr_output_layout_output_destroy(l_output);
wlr_output_layout_reconfigure(layout);
output_layout_output_destroy(l_output);
output_layout_reconfigure(layout);
}
}
@ -325,7 +325,7 @@ void wlr_output_layout_closest_point(struct wlr_output_layout *layout,
}
double output_x, output_y, output_distance;
struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
struct wlr_box *box = output_layout_output_get_box(l_output);
wlr_box_closest_point(box, lx, ly, &output_x, &output_y);
// calculate squared distance suitable for comparison
@ -359,7 +359,7 @@ struct wlr_box *wlr_output_layout_get_box(
l_output = wlr_output_layout_get(layout, reference);
if (l_output) {
return wlr_output_layout_output_get_box(l_output);
return output_layout_output_get_box(l_output);
} else {
return NULL;
}
@ -368,7 +368,7 @@ struct wlr_box *wlr_output_layout_get_box(
int min_x = INT_MAX, min_y = INT_MAX;
int max_x = INT_MIN, max_y = INT_MIN;
wl_list_for_each(l_output, &layout->outputs, link) {
struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
struct wlr_box *box = output_layout_output_get_box(l_output);
if (box->x < min_x) {
min_x = box->x;
@ -400,7 +400,7 @@ void wlr_output_layout_add_auto(struct wlr_output_layout *layout,
struct wlr_output_layout_output *l_output =
wlr_output_layout_get(layout, output);
if (!l_output) {
l_output = wlr_output_layout_output_create(layout, output);
l_output = output_layout_output_create(layout, output);
if (!l_output) {
wlr_log(L_ERROR, "Failed to create wlr_output_layout_output");
return;
@ -408,7 +408,7 @@ void wlr_output_layout_add_auto(struct wlr_output_layout *layout,
}
l_output->state->auto_configured = true;
wlr_output_layout_reconfigure(layout);
output_layout_reconfigure(layout);
wlr_output_create_global(output);
wlr_signal_emit_safe(&layout->events.add, l_output);
}
@ -445,7 +445,7 @@ struct wlr_output *wlr_output_layout_adjacent_output(
if (reference != NULL && reference == l_output->output) {
continue;
}
struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
struct wlr_box *box = output_layout_output_get_box(l_output);
bool match = false;
// test to make sure this output is in the given direction

View file

@ -185,7 +185,7 @@ static void wl_seat_get_touch(struct wl_client *client,
wl_list_insert(&seat_client->touches, wl_resource_get_link(resource));
}
static void wlr_seat_client_resource_destroy(struct wl_resource *seat_resource) {
static void seat_client_resource_destroy(struct wl_resource *seat_resource) {
struct wlr_seat_client *client =
wlr_seat_client_from_resource(seat_resource);
wlr_signal_emit_safe(&client->events.destroy, client);
@ -251,7 +251,7 @@ static void wl_seat_bind(struct wl_client *client, void *_wlr_seat,
wl_list_init(&seat_client->data_devices);
wl_list_init(&seat_client->primary_selection_devices);
wl_resource_set_implementation(seat_client->wl_resource, &wl_seat_impl,
seat_client, wlr_seat_client_resource_destroy);
seat_client, seat_client_resource_destroy);
wl_list_insert(&wlr_seat->clients, &seat_client->link);
if (version >= WL_SEAT_NAME_SINCE_VERSION) {
wl_seat_send_name(seat_client->wl_resource, wlr_seat->name);

View file

@ -11,7 +11,7 @@
#include <wlr/util/region.h>
#include "util/signal.h"
static void wlr_surface_state_reset_buffer(struct wlr_surface_state *state) {
static void surface_state_reset_buffer(struct wlr_surface_state *state) {
if (state->buffer) {
wl_list_remove(&state->buffer_destroy_listener.link);
state->buffer = NULL;
@ -26,7 +26,7 @@ static void buffer_destroy(struct wl_listener *listener, void *data) {
state->buffer = NULL;
}
static void wlr_surface_state_release_buffer(struct wlr_surface_state *state) {
static void surface_state_release_buffer(struct wlr_surface_state *state) {
if (state->buffer) {
wl_resource_post_event(state->buffer, WL_BUFFER_RELEASE);
wl_list_remove(&state->buffer_destroy_listener.link);
@ -34,7 +34,7 @@ static void wlr_surface_state_release_buffer(struct wlr_surface_state *state) {
}
}
static void wlr_surface_state_set_buffer(struct wlr_surface_state *state,
static void surface_state_set_buffer(struct wlr_surface_state *state,
struct wl_resource *buffer) {
state->buffer = buffer;
if (buffer) {
@ -57,8 +57,8 @@ static void surface_attach(struct wl_client *client,
surface->pending->invalid |= WLR_SURFACE_INVALID_BUFFER;
surface->pending->sx = sx;
surface->pending->sy = sy;
wlr_surface_state_reset_buffer(surface->pending);
wlr_surface_state_set_buffer(surface->pending, buffer);
surface_state_reset_buffer(surface->pending);
surface_state_set_buffer(surface->pending, buffer);
}
static void surface_damage(struct wl_client *client,
@ -143,7 +143,7 @@ static void surface_set_input_region(struct wl_client *client,
}
}
static bool wlr_surface_update_size(struct wlr_surface *surface,
static bool surface_update_size(struct wlr_surface *surface,
struct wlr_surface_state *state) {
if (!state->buffer) {
pixman_region32_union_rect(&state->surface_damage,
@ -207,7 +207,7 @@ static bool wlr_surface_update_size(struct wlr_surface *surface,
/**
* Append pending state to current state and clear pending state.
*/
static void wlr_surface_move_state(struct wlr_surface *surface,
static void surface_move_state(struct wlr_surface *surface,
struct wlr_surface_state *next, struct wlr_surface_state *state) {
bool update_damage = false;
bool update_size = false;
@ -224,15 +224,15 @@ static void wlr_surface_move_state(struct wlr_surface *surface,
update_size = true;
}
if ((next->invalid & WLR_SURFACE_INVALID_BUFFER)) {
wlr_surface_state_release_buffer(state);
wlr_surface_state_set_buffer(state, next->buffer);
wlr_surface_state_reset_buffer(next);
surface_state_release_buffer(state);
surface_state_set_buffer(state, next->buffer);
surface_state_reset_buffer(next);
state->sx = next->sx;
state->sy = next->sy;
update_size = true;
}
if (update_size) {
update_damage = wlr_surface_update_size(surface, state);
update_damage = surface_update_size(surface, state);
}
if ((next->invalid & WLR_SURFACE_INVALID_SURFACE_DAMAGE)) {
pixman_region32_intersect_rect(&next->surface_damage,
@ -312,7 +312,7 @@ static void wlr_surface_move_state(struct wlr_surface *surface,
next->invalid = 0;
}
static void wlr_surface_damage_subsurfaces(struct wlr_subsurface *subsurface) {
static void surface_damage_subsurfaces(struct wlr_subsurface *subsurface) {
// XXX: This is probably the wrong way to do it, because this damage should
// come from the client, but weston doesn't do it correctly either and it
// seems to work ok. See the comment on weston_surface_damage for more info
@ -327,11 +327,11 @@ static void wlr_surface_damage_subsurfaces(struct wlr_subsurface *subsurface) {
struct wlr_subsurface *child;
wl_list_for_each(child, &subsurface->surface->subsurfaces, parent_link) {
wlr_surface_damage_subsurfaces(child);
surface_damage_subsurfaces(child);
}
}
static void wlr_surface_apply_damage(struct wlr_surface *surface,
static void surface_apply_damage(struct wlr_surface *surface,
bool invalid_buffer, bool reupload_buffer) {
struct wl_resource *resource = surface->current->buffer;
if (resource == NULL) {
@ -392,17 +392,17 @@ static void wlr_surface_apply_damage(struct wlr_surface *surface,
}
}
wlr_surface_state_release_buffer(surface->current);
surface_state_release_buffer(surface->current);
}
static void wlr_surface_commit_pending(struct wlr_surface *surface) {
static void surface_commit_pending(struct wlr_surface *surface) {
int32_t oldw = surface->current->buffer_width;
int32_t oldh = surface->current->buffer_height;
bool invalid_buffer = surface->pending->invalid & WLR_SURFACE_INVALID_BUFFER;
bool null_buffer_commit = invalid_buffer && surface->pending->buffer == NULL;
wlr_surface_move_state(surface, surface->pending, surface->current);
surface_move_state(surface, surface->pending, surface->current);
if (null_buffer_commit) {
wlr_texture_destroy(surface->texture);
@ -411,7 +411,7 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) {
bool reupload_buffer = oldw != surface->current->buffer_width ||
oldh != surface->current->buffer_height;
wlr_surface_apply_damage(surface, invalid_buffer, reupload_buffer);
surface_apply_damage(surface, invalid_buffer, reupload_buffer);
// commit subsurface order
struct wlr_subsurface *subsurface;
@ -422,7 +422,7 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) {
if (subsurface->reordered) {
// TODO: damage all the subsurfaces
wlr_surface_damage_subsurfaces(subsurface);
surface_damage_subsurfaces(subsurface);
}
}
@ -437,7 +437,7 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) {
pixman_region32_clear(&surface->current->buffer_damage);
}
static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) {
static bool subsurface_is_synchronized(struct wlr_subsurface *subsurface) {
while (1) {
if (subsurface->synchronized) {
return true;
@ -459,43 +459,43 @@ static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) {
/**
* Recursive function to commit the effectively synchronized children.
*/
static void wlr_subsurface_parent_commit(struct wlr_subsurface *subsurface,
static void subsurface_parent_commit(struct wlr_subsurface *subsurface,
bool synchronized) {
struct wlr_surface *surface = subsurface->surface;
if (synchronized || subsurface->synchronized) {
if (subsurface->has_cache) {
wlr_surface_move_state(surface, subsurface->cached, surface->pending);
wlr_surface_commit_pending(surface);
surface_move_state(surface, subsurface->cached, surface->pending);
surface_commit_pending(surface);
subsurface->has_cache = false;
subsurface->cached->invalid = 0;
}
struct wlr_subsurface *tmp;
wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
wlr_subsurface_parent_commit(tmp, true);
subsurface_parent_commit(tmp, true);
}
}
}
static void wlr_subsurface_commit(struct wlr_subsurface *subsurface) {
static void subsurface_commit(struct wlr_subsurface *subsurface) {
struct wlr_surface *surface = subsurface->surface;
if (wlr_subsurface_is_synchronized(subsurface)) {
wlr_surface_move_state(surface, surface->pending, subsurface->cached);
if (subsurface_is_synchronized(subsurface)) {
surface_move_state(surface, surface->pending, subsurface->cached);
subsurface->has_cache = true;
} else {
if (subsurface->has_cache) {
wlr_surface_move_state(surface, subsurface->cached, surface->pending);
wlr_surface_commit_pending(surface);
surface_move_state(surface, subsurface->cached, surface->pending);
surface_commit_pending(surface);
subsurface->has_cache = false;
} else {
wlr_surface_commit_pending(surface);
surface_commit_pending(surface);
}
struct wlr_subsurface *tmp;
wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
wlr_subsurface_parent_commit(tmp, false);
subsurface_parent_commit(tmp, false);
}
}
}
@ -507,15 +507,15 @@ static void surface_commit(struct wl_client *client,
if (wlr_surface_is_subsurface(surface)) {
struct wlr_subsurface *subsurface =
wlr_subsurface_from_surface(surface);
wlr_subsurface_commit(subsurface);
subsurface_commit(subsurface);
return;
}
wlr_surface_commit_pending(surface);
surface_commit_pending(surface);
struct wlr_subsurface *tmp;
wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
wlr_subsurface_parent_commit(tmp, false);
subsurface_parent_commit(tmp, false);
}
}
@ -567,7 +567,7 @@ struct wlr_surface *wlr_surface_from_resource(struct wl_resource *resource) {
return wl_resource_get_user_data(resource);
}
static struct wlr_surface_state *wlr_surface_state_create() {
static struct wlr_surface_state *surface_state_create() {
struct wlr_surface_state *state =
calloc(1, sizeof(struct wlr_surface_state));
if (state == NULL) {
@ -588,8 +588,8 @@ static struct wlr_surface_state *wlr_surface_state_create() {
return state;
}
static void wlr_surface_state_destroy(struct wlr_surface_state *state) {
wlr_surface_state_reset_buffer(state);
static void surface_state_destroy(struct wlr_surface_state *state) {
surface_state_reset_buffer(state);
struct wlr_frame_callback *cb, *tmp;
wl_list_for_each_safe(cb, tmp, &state->frame_callback_list, link) {
wl_resource_destroy(cb->resource);
@ -607,7 +607,7 @@ static void subsurface_destroy(struct wlr_subsurface *subsurface) {
wlr_signal_emit_safe(&subsurface->events.destroy, subsurface);
wl_list_remove(&subsurface->surface_destroy.link);
wlr_surface_state_destroy(subsurface->cached);
surface_state_destroy(subsurface->cached);
if (subsurface->parent) {
wl_list_remove(&subsurface->parent_link);
@ -628,8 +628,8 @@ static void destroy_surface(struct wl_resource *resource) {
wlr_signal_emit_safe(&surface->events.destroy, surface);
wlr_texture_destroy(surface->texture);
wlr_surface_state_destroy(surface->pending);
wlr_surface_state_destroy(surface->current);
surface_state_destroy(surface->pending);
surface_state_destroy(surface->current);
free(surface);
}
@ -645,8 +645,8 @@ struct wlr_surface *wlr_surface_create(struct wl_resource *res,
surface->renderer = renderer;
surface->resource = res;
surface->current = wlr_surface_state_create();
surface->pending = wlr_surface_state_create();
surface->current = surface_state_create();
surface->pending = surface_state_create();
wl_signal_init(&surface->events.commit);
wl_signal_init(&surface->events.destroy);
@ -794,9 +794,9 @@ static void subsurface_set_desync(struct wl_client *client,
if (subsurface && subsurface->synchronized) {
subsurface->synchronized = false;
if (!wlr_subsurface_is_synchronized(subsurface)) {
if (!subsurface_is_synchronized(subsurface)) {
// TODO: do a synchronized commit to flush the cache
wlr_subsurface_parent_commit(subsurface, true);
subsurface_parent_commit(subsurface, true);
}
}
}
@ -837,7 +837,7 @@ void wlr_surface_make_subsurface(struct wlr_surface *surface,
wl_client_post_no_memory(client);
return;
}
subsurface->cached = wlr_surface_state_create();
subsurface->cached = surface_state_create();
if (subsurface->cached == NULL) {
free(subsurface);
wl_client_post_no_memory(client);
@ -860,7 +860,7 @@ void wlr_surface_make_subsurface(struct wlr_surface *surface,
subsurface->resource =
wl_resource_create(client, &wl_subsurface_interface, 1, id);
if (subsurface->resource == NULL) {
wlr_surface_state_destroy(subsurface->cached);
surface_state_destroy(subsurface->cached);
free(subsurface);
wl_client_post_no_memory(client);
return;

View file

@ -461,13 +461,13 @@ static void shell_surface_resource_destroy(struct wl_resource *resource) {
}
}
static void handle_wlr_surface_destroyed(struct wl_listener *listener,
static void shell_surface_handle_surface_destroy(struct wl_listener *listener,
void *data) {
struct wlr_wl_shell_surface *surface =
wl_container_of(listener, surface, surface_destroy_listener);
shell_surface_destroy(surface);
}
static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
static void handle_surface_committed(struct wlr_surface *wlr_surface,
void *role_data) {
struct wlr_wl_shell_surface *surface = role_data;
if (!surface->configured &&
@ -556,9 +556,10 @@ static void shell_protocol_get_shell_surface(struct wl_client *client,
wl_signal_add(&wl_surface->surface->events.destroy,
&wl_surface->surface_destroy_listener);
wl_surface->surface_destroy_listener.notify = handle_wlr_surface_destroyed;
wl_surface->surface_destroy_listener.notify =
shell_surface_handle_surface_destroy;
wlr_surface_set_role_committed(surface, handle_wlr_surface_committed,
wlr_surface_set_role_committed(surface, handle_surface_committed,
wl_surface);
struct wl_display *display = wl_client_get_display(client);

View file

@ -122,7 +122,7 @@ static const struct wlr_keyboard_grab_interface xdg_keyboard_grab_impl = {
static void xdg_surface_destroy(struct wlr_xdg_surface *surface);
static void wlr_xdg_popup_grab_handle_seat_destroy(
static void xdg_popup_grab_handle_seat_destroy(
struct wl_listener *listener, void *data) {
struct wlr_xdg_popup_grab *xdg_grab =
wl_container_of(listener, xdg_grab, seat_destroy);
@ -162,7 +162,7 @@ static struct wlr_xdg_popup_grab *xdg_shell_popup_grab_from_seat(
wl_list_insert(&shell->popup_grabs, &xdg_grab->link);
xdg_grab->seat = seat;
xdg_grab->seat_destroy.notify = wlr_xdg_popup_grab_handle_seat_destroy;
xdg_grab->seat_destroy.notify = xdg_popup_grab_handle_seat_destroy;
wl_signal_add(&seat->events.destroy, &xdg_grab->seat_destroy);
return xdg_grab;
@ -910,7 +910,7 @@ static void xdg_surface_handle_get_toplevel(struct wl_client *client,
xdg_toplevel_resource_destroy);
}
static void wlr_xdg_toplevel_ack_configure(
static void xdg_toplevel_ack_configure(
struct wlr_xdg_surface *surface,
struct wlr_xdg_surface_configure *configure) {
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
@ -961,7 +961,7 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client,
assert(0 && "not reached");
break;
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
wlr_xdg_toplevel_ack_configure(surface, configure);
xdg_toplevel_ack_configure(surface, configure);
break;
case WLR_XDG_SURFACE_ROLE_POPUP:
break;
@ -1013,7 +1013,7 @@ static const struct xdg_surface_interface xdg_surface_implementation = {
.set_window_geometry = xdg_surface_handle_set_window_geometry,
};
static bool wlr_xdg_surface_toplevel_state_compare(
static bool xdg_surface_toplevel_state_compare(
struct wlr_xdg_toplevel *state) {
struct {
struct wlr_xdg_toplevel_state state;
@ -1063,7 +1063,7 @@ static bool wlr_xdg_surface_toplevel_state_compare(
return false;
}
static void wlr_xdg_toplevel_send_configure(
static void toplevel_send_configure(
struct wlr_xdg_surface *surface,
struct wlr_xdg_surface_configure *configure) {
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
@ -1125,7 +1125,7 @@ error_out:
wl_resource_post_no_memory(surface->toplevel->resource);
}
static void wlr_xdg_surface_send_configure(void *user_data) {
static void surface_send_configure(void *user_data) {
struct wlr_xdg_surface *surface = user_data;
surface->configure_idle = NULL;
@ -1145,7 +1145,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
assert(0 && "not reached");
break;
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
wlr_xdg_toplevel_send_configure(surface, configure);
toplevel_send_configure(surface, configure);
break;
case WLR_XDG_SURFACE_ROLE_POPUP:
xdg_popup_send_configure(surface->popup->resource,
@ -1159,7 +1159,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
xdg_surface_send_configure(surface->resource, configure->serial);
}
static uint32_t wlr_xdg_surface_schedule_configure(
static uint32_t xdg_surface_schedule_configure(
struct wlr_xdg_surface *surface) {
struct wl_display *display = wl_client_get_display(surface->client->client);
struct wl_event_loop *loop = wl_display_get_event_loop(display);
@ -1171,7 +1171,7 @@ static uint32_t wlr_xdg_surface_schedule_configure(
break;
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
pending_same =
wlr_xdg_surface_toplevel_state_compare(surface->toplevel);
xdg_surface_toplevel_state_compare(surface->toplevel);
break;
case WLR_XDG_SURFACE_ROLE_POPUP:
break;
@ -1195,26 +1195,26 @@ static uint32_t wlr_xdg_surface_schedule_configure(
surface->configure_next_serial = wl_display_next_serial(display);
surface->configure_idle = wl_event_loop_add_idle(loop,
wlr_xdg_surface_send_configure, surface);
surface_send_configure, surface);
return surface->configure_next_serial;
}
}
static void handle_wlr_surface_destroyed(struct wl_listener *listener,
static void xdg_surface_handle_surface_destroy(struct wl_listener *listener,
void *data) {
struct wlr_xdg_surface *xdg_surface =
wl_container_of(listener, xdg_surface, surface_destroy_listener);
xdg_surface_destroy(xdg_surface);
}
static void wlr_xdg_surface_toplevel_committed(
static void xdg_surface_toplevel_committed(
struct wlr_xdg_surface *surface) {
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
if (!surface->toplevel->added) {
// on the first commit, send a configure request to tell the client it
// is added
wlr_xdg_surface_schedule_configure(surface);
xdg_surface_schedule_configure(surface);
surface->toplevel->added = true;
return;
}
@ -1230,7 +1230,7 @@ static void wlr_xdg_surface_toplevel_committed(
surface->toplevel->client_pending.min_height;
}
static void wlr_xdg_surface_popup_committed(
static void xdg_surface_popup_committed(
struct wlr_xdg_surface *surface) {
assert(surface->role == WLR_XDG_SURFACE_ROLE_POPUP);
@ -1242,12 +1242,12 @@ static void wlr_xdg_surface_popup_committed(
}
if (!surface->popup->committed) {
wlr_xdg_surface_schedule_configure(surface);
xdg_surface_schedule_configure(surface);
surface->popup->committed = true;
}
}
static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
static void handle_surface_committed(struct wlr_surface *wlr_surface,
void *role_data) {
struct wlr_xdg_surface *surface = role_data;
@ -1273,10 +1273,10 @@ static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
"xdg_surface must have a role");
break;
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
wlr_xdg_surface_toplevel_committed(surface);
xdg_surface_toplevel_committed(surface);
break;
case WLR_XDG_SURFACE_ROLE_POPUP:
wlr_xdg_surface_popup_committed(surface);
xdg_surface_popup_committed(surface);
break;
}
@ -1350,10 +1350,11 @@ static void xdg_shell_handle_get_xdg_surface(struct wl_client *wl_client,
wl_signal_add(&surface->surface->events.destroy,
&surface->surface_destroy_listener);
surface->surface_destroy_listener.notify = handle_wlr_surface_destroyed;
surface->surface_destroy_listener.notify =
xdg_surface_handle_surface_destroy;
wlr_surface_set_role_committed(surface->surface,
handle_wlr_surface_committed, surface);
handle_surface_committed, surface);
wlr_log(L_DEBUG, "new xdg_surface %p (res %p)", surface, surface->resource);
wl_resource_set_implementation(surface->resource,
@ -1394,7 +1395,7 @@ static const struct xdg_wm_base_interface xdg_shell_impl = {
.pong = xdg_shell_handle_pong,
};
static void wlr_xdg_client_destroy(struct wl_resource *resource) {
static void xdg_client_handle_resource_destroy(struct wl_resource *resource) {
struct wlr_xdg_client *client = xdg_client_from_resource(resource);
struct wlr_xdg_surface *surface, *tmp = NULL;
@ -1410,7 +1411,7 @@ static void wlr_xdg_client_destroy(struct wl_resource *resource) {
free(client);
}
static int wlr_xdg_client_ping_timeout(void *user_data) {
static int xdg_client_ping_timeout(void *user_data) {
struct wlr_xdg_client *client = user_data;
struct wlr_xdg_surface *surface;
@ -1447,13 +1448,13 @@ static void xdg_shell_bind(struct wl_client *wl_client, void *data,
client->shell = xdg_shell;
wl_resource_set_implementation(client->resource, &xdg_shell_impl, client,
wlr_xdg_client_destroy);
xdg_client_handle_resource_destroy);
wl_list_insert(&xdg_shell->clients, &client->link);
struct wl_display *display = wl_client_get_display(client->client);
struct wl_event_loop *loop = wl_display_get_event_loop(display);
client->ping_timer = wl_event_loop_add_timer(loop,
wlr_xdg_client_ping_timeout, client);
xdg_client_ping_timeout, client);
if (client->ping_timer == NULL) {
wl_client_post_no_memory(client->client);
}
@ -1522,7 +1523,7 @@ uint32_t wlr_xdg_toplevel_set_size(struct wlr_xdg_surface *surface,
surface->toplevel->server_pending.width = width;
surface->toplevel->server_pending.height = height;
return wlr_xdg_surface_schedule_configure(surface);
return xdg_surface_schedule_configure(surface);
}
uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_surface *surface,
@ -1530,7 +1531,7 @@ uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_surface *surface,
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
surface->toplevel->server_pending.activated = activated;
return wlr_xdg_surface_schedule_configure(surface);
return xdg_surface_schedule_configure(surface);
}
uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_surface *surface,
@ -1538,7 +1539,7 @@ uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_surface *surface,
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
surface->toplevel->server_pending.maximized = maximized;
return wlr_xdg_surface_schedule_configure(surface);
return xdg_surface_schedule_configure(surface);
}
uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_surface *surface,
@ -1546,7 +1547,7 @@ uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_surface *surface,
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
surface->toplevel->server_pending.fullscreen = fullscreen;
return wlr_xdg_surface_schedule_configure(surface);
return xdg_surface_schedule_configure(surface);
}
uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface,
@ -1554,7 +1555,7 @@ uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface,
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
surface->toplevel->server_pending.resizing = resizing;
return wlr_xdg_surface_schedule_configure(surface);
return xdg_surface_schedule_configure(surface);
}
void wlr_xdg_surface_send_close(struct wlr_xdg_surface *surface) {
@ -1669,7 +1670,7 @@ void wlr_xdg_popup_get_toplevel_coords(struct wlr_xdg_popup *popup,
}
static void wlr_xdg_popup_box_constraints(struct wlr_xdg_popup *popup,
static void xdg_popup_box_constraints(struct wlr_xdg_popup *popup,
struct wlr_box *toplevel_sx_box, int *offset_x, int *offset_y) {
int popup_width = popup->geometry.width;
int popup_height = popup->geometry.height;
@ -1697,10 +1698,10 @@ static void wlr_xdg_popup_box_constraints(struct wlr_xdg_popup *popup,
}
}
static bool wlr_xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
static bool xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
struct wlr_box *toplevel_sx_box) {
int offset_x = 0, offset_y = 0;
wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
xdg_popup_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
if (!offset_x && !offset_y) {
@ -1725,7 +1726,7 @@ static bool wlr_xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
popup->geometry =
wlr_xdg_positioner_get_geometry(&popup->positioner);
wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
xdg_popup_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
if (!offset_x && !offset_y) {
@ -1747,10 +1748,10 @@ static bool wlr_xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
return false;
}
static bool wlr_xdg_popup_unconstrain_slide(struct wlr_xdg_popup *popup,
static bool xdg_popup_unconstrain_slide(struct wlr_xdg_popup *popup,
struct wlr_box *toplevel_sx_box) {
int offset_x = 0, offset_y = 0;
wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
xdg_popup_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
if (!offset_x && !offset_y) {
@ -1784,16 +1785,16 @@ static bool wlr_xdg_popup_unconstrain_slide(struct wlr_xdg_popup *popup,
popup->geometry.y += toplevel_sx_box->y - toplevel_y;
}
wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
xdg_popup_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
return !offset_x && !offset_y;
}
static bool wlr_xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
static bool xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
struct wlr_box *toplevel_sx_box) {
int offset_x, offset_y;
wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
xdg_popup_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
if (!offset_x && !offset_y) {
@ -1815,7 +1816,7 @@ static bool wlr_xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
popup->geometry.height -= offset_y;
}
wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
xdg_popup_box_constraints(popup, toplevel_sx_box,
&offset_y, &offset_y);
return !offset_x && !offset_y;
@ -1823,13 +1824,13 @@ static bool wlr_xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
void wlr_xdg_popup_unconstrain_from_box(struct wlr_xdg_popup *popup,
struct wlr_box *toplevel_sx_box) {
if (wlr_xdg_popup_unconstrain_flip(popup, toplevel_sx_box)) {
if (xdg_popup_unconstrain_flip(popup, toplevel_sx_box)) {
return;
}
if (wlr_xdg_popup_unconstrain_slide(popup, toplevel_sx_box)) {
if (xdg_popup_unconstrain_slide(popup, toplevel_sx_box)) {
return;
}
if (wlr_xdg_popup_unconstrain_resize(popup, toplevel_sx_box)) {
if (xdg_popup_unconstrain_resize(popup, toplevel_sx_box)) {
return;
}
}

View file

@ -132,7 +132,7 @@ static const struct wlr_keyboard_grab_interface xdg_keyboard_grab_impl = {
static void xdg_surface_destroy(struct wlr_xdg_surface_v6 *surface);
static void wlr_xdg_popup_grab_handle_seat_destroy(
static void xdg_popup_grab_handle_seat_destroy(
struct wl_listener *listener, void *data) {
struct wlr_xdg_popup_grab_v6 *xdg_grab =
wl_container_of(listener, xdg_grab, seat_destroy);
@ -172,7 +172,7 @@ static struct wlr_xdg_popup_grab_v6 *xdg_shell_popup_grab_from_seat(
wl_list_insert(&shell->popup_grabs, &xdg_grab->link);
xdg_grab->seat = seat;
xdg_grab->seat_destroy.notify = wlr_xdg_popup_grab_handle_seat_destroy;
xdg_grab->seat_destroy.notify = xdg_popup_grab_handle_seat_destroy;
wl_signal_add(&seat->events.destroy, &xdg_grab->seat_destroy);
return xdg_grab;
@ -924,7 +924,7 @@ static void xdg_surface_handle_get_toplevel(struct wl_client *client,
xdg_toplevel_resource_destroy);
}
static void wlr_xdg_toplevel_v6_ack_configure(
static void xdg_toplevel_v6_ack_configure(
struct wlr_xdg_surface_v6 *surface,
struct wlr_xdg_surface_v6_configure *configure) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
@ -975,7 +975,7 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client,
assert(0 && "not reached");
break;
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
wlr_xdg_toplevel_v6_ack_configure(surface, configure);
xdg_toplevel_v6_ack_configure(surface, configure);
break;
case WLR_XDG_SURFACE_V6_ROLE_POPUP:
break;
@ -1027,7 +1027,7 @@ static const struct zxdg_surface_v6_interface zxdg_surface_v6_implementation = {
.set_window_geometry = xdg_surface_handle_set_window_geometry,
};
static bool wlr_xdg_surface_v6_toplevel_state_compare(
static bool xdg_surface_v6_toplevel_state_compare(
struct wlr_xdg_toplevel_v6 *state) {
struct {
struct wlr_xdg_toplevel_v6_state state;
@ -1077,7 +1077,7 @@ static bool wlr_xdg_surface_v6_toplevel_state_compare(
return false;
}
static void wlr_xdg_toplevel_v6_send_configure(
static void xdg_toplevel_v6_send_configure(
struct wlr_xdg_surface_v6 *surface,
struct wlr_xdg_surface_v6_configure *configure) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
@ -1143,7 +1143,7 @@ error_out:
wl_resource_post_no_memory(surface->toplevel->resource);
}
static void wlr_xdg_surface_send_configure(void *user_data) {
static void xdg_surface_send_configure(void *user_data) {
struct wlr_xdg_surface_v6 *surface = user_data;
surface->configure_idle = NULL;
@ -1163,7 +1163,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
assert(0 && "not reached");
break;
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
wlr_xdg_toplevel_v6_send_configure(surface, configure);
xdg_toplevel_v6_send_configure(surface, configure);
break;
case WLR_XDG_SURFACE_V6_ROLE_POPUP:
zxdg_popup_v6_send_configure(surface->popup->resource,
@ -1177,7 +1177,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
zxdg_surface_v6_send_configure(surface->resource, configure->serial);
}
static uint32_t wlr_xdg_surface_v6_schedule_configure(
static uint32_t xdg_surface_v6_schedule_configure(
struct wlr_xdg_surface_v6 *surface) {
struct wl_display *display = wl_client_get_display(surface->client->client);
struct wl_event_loop *loop = wl_display_get_event_loop(display);
@ -1189,7 +1189,7 @@ static uint32_t wlr_xdg_surface_v6_schedule_configure(
break;
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
pending_same =
wlr_xdg_surface_v6_toplevel_state_compare(surface->toplevel);
xdg_surface_v6_toplevel_state_compare(surface->toplevel);
break;
case WLR_XDG_SURFACE_V6_ROLE_POPUP:
break;
@ -1213,26 +1213,26 @@ static uint32_t wlr_xdg_surface_v6_schedule_configure(
surface->configure_next_serial = wl_display_next_serial(display);
surface->configure_idle = wl_event_loop_add_idle(loop,
wlr_xdg_surface_send_configure, surface);
xdg_surface_send_configure, surface);
return surface->configure_next_serial;
}
}
static void handle_wlr_surface_destroyed(struct wl_listener *listener,
static void xdg_surface_handle_surface_destroy(struct wl_listener *listener,
void *data) {
struct wlr_xdg_surface_v6 *xdg_surface =
wl_container_of(listener, xdg_surface, surface_destroy_listener);
xdg_surface_destroy(xdg_surface);
}
static void wlr_xdg_surface_v6_toplevel_committed(
static void xdg_surface_v6_toplevel_committed(
struct wlr_xdg_surface_v6 *surface) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
if (!surface->toplevel->added) {
// on the first commit, send a configure request to tell the client it
// is added
wlr_xdg_surface_v6_schedule_configure(surface);
xdg_surface_v6_schedule_configure(surface);
surface->toplevel->added = true;
return;
}
@ -1248,17 +1248,17 @@ static void wlr_xdg_surface_v6_toplevel_committed(
surface->toplevel->client_pending.min_height;
}
static void wlr_xdg_surface_v6_popup_committed(
static void xdg_surface_v6_popup_committed(
struct wlr_xdg_surface_v6 *surface) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP);
if (!surface->popup->committed) {
wlr_xdg_surface_v6_schedule_configure(surface);
xdg_surface_v6_schedule_configure(surface);
surface->popup->committed = true;
}
}
static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
static void handle_surface_committed(struct wlr_surface *wlr_surface,
void *role_data) {
struct wlr_xdg_surface_v6 *surface = role_data;
@ -1284,10 +1284,10 @@ static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
"xdg_surface must have a role");
break;
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
wlr_xdg_surface_v6_toplevel_committed(surface);
xdg_surface_v6_toplevel_committed(surface);
break;
case WLR_XDG_SURFACE_V6_ROLE_POPUP:
wlr_xdg_surface_v6_popup_committed(surface);
xdg_surface_v6_popup_committed(surface);
break;
}
@ -1361,10 +1361,11 @@ static void xdg_shell_handle_get_xdg_surface(struct wl_client *wl_client,
wl_signal_add(&surface->surface->events.destroy,
&surface->surface_destroy_listener);
surface->surface_destroy_listener.notify = handle_wlr_surface_destroyed;
surface->surface_destroy_listener.notify =
xdg_surface_handle_surface_destroy;
wlr_surface_set_role_committed(surface->surface,
handle_wlr_surface_committed, surface);
handle_surface_committed, surface);
wlr_log(L_DEBUG, "new xdg_surface %p (res %p)", surface, surface->resource);
wl_resource_set_implementation(surface->resource,
@ -1405,7 +1406,8 @@ static const struct zxdg_shell_v6_interface xdg_shell_impl = {
.pong = xdg_shell_handle_pong,
};
static void wlr_xdg_client_v6_destroy(struct wl_resource *resource) {
static void xdg_client_v6_handle_resource_destroy(
struct wl_resource *resource) {
struct wlr_xdg_client_v6 *client = xdg_client_from_resource(resource);
struct wlr_xdg_surface_v6 *surface, *tmp = NULL;
@ -1421,7 +1423,7 @@ static void wlr_xdg_client_v6_destroy(struct wl_resource *resource) {
free(client);
}
static int wlr_xdg_client_v6_ping_timeout(void *user_data) {
static int xdg_client_v6_ping_timeout(void *user_data) {
struct wlr_xdg_client_v6 *client = user_data;
struct wlr_xdg_surface_v6 *surface;
@ -1458,13 +1460,13 @@ static void xdg_shell_bind(struct wl_client *wl_client, void *data,
client->shell = xdg_shell;
wl_resource_set_implementation(client->resource, &xdg_shell_impl, client,
wlr_xdg_client_v6_destroy);
xdg_client_v6_handle_resource_destroy);
wl_list_insert(&xdg_shell->clients, &client->link);
struct wl_display *display = wl_client_get_display(client->client);
struct wl_event_loop *loop = wl_display_get_event_loop(display);
client->ping_timer = wl_event_loop_add_timer(loop,
wlr_xdg_client_v6_ping_timeout, client);
xdg_client_v6_ping_timeout, client);
if (client->ping_timer == NULL) {
wl_client_post_no_memory(client->client);
}
@ -1533,7 +1535,7 @@ uint32_t wlr_xdg_toplevel_v6_set_size(struct wlr_xdg_surface_v6 *surface,
surface->toplevel->server_pending.width = width;
surface->toplevel->server_pending.height = height;
return wlr_xdg_surface_v6_schedule_configure(surface);
return xdg_surface_v6_schedule_configure(surface);
}
uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
@ -1541,7 +1543,7 @@ uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
surface->toplevel->server_pending.activated = activated;
return wlr_xdg_surface_v6_schedule_configure(surface);
return xdg_surface_v6_schedule_configure(surface);
}
uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
@ -1549,7 +1551,7 @@ uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
surface->toplevel->server_pending.maximized = maximized;
return wlr_xdg_surface_v6_schedule_configure(surface);
return xdg_surface_v6_schedule_configure(surface);
}
uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
@ -1557,7 +1559,7 @@ uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
surface->toplevel->server_pending.fullscreen = fullscreen;
return wlr_xdg_surface_v6_schedule_configure(surface);
return xdg_surface_v6_schedule_configure(surface);
}
uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
@ -1565,7 +1567,7 @@ uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
surface->toplevel->server_pending.resizing = resizing;
return wlr_xdg_surface_v6_schedule_configure(surface);
return xdg_surface_v6_schedule_configure(surface);
}
void wlr_xdg_surface_v6_send_close(struct wlr_xdg_surface_v6 *surface) {
@ -1677,7 +1679,7 @@ void wlr_xdg_popup_v6_get_toplevel_coords(struct wlr_xdg_popup_v6 *popup,
}
static void wlr_xdg_popup_v6_box_constraints(struct wlr_xdg_popup_v6 *popup,
static void xdg_popup_v6_box_constraints(struct wlr_xdg_popup_v6 *popup,
struct wlr_box *toplevel_sx_box, int *offset_x, int *offset_y) {
int popup_width = popup->geometry.width;
int popup_height = popup->geometry.height;
@ -1705,10 +1707,10 @@ static void wlr_xdg_popup_v6_box_constraints(struct wlr_xdg_popup_v6 *popup,
}
}
static bool wlr_xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
static bool xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
struct wlr_box *toplevel_sx_box) {
int offset_x = 0, offset_y = 0;
wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
if (!offset_x && !offset_y) {
@ -1733,7 +1735,7 @@ static bool wlr_xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
popup->geometry =
wlr_xdg_positioner_v6_get_geometry(&popup->positioner);
wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
if (!offset_x && !offset_y) {
@ -1755,10 +1757,10 @@ static bool wlr_xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
return false;
}
static bool wlr_xdg_popup_v6_unconstrain_slide(struct wlr_xdg_popup_v6 *popup,
static bool xdg_popup_v6_unconstrain_slide(struct wlr_xdg_popup_v6 *popup,
struct wlr_box *toplevel_sx_box) {
int offset_x = 0, offset_y = 0;
wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
if (!offset_x && !offset_y) {
@ -1792,16 +1794,16 @@ static bool wlr_xdg_popup_v6_unconstrain_slide(struct wlr_xdg_popup_v6 *popup,
popup->geometry.y += toplevel_sx_box->y - toplevel_y;
}
wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
return !offset_x && !offset_y;
}
static bool wlr_xdg_popup_v6_unconstrain_resize(struct wlr_xdg_popup_v6 *popup,
static bool xdg_popup_v6_unconstrain_resize(struct wlr_xdg_popup_v6 *popup,
struct wlr_box *toplevel_sx_box) {
int offset_x, offset_y;
wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
if (!offset_x && !offset_y) {
@ -1823,7 +1825,7 @@ static bool wlr_xdg_popup_v6_unconstrain_resize(struct wlr_xdg_popup_v6 *popup,
popup->geometry.height -= offset_y;
}
wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
&offset_y, &offset_y);
return !offset_x && !offset_y;
@ -1831,13 +1833,13 @@ static bool wlr_xdg_popup_v6_unconstrain_resize(struct wlr_xdg_popup_v6 *popup,
void wlr_xdg_popup_v6_unconstrain_from_box(struct wlr_xdg_popup_v6 *popup,
struct wlr_box *toplevel_sx_box) {
if (wlr_xdg_popup_v6_unconstrain_flip(popup, toplevel_sx_box)) {
if (xdg_popup_v6_unconstrain_flip(popup, toplevel_sx_box)) {
return;
}
if (wlr_xdg_popup_v6_unconstrain_slide(popup, toplevel_sx_box)) {
if (xdg_popup_v6_unconstrain_slide(popup, toplevel_sx_box)) {
return;
}
if (wlr_xdg_popup_v6_unconstrain_resize(popup, toplevel_sx_box)) {
if (xdg_popup_v6_unconstrain_resize(popup, toplevel_sx_box)) {
return;
}
}