opt: add common for struct type

It must be placed first; otherwise, after the xytonode's null pointer is
forcibly converted, the reading type will encounter an incorrect address
This commit is contained in:
DreamMaoMao 2026-06-22 14:31:43 +08:00
parent b8ca3a3c34
commit 95b0724cff
3 changed files with 6 additions and 6 deletions

View file

@ -72,7 +72,7 @@ typedef struct {
} MangoJumpLabel; } MangoJumpLabel;
typedef struct { typedef struct {
uint32_t type; uint32_t type; // must at first in struct
struct wlr_scene_buffer *scene_buffer; struct wlr_scene_buffer *scene_buffer;
struct mango_text_buffer *buffer; struct mango_text_buffer *buffer;
cairo_surface_t *surface; cairo_surface_t *surface;

View file

@ -27,7 +27,7 @@ struct dwl_input_method_relay {
}; };
struct dwl_input_method_popup { struct dwl_input_method_popup {
uint32_t type; uint32_t type; // must at first in struct
struct wlr_input_popup_surface_v2 *popup_surface; struct wlr_input_popup_surface_v2 *popup_surface;
struct wlr_scene_tree *tree; struct wlr_scene_tree *tree;
struct wlr_scene_tree *scene_surface; struct wlr_scene_tree *scene_surface;

View file

@ -328,7 +328,7 @@ typedef struct {
struct Client { struct Client {
/* Must keep these three elements in this order */ /* Must keep these three elements in this order */
uint32_t type; /* XDGShell or X11* */ uint32_t type; // must at first in struct
struct wlr_box geom, pending, float_geom, animainit_geom, struct wlr_box geom, pending, float_geom, animainit_geom,
overview_backup_geom, current, overview_backup_geom, current,
drag_begin_geom; /* layout-relative, includes border */ drag_begin_geom; /* layout-relative, includes border */
@ -509,7 +509,7 @@ typedef struct {
typedef struct { typedef struct {
/* Must keep these three elements in this order */ /* Must keep these three elements in this order */
uint32_t type; /* LayerShell */ uint32_t type; // must at first in struct
struct wlr_box geom, current, pending, animainit_geom; struct wlr_box geom, current, pending, animainit_geom;
Monitor *mon; Monitor *mon;
struct wlr_scene_tree *scene; struct wlr_scene_tree *scene;
@ -539,7 +539,7 @@ typedef struct {
} LayerSurface; } LayerSurface;
typedef struct { typedef struct {
uint32_t type; uint32_t type; // must at first in struct
struct wlr_xdg_popup *wlr_popup; struct wlr_xdg_popup *wlr_popup;
struct wl_listener destroy; struct wl_listener destroy;
struct wl_listener commit; struct wl_listener commit;
@ -651,7 +651,7 @@ struct TagScrollerState {
}; };
typedef struct { typedef struct {
uint32_t type; uint32_t type; // must at first in struct
int32_t orig_width; int32_t orig_width;
int32_t orig_height; int32_t orig_height;
bool is_subsurface; bool is_subsurface;