opt: change unsigned int to uint32_t

This commit is contained in:
DreamMaoMao
2025-12-02 16:57:24 +08:00
parent 9196e2a50b
commit b9952f03b5
20 changed files with 314 additions and 329 deletions

View File

@@ -1,12 +1,11 @@
#include "dwl-ipc-unstable-v2-protocol.h"
static void dwl_ipc_manager_bind(struct wl_client *client, void *data,
unsigned int version, unsigned int id);
uint32_t version, uint32_t id);
static void dwl_ipc_manager_destroy(struct wl_resource *resource);
static void dwl_ipc_manager_get_output(struct wl_client *client,
struct wl_resource *resource,
unsigned int id,
struct wl_resource *output);
uint32_t id, struct wl_resource *output);
static void dwl_ipc_manager_release(struct wl_client *client,
struct wl_resource *resource);
static void dwl_ipc_output_destroy(struct wl_resource *resource);
@@ -15,15 +14,14 @@ static void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output,
uint32_t event_mask);
static void dwl_ipc_output_set_client_tags(struct wl_client *client,
struct wl_resource *resource,
unsigned int and_tags,
unsigned int xor_tags);
uint32_t and_tags,
uint32_t xor_tags);
static void dwl_ipc_output_set_layout(struct wl_client *client,
struct wl_resource *resource,
unsigned int index);
uint32_t index);
static void dwl_ipc_output_set_tags(struct wl_client *client,
struct wl_resource *resource,
unsigned int tagmask,
unsigned int toggle_tagset);
uint32_t tagmask, uint32_t toggle_tagset);
static void dwl_ipc_output_quit(struct wl_client *client,
struct wl_resource *resource);
static void dwl_ipc_output_dispatch(struct wl_client *client,
@@ -47,7 +45,7 @@ static struct zdwl_ipc_output_v2_interface dwl_output_implementation = {
.set_client_tags = dwl_ipc_output_set_client_tags};
void dwl_ipc_manager_bind(struct wl_client *client, void *data,
unsigned int version, unsigned int id) {
uint32_t version, uint32_t id) {
struct wl_resource *manager_resource =
wl_resource_create(client, &zdwl_ipc_manager_v2_interface, version, id);
if (!manager_resource) {
@@ -60,7 +58,7 @@ void dwl_ipc_manager_bind(struct wl_client *client, void *data,
zdwl_ipc_manager_v2_send_tags(manager_resource, LENGTH(tags));
for (unsigned int i = 0; i < LENGTH(layouts); i++)
for (uint32_t i = 0; i < LENGTH(layouts); i++)
zdwl_ipc_manager_v2_send_layout(manager_resource, layouts[i].symbol);
}
@@ -69,7 +67,7 @@ void dwl_ipc_manager_destroy(struct wl_resource *resource) {
}
void dwl_ipc_manager_get_output(struct wl_client *client,
struct wl_resource *resource, unsigned int id,
struct wl_resource *resource, uint32_t id,
struct wl_resource *output) {
DwlIpcOutput *ipc_output;
struct wlr_output *op = wlr_output_from_resource(output);
@@ -292,12 +290,11 @@ void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output,
void dwl_ipc_output_set_client_tags(struct wl_client *client,
struct wl_resource *resource,
unsigned int and_tags,
unsigned int xor_tags) {
uint32_t and_tags, uint32_t xor_tags) {
DwlIpcOutput *ipc_output;
Monitor *monitor = NULL;
Client *selected_client = NULL;
unsigned int newtags = 0;
uint32_t newtags = 0;
ipc_output = wl_resource_get_user_data(resource);
if (!ipc_output)
@@ -320,8 +317,7 @@ void dwl_ipc_output_set_client_tags(struct wl_client *client,
}
void dwl_ipc_output_set_layout(struct wl_client *client,
struct wl_resource *resource,
unsigned int index) {
struct wl_resource *resource, uint32_t index) {
DwlIpcOutput *ipc_output;
Monitor *monitor = NULL;
@@ -340,11 +336,11 @@ void dwl_ipc_output_set_layout(struct wl_client *client,
}
void dwl_ipc_output_set_tags(struct wl_client *client,
struct wl_resource *resource, unsigned int tagmask,
unsigned int toggle_tagset) {
struct wl_resource *resource, uint32_t tagmask,
uint32_t toggle_tagset) {
DwlIpcOutput *ipc_output;
Monitor *monitor = NULL;
unsigned int newtags = tagmask & TAGMASK;
uint32_t newtags = tagmask & TAGMASK;
ipc_output = wl_resource_get_user_data(resource);
if (!ipc_output)

View File

@@ -8,7 +8,7 @@ typedef struct Monitor Monitor;
struct workspace {
struct wl_list link; // Link in global workspaces list
unsigned int tag; // Numeric identifier (1-9, 0=overview)
uint32_t tag; // Numeric identifier (1-9, 0=overview)
Monitor *m; // Associated monitor
struct wlr_ext_workspace_handle_v1 *ext_workspace; // Protocol object
/* Event listeners */
@@ -22,7 +22,7 @@ struct wlr_ext_workspace_manager_v1 *ext_manager;
struct wl_list workspaces;
void goto_workspace(struct workspace *target) {
unsigned int tag;
uint32_t tag;
tag = 1 << (target->tag - 1);
if (target->tag == 0) {
toggleoverview(&(Arg){.i = -1});
@@ -33,7 +33,7 @@ void goto_workspace(struct workspace *target) {
}
void toggle_workspace(struct workspace *target) {
unsigned int tag;
uint32_t tag;
tag = 1 << (target->tag - 1);
if (target->tag == 0) {
toggleview(&(Arg){.i = -1});
@@ -69,7 +69,7 @@ static void handle_ext_workspace_deactivate(struct wl_listener *listener,
wlr_log(WLR_INFO, "ext deactivating workspace %d", workspace->tag);
}
static const char *get_name_from_tag(unsigned int tag) {
static const char *get_name_from_tag(uint32_t tag) {
static const char *names[] = {"overview", "1", "2", "3", "4",
"5", "6", "7", "8", "9"};
return (tag < sizeof(names) / sizeof(names[0])) ? names[tag] : NULL;
@@ -92,7 +92,7 @@ void cleanup_workspaces_by_monitor(Monitor *m) {
}
}
static void remove_workspace_by_tag(unsigned int tag, Monitor *m) {
static void remove_workspace_by_tag(uint32_t tag, Monitor *m) {
struct workspace *workspace, *tmp;
wl_list_for_each_safe(workspace, tmp, &workspaces, link) {
if (workspace->tag == tag && workspace->m == m) {
@@ -127,7 +127,7 @@ static void add_workspace_by_tag(int tag, Monitor *m) {
void dwl_ext_workspace_printstatus(Monitor *m) {
struct workspace *w;
unsigned int tag_status = 0;
uint32_t tag_status = 0;
wl_list_for_each(w, &workspaces, link) {
if (w && w->m == m) {

View File

@@ -4,7 +4,7 @@ static struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager;
void handle_foreign_activate_request(struct wl_listener *listener, void *data) {
Client *c = wl_container_of(listener, c, foreign_activate_request);
unsigned int target;
uint32_t target;
if (c && c->swallowing)
return;