Drop a pass-through macro and clarify field helpers

0a1fb3c2e88ce5a83b6f62ec42a9e99ac4bc98b5
Alexis Sellier committed ago 1 parent 4a984704
swm.c +5 -6
112 112
#define MAX_STATUS_FIELD        1024
113 113
#define MAX_WINDOW_STATE_LINE   1024
114 114
#define MAX_STATE_PATH          4096
115 115
#define MAX_WORKSPACE_TITLE     256
116 116
#define MAX_WS_ID               16
117 -
#define MAX_STATIC_LISTENERS    512
117 +
#define MAX_STATIC_LISTENERS    128
118 118
#define MAX_GLOBAL_LISTENERS    64
119 119
#define MAX_WS_MANAGERS         64
120 120
#define MAX_WS_HANDLES          (MAX_WS_MANAGERS * WSCOUNT)
121 121
#define MAX_AUTOSTART           64
122 122
#define MAX_COMMAND_SIZE        1024
123 123
#define MAX_COMMAND_ARGS        64
124 -
#define LISTEN_STATIC(E, H)     listen_static((E), (H))
125 124
126 125
/* Cursor interaction state. */
127 126
enum { CURSOR_NORMAL, CURSOR_PRESSED, CURSOR_MOVE, CURSOR_RESIZE, CURSOR_TILE_RESIZE };
128 127
129 128
/* Master-stack configuration commands. */
2352 2351
2353 2352
/* Track a new request to keep the session awake. */
2354 2353
void create_idle_inhibitor(struct wl_listener *listener, void *data) {
2355 2354
    struct wlr_idle_inhibitor_v1 *idle_inhibitor = data;
2356 2355
2357 -
    LISTEN_STATIC(&idle_inhibitor->events.destroy, destroy_idle_inhibitor);
2356 +
    listen_static(&idle_inhibitor->events.destroy, destroy_idle_inhibitor);
2358 2357
2359 2358
    check_idle_inhibitor(nullptr);
2360 2359
}
2361 2360
2362 2361
/* Add a physical keyboard to the shared keyboard group. */
3840 3839
    else
3841 3840
        snprintf(path, sizeof(path), "%s/.local/state/swm/windows", home ? home : "/tmp");
3842 3841
    return path;
3843 3842
}
3844 3843
3845 -
/* Replace delimiters that would corrupt a persisted state record. */
3844 +
/* Sanitize a field for the state file, naming an unknown value "broken". */
3846 3845
static void state_field(char dst[MAX_WINDOW_STATE_FIELD], const char *src) {
3847 3846
    swm_sanitize_field(dst, MAX_WINDOW_STATE_FIELD, src, "broken");
3848 3847
}
3849 3848
3850 3849
/* Find persisted state matching a client. */
4593 4592
        }
4594 4593
    }
4595 4594
    cursor_constrain(focused);
4596 4595
}
4597 4596
4598 -
/* Replace line-breaking characters before writing a status field. */
4597 +
/* Sanitize a field for status output, leaving an unknown value empty. */
4599 4598
static void status_field(char *dst, size_t size, const char *src) {
4600 4599
    swm_sanitize_field(dst, size, src, nullptr);
4601 4600
}
4602 4601
4603 4602
/* Publish visible window rectangles in slurp's predefined-region format. */
5915 5914
    icon = wlr_scene_drag_icon_create(drag_icon, drag->icon);
5916 5915
5917 5916
    if (!icon)
5918 5917
        return;
5919 5918
    drag->icon->data = &icon->node;
5920 -
    LISTEN_STATIC(&drag->icon->events.destroy, destroy_drag_icon);
5919 +
    listen_static(&drag->icon->events.destroy, destroy_drag_icon);
5921 5920
}
5922 5921
5923 5922
/* Move the focused window to the requested workspace. */
5924 5923
void tag(const arg_t *arg) {
5925 5924
    client_t *sel = focus_top(selmon);