This commit is contained in:
Scott Anderson 2017-05-13 12:56:36 +12:00
parent a2896f33a4
commit f4c90635ff
9 changed files with 20 additions and 19 deletions

View file

@ -211,7 +211,7 @@ ssize_t list_lsearch(const list_t *list, int compare(const void *key, const void
uint8_t (*array)[size] = list->items;
for (size_t i = 0; i < list->length; ++i) {
if (compare(key, &array[i]) == 0) {
if (compare(&key, &array[i]) == 0) {
if (ret) {
memcpy(ret, &array[i], size);
}

View file

@ -1230,7 +1230,8 @@ int workspace_output_cmp_workspace(const void *a, const void *b) {
}
int sway_binding_cmp_keys(const void *key, const void *item) {
const struct sway_binding *binda = item, *bindb = key;
const struct sway_binding *binda = *(struct sway_binding **)item;
const struct sway_binding *bindb = *(struct sway_binding **)key;
// Count keys pressed for this binding. important so we check long before
// short ones. for example mod+a+b before mod+a
@ -1277,7 +1278,7 @@ int sway_binding_cmp_keys(const void *key, const void *item) {
int sway_binding_cmp(const void *a, const void *b) {
int cmp = 0;
if ((cmp = sway_binding_cmp_keys(a, b)) != 0) {
if ((cmp = sway_binding_cmp_keys(&a, &b)) != 0) {
return cmp;
}
const struct sway_binding *binda = a, *bindb = b;

View file

@ -373,7 +373,7 @@ swayc_t *new_floating_view(wlc_handle handle) {
view->is_floating = true;
// Case of focused workspace, just create as child of it
list_add(swayc_active_workspace()->floating, view);
list_add(swayc_active_workspace()->floating, &view);
view->parent = swayc_active_workspace();
if (swayc_active_workspace()->focused == NULL) {
set_focused_container_for(swayc_active_workspace(), view);

View file

@ -376,7 +376,7 @@ list_t *criteria_for(swayc_t *cont) {
for (size_t i = 0; i < config->criteria->length; i++) {
struct criteria *bc = *(struct criteria **)list_get(config->criteria, i);
if (criteria_test(cont, bc->tokens)) {
list_add(matches, bc);
list_add(matches, &bc);
}
}
return matches;
@ -390,7 +390,7 @@ struct list_tokens {
static void container_match_add(swayc_t *container, void *arg) {
struct list_tokens *list_tokens = arg;
if (criteria_test(container, list_tokens->tokens)) {
list_add(list_tokens->list, container);
list_add(list_tokens->list, &container);
}
}
list_t *container_for(list_t *tokens) {

View file

@ -28,7 +28,7 @@ static struct panel_config *find_or_create_panel_config(struct wl_resource *reso
sway_log(L_ERROR, "Unable to create panel config");
return NULL;
}
list_add(desktop_shell.panels, config);
list_add(desktop_shell.panels, &config);
config->wl_resource = resource;
return config;
}
@ -101,7 +101,7 @@ static void set_background(struct wl_client *client, struct wl_resource *resourc
config->output = output;
config->surface = wlc_resource_from_wl_surface_resource(surface);
config->wl_surface_res = surface;
list_add(desktop_shell.backgrounds, config);
list_add(desktop_shell.backgrounds, &config);
wl_resource_set_destructor(surface, background_surface_destructor);
arrange_windows(swayc_by_handle(output), -1, -1);
wlc_output_schedule_render(config->output);
@ -211,7 +211,7 @@ static void set_lock_surface(struct wl_client *client, struct wl_resource *resou
desktop_shell.is_locked = true;
input_init();
arrange_windows(workspace, -1, -1);
list_add(desktop_shell.lock_surfaces, surface);
list_add(desktop_shell.lock_surfaces, &surface);
wl_resource_set_destructor(surface, lock_surface_destructor);
} else {
sway_log(L_ERROR, "Attempted to set lock surface to non-view");

View file

@ -1008,7 +1008,7 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w
swayc_t *item = *(swayc_t **)list_get(pointer->parent->floating, i);
if (item == pointer) {
list_delete(pointer->parent->floating, i);
list_add(pointer->parent->floating, pointer);
list_add(pointer->parent->floating, &pointer);
break;
}
}

View file

@ -286,7 +286,7 @@ void ipc_get_pixels(wlc_handle output) {
for (size_t i = 0; i < ipc_get_pixel_requests->length; ++i) {
req = *(struct get_pixels_request **)list_get(ipc_get_pixel_requests, i);
if (req->output != output) {
list_add(unhandled, req);
list_add(unhandled, &req);
continue;
}

View file

@ -63,7 +63,7 @@ int index_child(const swayc_t *child) {
void add_child(swayc_t *parent, swayc_t *child) {
sway_log(L_DEBUG, "Adding %p (%d, %fx%f) to %p (%d, %fx%f)", child, child->type,
child->width, child->height, parent, parent->type, parent->width, parent->height);
list_add(parent->children, child);
list_add(parent->children, &child);
child->parent = parent;
// set focus for this container
if (!parent->focused) {
@ -140,7 +140,7 @@ void add_floating(swayc_t *ws, swayc_t *child) {
if (!sway_assert(ws->type == C_WORKSPACE, "Must be of workspace type")) {
return;
}
list_add(ws->floating, child);
list_add(ws->floating, &child);
child->parent = ws;
child->is_floating = true;
if (!ws->focused) {
@ -154,19 +154,19 @@ swayc_t *add_sibling(swayc_t *fixed, swayc_t *active) {
if (fixed->is_floating) {
if (active->is_floating) {
int i = index_child(fixed);
list_insert(parent->floating, i + 1, active);
list_insert(parent->floating, i + 1, &active);
} else {
list_add(parent->children, active);
list_add(parent->children, &active);
}
} else {
if (active->is_floating) {
list_add(parent->floating, active);
list_add(parent->floating, &active);
} else {
int i = index_child(fixed);
if (is_auto_layout(parent->layout)) {
list_add(parent->children, active);
list_add(parent->children, &active);
} else {
list_insert(parent->children, i + 1, active);
list_insert(parent->children, i + 1, &active);
}
}
}

View file

@ -315,7 +315,7 @@ void ipc_bar_init(struct bar *bar, const char *bar_id) {
// add bar to the output
struct output *bar_output = new_output(name);
bar_output->idx = i;
list_add(bar->outputs, bar_output);
list_add(bar->outputs, &bar_output);
}
free(res);
json_object_put(outputs);