Files
test/source/blender/windowmanager/wm.hh
Brecht Van Lommel 920e709069 Refactor: Make header files more clangd and clang-tidy friendly
When using clangd or running clang-tidy on headers there are
currently many errors. These are noisy in IDEs, make auto fixes
impossible, and break features like code completion, refactoring
and navigation.

This makes source/blender headers work by themselves, which is
generally the goal anyway. But #includes and forward declarations
were often incomplete.

* Add #includes and forward declarations
* Add IWYU pragma: export in a few places
* Remove some unused #includes (but there are many more)
* Tweak ShaderCreateInfo macros to work better with clangd

Some types of headers still have errors, these could be fixed or
worked around with more investigation. Mostly preprocessor
template headers like NOD_static_types.h.

Note that that disabling WITH_UNITY_BUILD is required for clangd to
work properly, otherwise compile_commands.json does not contain
the information for the relevant source files.

For more details see the developer docs:
https://developer.blender.org/docs/handbook/tooling/clangd/

Pull Request: https://projects.blender.org/blender/blender/pulls/132608
2025-01-07 12:39:13 +01:00

123 lines
2.9 KiB
C++

/* SPDX-FileCopyrightText: 2007 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup wm
*/
#pragma once
struct wmOperator;
struct wmTimer;
struct wmWindow;
struct wmWindowManager;
struct Main;
#include "gizmo/wm_gizmo_wmapi.hh"
struct wmPaintCursor {
wmPaintCursor *next, *prev;
void *customdata;
bool (*poll)(bContext *C);
void (*draw)(bContext *C, int, int, void *customdata);
short space_type;
short region_type;
};
/**
* Cause a delayed #WM_exit()
* call to avoid leaking memory when trying to exit from within operators.
*/
void wm_exit_schedule_delayed(const bContext *C);
/**
* Context is allowed to be NULL, do not free wm itself `lib_id.cc`.
*/
extern void wm_close_and_free(bContext *C, wmWindowManager *);
/**
* On startup, it adds all data, for matching.
*/
extern void wm_add_default(Main *bmain, bContext *C);
extern void wm_clear_default_size(bContext *C);
/* Register to window-manager for redo or macro. */
/**
* Called on event handling by `event_system.c`.
*
* All operations get registered in the window-manager here.
*/
void wm_operator_register(bContext *C, wmOperator *op);
/* `wm_operator.cc`, for init/exit. */
void wm_operatortype_free();
/**
* Default key-map for windows and screens, only call once per WM.
*/
void wm_window_keymap(wmKeyConfig *keyconf);
void wm_operatortypes_register();
/* `wm_gesture.cc` */
/* Called in `wm_draw.cc`. */
void wm_gesture_draw(wmWindow *win);
/**
* Use for line gesture.
*/
void wm_gesture_tag_redraw(wmWindow *win);
/* `wm_jobs.cc` */
/**
* Hard-coded to event #TIMERJOBS.
*/
void wm_jobs_timer(wmWindowManager *wm, wmTimer *wt);
/**
* Kill job entirely, also removes timer itself.
*/
void wm_jobs_timer_end(wmWindowManager *wm, wmTimer *wt);
/* `wm_files.cc`. */
/**
* Run the auto-save timer action.
*/
void wm_autosave_timer(Main *bmain, wmWindowManager *wm, wmTimer *wt);
void wm_autosave_timer_begin(wmWindowManager *wm);
void wm_autosave_timer_end(wmWindowManager *wm);
void wm_autosave_delete();
/* `wm_splash_screen.cc` */
void WM_OT_splash(wmOperatorType *ot);
void WM_OT_splash_about(wmOperatorType *ot);
/* `wm_stereo.cc` */
void wm_stereo3d_draw_sidebyside(wmWindow *win, int view);
void wm_stereo3d_draw_topbottom(wmWindow *win, int view);
/**
* If needed, adjust \a r_mouse_xy
* so that drawn cursor and handled mouse position are matching visually.
*/
void wm_stereo3d_mouse_offset_apply(wmWindow *win, int r_mouse_xy[2]);
int wm_stereo3d_set_exec(bContext *C, wmOperator *op);
int wm_stereo3d_set_invoke(bContext *C, wmOperator *op, const wmEvent *event);
void wm_stereo3d_set_draw(bContext *C, wmOperator *op);
bool wm_stereo3d_set_check(bContext *C, wmOperator *op);
void wm_stereo3d_set_cancel(bContext *C, wmOperator *op);
/**
* Initialize operator properties.
*/
void wm_open_init_load_ui(wmOperator *op, bool use_prefs);
void wm_open_init_use_scripts(wmOperator *op, bool use_prefs);