perf(wave1): reduce Config caps, reorder Client/Monitor for cache

Wave 1 changes:
- Reduce CFG_MAX_KEYBINDS 256→128, CFG_MAX_STRLEN 256→64, CFG_MAX_ARGS 16→8
  → saves ~2.5 MB BSS from Config struct
- Add truncation warnings to config_load when keybind/button/scroll limit reached
- Reorder Client struct: HOT fields (type, mon, tags, floating flags, geom) in first
  cache line, COLD fields (wl_listeners) at end — saves cache misses in arrange()
- Reorder LayerSurface struct similarly
- Split Monitor into Monitor/MonitorCold: hot fields (~120B) stay inline, cold layout
  state lazily allocated on first dwindle/master use
- All cold-field accesses through m->cold-> indirection
- cleanupmon frees m->cold
- Zero-warning build with clang -Werror -Wpedantic
This commit is contained in:
2026-07-02 23:35:37 -04:00
parent cd0e5ec1eb
commit fb0f49e861
22 changed files with 6664 additions and 86 deletions
@@ -0,0 +1,447 @@
/* Generated by wayland-scanner 1.25.0 */
#ifndef PEACHWM_IPC_UNSTABLE_V2_SERVER_PROTOCOL_H
#define PEACHWM_IPC_UNSTABLE_V2_SERVER_PROTOCOL_H
#include <stdint.h>
#include <stddef.h>
#include "wayland-server.h"
#ifdef __cplusplus
extern "C" {
#endif
struct wl_client;
struct wl_resource;
/**
* @page page_peachwm_ipc_unstable_v2 The peachwm_ipc_unstable_v2 protocol
* @section page_ifaces_peachwm_ipc_unstable_v2 Interfaces
* - @subpage page_iface_zpeachwm_ipc_manager_v2 - manage peachwm state
* - @subpage page_iface_zpeachwm_ipc_output_v2 - interact with peachwm output state
* @section page_copyright_peachwm_ipc_unstable_v2 Copyright
* <pre>
*
* Copyright (C) 2022 Russell Newcomb
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
* </pre>
*/
struct wl_output;
struct zpeachwm_ipc_manager_v2;
struct zpeachwm_ipc_output_v2;
#ifndef ZPEACHWM_IPC_MANAGER_V2_INTERFACE
#define ZPEACHWM_IPC_MANAGER_V2_INTERFACE
/**
* @page page_iface_zpeachwm_ipc_manager_v2 zpeachwm_ipc_manager_v2
* @section page_iface_zpeachwm_ipc_manager_v2_desc Description
*
* This interface is exposed as a global in the Wayland registry and allows
* clients to query and set peachwm state.
*
* Warning! The protocol described in this file is experimental and
* backward incompatible changes may be made. Backward compatible changes
* may be added together with the corresponding interface version bump.
* Backward incompatible changes are done by bumping the version number in
* the protocol and interface names and resetting the interface version.
* Once the protocol is to be declared stable, the 'z' prefix and the
* version number in the protocol and interface names are removed and the
* interface version is reset.
* @section page_iface_zpeachwm_ipc_manager_v2_api API
* See @ref iface_zpeachwm_ipc_manager_v2.
*/
/**
* @defgroup iface_zpeachwm_ipc_manager_v2 The zpeachwm_ipc_manager_v2 interface
*
* This interface is exposed as a global in the Wayland registry and allows
* clients to query and set peachwm state.
*
* Warning! The protocol described in this file is experimental and
* backward incompatible changes may be made. Backward compatible changes
* may be added together with the corresponding interface version bump.
* Backward incompatible changes are done by bumping the version number in
* the protocol and interface names and resetting the interface version.
* Once the protocol is to be declared stable, the 'z' prefix and the
* version number in the protocol and interface names are removed and the
* interface version is reset.
*/
extern const struct wl_interface zpeachwm_ipc_manager_v2_interface;
#endif
#ifndef ZPEACHWM_IPC_OUTPUT_V2_INTERFACE
#define ZPEACHWM_IPC_OUTPUT_V2_INTERFACE
/**
* @page page_iface_zpeachwm_ipc_output_v2 zpeachwm_ipc_output_v2
* @section page_iface_zpeachwm_ipc_output_v2_desc Description
*
* Observe and control a peachwm output.
* @section page_iface_zpeachwm_ipc_output_v2_api API
* See @ref iface_zpeachwm_ipc_output_v2.
*/
/**
* @defgroup iface_zpeachwm_ipc_output_v2 The zpeachwm_ipc_output_v2 interface
*
* Observe and control a peachwm output.
*/
extern const struct wl_interface zpeachwm_ipc_output_v2_interface;
#endif
/**
* @ingroup iface_zpeachwm_ipc_manager_v2
* @struct zpeachwm_ipc_manager_v2_interface
*/
struct zpeachwm_ipc_manager_v2_interface {
/**
* release peachwm_ipc_manager
*
* Indicates that the client will not use the manager object
* anymore. Objects created through this interface remain valid.
*/
void (*release)(struct wl_client *client,
struct wl_resource *resource);
/**
* get a peachwm_ipc_output for a wl_output
*
* Get a peachwm_ipc_output for the given wl_output.
*/
void (*get_output)(struct wl_client *client,
struct wl_resource *resource,
uint32_t id,
struct wl_resource *output);
};
#define ZPEACHWM_IPC_MANAGER_V2_TAGS 0
#define ZPEACHWM_IPC_MANAGER_V2_LAYOUT 1
/**
* @ingroup iface_zpeachwm_ipc_manager_v2
*/
#define ZPEACHWM_IPC_MANAGER_V2_TAGS_SINCE_VERSION 1
/**
* @ingroup iface_zpeachwm_ipc_manager_v2
*/
#define ZPEACHWM_IPC_MANAGER_V2_LAYOUT_SINCE_VERSION 1
/**
* @ingroup iface_zpeachwm_ipc_manager_v2
*/
#define ZPEACHWM_IPC_MANAGER_V2_RELEASE_SINCE_VERSION 1
/**
* @ingroup iface_zpeachwm_ipc_manager_v2
*/
#define ZPEACHWM_IPC_MANAGER_V2_GET_OUTPUT_SINCE_VERSION 1
/**
* @ingroup iface_zpeachwm_ipc_manager_v2
* Sends an tags event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zpeachwm_ipc_manager_v2_send_tags(struct wl_resource *resource_, uint32_t amount)
{
wl_resource_post_event(resource_, ZPEACHWM_IPC_MANAGER_V2_TAGS, amount);
}
/**
* @ingroup iface_zpeachwm_ipc_manager_v2
* Sends an layout event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zpeachwm_ipc_manager_v2_send_layout(struct wl_resource *resource_, const char *name)
{
wl_resource_post_event(resource_, ZPEACHWM_IPC_MANAGER_V2_LAYOUT, name);
}
#ifndef ZPEACHWM_IPC_OUTPUT_V2_TAG_STATE_ENUM
#define ZPEACHWM_IPC_OUTPUT_V2_TAG_STATE_ENUM
enum zpeachwm_ipc_output_v2_tag_state {
/**
* no state
*/
ZPEACHWM_IPC_OUTPUT_V2_TAG_STATE_NONE = 0,
/**
* tag is active
*/
ZPEACHWM_IPC_OUTPUT_V2_TAG_STATE_ACTIVE = 1,
/**
* tag has urgent client
*/
ZPEACHWM_IPC_OUTPUT_V2_TAG_STATE_URGENT = 2,
};
#endif /* ZPEACHWM_IPC_OUTPUT_V2_TAG_STATE_ENUM */
#ifndef ZPEACHWM_IPC_OUTPUT_V2_TAG_STATE_ENUM_IS_VALID
#define ZPEACHWM_IPC_OUTPUT_V2_TAG_STATE_ENUM_IS_VALID
/**
* @ingroup iface_zpeachwm_ipc_output_v2
* Validate a zpeachwm_ipc_output_v2 tag_state value.
*
* @return true on success, false on error.
* @ref zpeachwm_ipc_output_v2_tag_state
*/
static inline bool
zpeachwm_ipc_output_v2_tag_state_is_valid(uint32_t value, uint32_t version) {
switch (value) {
case ZPEACHWM_IPC_OUTPUT_V2_TAG_STATE_NONE:
return version >= 1;
case ZPEACHWM_IPC_OUTPUT_V2_TAG_STATE_ACTIVE:
return version >= 1;
case ZPEACHWM_IPC_OUTPUT_V2_TAG_STATE_URGENT:
return version >= 1;
default:
return false;
}
}
#endif /* ZPEACHWM_IPC_OUTPUT_V2_TAG_STATE_ENUM_IS_VALID */
/**
* @ingroup iface_zpeachwm_ipc_output_v2
* @struct zpeachwm_ipc_output_v2_interface
*/
struct zpeachwm_ipc_output_v2_interface {
/**
* release peachwm_ipc_output
*
* Indicates that the client will not use the peachwm_ipc_output
* object anymore. Objects created through this interface remain
* valid.
*/
void (*release)(struct wl_client *client,
struct wl_resource *resource);
/**
* set the active tags of this output
*
* set the active tags of this output.
* @param tagmask bitmask of the tags that should be set
* @param toggle_tagset whether to toggle the tagset
*/
void (*set_tags)(struct wl_client *client,
struct wl_resource *resource,
uint32_t tagmask,
uint32_t toggle_tagset);
/**
* set the tags of the focused client
*
* Set the tags of the focused client.
*/
void (*set_client_tags)(struct wl_client *client,
struct wl_resource *resource,
uint32_t and_tags,
uint32_t xor_tags);
/**
* set the layout of this output
*
* Set the layout of this output.
*/
void (*set_layout)(struct wl_client *client,
struct wl_resource *resource,
uint32_t index);
};
#define ZPEACHWM_IPC_OUTPUT_V2_TOGGLE_VISIBILITY 0
#define ZPEACHWM_IPC_OUTPUT_V2_ACTIVE 1
#define ZPEACHWM_IPC_OUTPUT_V2_TAG 2
#define ZPEACHWM_IPC_OUTPUT_V2_LAYOUT 3
#define ZPEACHWM_IPC_OUTPUT_V2_TITLE 4
#define ZPEACHWM_IPC_OUTPUT_V2_APPID 5
#define ZPEACHWM_IPC_OUTPUT_V2_LAYOUT_SYMBOL 6
#define ZPEACHWM_IPC_OUTPUT_V2_FRAME 7
#define ZPEACHWM_IPC_OUTPUT_V2_FULLSCREEN 8
#define ZPEACHWM_IPC_OUTPUT_V2_FLOATING 9
/**
* @ingroup iface_zpeachwm_ipc_output_v2
*/
#define ZPEACHWM_IPC_OUTPUT_V2_TOGGLE_VISIBILITY_SINCE_VERSION 1
/**
* @ingroup iface_zpeachwm_ipc_output_v2
*/
#define ZPEACHWM_IPC_OUTPUT_V2_ACTIVE_SINCE_VERSION 1
/**
* @ingroup iface_zpeachwm_ipc_output_v2
*/
#define ZPEACHWM_IPC_OUTPUT_V2_TAG_SINCE_VERSION 1
/**
* @ingroup iface_zpeachwm_ipc_output_v2
*/
#define ZPEACHWM_IPC_OUTPUT_V2_LAYOUT_SINCE_VERSION 1
/**
* @ingroup iface_zpeachwm_ipc_output_v2
*/
#define ZPEACHWM_IPC_OUTPUT_V2_TITLE_SINCE_VERSION 1
/**
* @ingroup iface_zpeachwm_ipc_output_v2
*/
#define ZPEACHWM_IPC_OUTPUT_V2_APPID_SINCE_VERSION 1
/**
* @ingroup iface_zpeachwm_ipc_output_v2
*/
#define ZPEACHWM_IPC_OUTPUT_V2_LAYOUT_SYMBOL_SINCE_VERSION 1
/**
* @ingroup iface_zpeachwm_ipc_output_v2
*/
#define ZPEACHWM_IPC_OUTPUT_V2_FRAME_SINCE_VERSION 1
/**
* @ingroup iface_zpeachwm_ipc_output_v2
*/
#define ZPEACHWM_IPC_OUTPUT_V2_FULLSCREEN_SINCE_VERSION 2
/**
* @ingroup iface_zpeachwm_ipc_output_v2
*/
#define ZPEACHWM_IPC_OUTPUT_V2_FLOATING_SINCE_VERSION 2
/**
* @ingroup iface_zpeachwm_ipc_output_v2
*/
#define ZPEACHWM_IPC_OUTPUT_V2_RELEASE_SINCE_VERSION 1
/**
* @ingroup iface_zpeachwm_ipc_output_v2
*/
#define ZPEACHWM_IPC_OUTPUT_V2_SET_TAGS_SINCE_VERSION 1
/**
* @ingroup iface_zpeachwm_ipc_output_v2
*/
#define ZPEACHWM_IPC_OUTPUT_V2_SET_CLIENT_TAGS_SINCE_VERSION 1
/**
* @ingroup iface_zpeachwm_ipc_output_v2
*/
#define ZPEACHWM_IPC_OUTPUT_V2_SET_LAYOUT_SINCE_VERSION 1
/**
* @ingroup iface_zpeachwm_ipc_output_v2
* Sends an toggle_visibility event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zpeachwm_ipc_output_v2_send_toggle_visibility(struct wl_resource *resource_)
{
wl_resource_post_event(resource_, ZPEACHWM_IPC_OUTPUT_V2_TOGGLE_VISIBILITY);
}
/**
* @ingroup iface_zpeachwm_ipc_output_v2
* Sends an active event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zpeachwm_ipc_output_v2_send_active(struct wl_resource *resource_, uint32_t active)
{
wl_resource_post_event(resource_, ZPEACHWM_IPC_OUTPUT_V2_ACTIVE, active);
}
/**
* @ingroup iface_zpeachwm_ipc_output_v2
* Sends an tag event to the client owning the resource.
* @param resource_ The client's resource
* @param tag index of the tag
* @param state state of the tag
* @param clients number of clients in tag
* @param focused 1 if focused client is in this tag
*/
static inline void
zpeachwm_ipc_output_v2_send_tag(struct wl_resource *resource_, uint32_t tag, uint32_t state, uint32_t clients, uint32_t focused)
{
wl_resource_post_event(resource_, ZPEACHWM_IPC_OUTPUT_V2_TAG, tag, state, clients, focused);
}
/**
* @ingroup iface_zpeachwm_ipc_output_v2
* Sends an layout event to the client owning the resource.
* @param resource_ The client's resource
* @param layout index of the layout
*/
static inline void
zpeachwm_ipc_output_v2_send_layout(struct wl_resource *resource_, uint32_t layout)
{
wl_resource_post_event(resource_, ZPEACHWM_IPC_OUTPUT_V2_LAYOUT, layout);
}
/**
* @ingroup iface_zpeachwm_ipc_output_v2
* Sends an title event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zpeachwm_ipc_output_v2_send_title(struct wl_resource *resource_, const char *title)
{
wl_resource_post_event(resource_, ZPEACHWM_IPC_OUTPUT_V2_TITLE, title);
}
/**
* @ingroup iface_zpeachwm_ipc_output_v2
* Sends an appid event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zpeachwm_ipc_output_v2_send_appid(struct wl_resource *resource_, const char *appid)
{
wl_resource_post_event(resource_, ZPEACHWM_IPC_OUTPUT_V2_APPID, appid);
}
/**
* @ingroup iface_zpeachwm_ipc_output_v2
* Sends an layout_symbol event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zpeachwm_ipc_output_v2_send_layout_symbol(struct wl_resource *resource_, const char *layout)
{
wl_resource_post_event(resource_, ZPEACHWM_IPC_OUTPUT_V2_LAYOUT_SYMBOL, layout);
}
/**
* @ingroup iface_zpeachwm_ipc_output_v2
* Sends an frame event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zpeachwm_ipc_output_v2_send_frame(struct wl_resource *resource_)
{
wl_resource_post_event(resource_, ZPEACHWM_IPC_OUTPUT_V2_FRAME);
}
/**
* @ingroup iface_zpeachwm_ipc_output_v2
* Sends an fullscreen event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zpeachwm_ipc_output_v2_send_fullscreen(struct wl_resource *resource_, uint32_t is_fullscreen)
{
wl_resource_post_event(resource_, ZPEACHWM_IPC_OUTPUT_V2_FULLSCREEN, is_fullscreen);
}
/**
* @ingroup iface_zpeachwm_ipc_output_v2
* Sends an floating event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zpeachwm_ipc_output_v2_send_floating(struct wl_resource *resource_, uint32_t is_floating)
{
wl_resource_post_event(resource_, ZPEACHWM_IPC_OUTPUT_V2_FLOATING, is_floating);
}
#ifdef __cplusplus
}
#endif
#endif