Refactor: Move some wmWindowManager runtime lists out of DNA
Mainly for the purpose of #127706, though there's plenty more runtime data to move to the runtime struct out of DNA. Pull Request: https://projects.blender.org/blender/blender/pulls/144691
This commit is contained in:
@@ -42,6 +42,27 @@ struct WindowManagerRuntime {
|
||||
/** The current notifier in the `notifier_queue` being handled (clear instead of freeing). */
|
||||
const wmNotifier *notifier_current = nullptr;
|
||||
|
||||
/** Operator registry. */
|
||||
ListBase operators = {nullptr, nullptr};
|
||||
|
||||
/** Extra overlay cursors to draw, like circles. */
|
||||
ListBase paintcursors = {nullptr, nullptr};
|
||||
|
||||
/**
|
||||
* Known key configurations.
|
||||
* This includes all the #wmKeyConfig members (`defaultconf`, `addonconf`, etc).
|
||||
*/
|
||||
ListBase keyconfigs = {nullptr, nullptr};
|
||||
|
||||
/** Active timers. */
|
||||
ListBase timers = {nullptr, nullptr};
|
||||
|
||||
/** Threaded jobs manager. */
|
||||
ListBase jobs = {nullptr, nullptr};
|
||||
|
||||
/** Active dragged items. */
|
||||
ListBase drags = {nullptr, nullptr};
|
||||
|
||||
WindowManagerRuntime();
|
||||
~WindowManagerRuntime();
|
||||
};
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "BLI_ghash.h"
|
||||
#include "BLI_listbase.h"
|
||||
|
||||
#include "WM_api.hh"
|
||||
|
||||
namespace blender::bke {
|
||||
|
||||
WindowManagerRuntime::WindowManagerRuntime()
|
||||
@@ -27,6 +29,26 @@ WindowManagerRuntime::~WindowManagerRuntime()
|
||||
if (this->notifier_queue_set) {
|
||||
BLI_gset_free(this->notifier_queue_set, nullptr);
|
||||
}
|
||||
|
||||
while (wmOperator *op = static_cast<wmOperator *>(BLI_pophead(&this->operators))) {
|
||||
WM_operator_free(op);
|
||||
}
|
||||
|
||||
BLI_freelistN(&this->paintcursors);
|
||||
|
||||
/* NOTE(@ideasman42): typically timers are associated with windows and timers will have been
|
||||
* freed when the windows are removed. However timers can be created which don't have windows
|
||||
* and in this case it's necessary to free them on exit, see: #109953. */
|
||||
while (wmTimer *timer = static_cast<wmTimer *>(BLI_pophead(&this->timers))) {
|
||||
WM_event_timer_free_data(timer);
|
||||
MEM_freeN(timer);
|
||||
}
|
||||
|
||||
while (wmKeyConfig *keyconf = static_cast<wmKeyConfig *>(BLI_pophead(&this->keyconfigs))) {
|
||||
WM_keyconfig_free(keyconf);
|
||||
}
|
||||
|
||||
WM_drag_free_list(&this->drags);
|
||||
}
|
||||
|
||||
WindowRuntime::~WindowRuntime()
|
||||
|
||||
@@ -8612,7 +8612,7 @@ static void button_tooltip_timer_reset(bContext *C, uiBut *but)
|
||||
|
||||
if ((U.flag & USER_TOOLTIPS) || (data->tooltip_force)) {
|
||||
if (!but->block->tooltipdisabled) {
|
||||
if (!wm->drags.first) {
|
||||
if (!wm->runtime->drags.first) {
|
||||
const bool is_quick_tip = UI_but_has_quick_tooltip(but);
|
||||
const double delay = is_quick_tip ? UI_TOOLTIP_DELAY_QUICK : UI_TOOLTIP_DELAY;
|
||||
WM_tooltip_timer_init_ex(
|
||||
|
||||
@@ -3690,7 +3690,7 @@ static bool screen_maximize_area_poll(bContext *C)
|
||||
/* Don't change temporary screens. */
|
||||
!WM_window_is_temp_screen(win) &&
|
||||
/* Don't maximize when dragging. */
|
||||
BLI_listbase_is_empty(&wm->drags);
|
||||
BLI_listbase_is_empty(&wm->runtime->drags);
|
||||
}
|
||||
|
||||
static void SCREEN_OT_screen_full_area(wmOperatorType *ot)
|
||||
@@ -4779,13 +4779,13 @@ static bool repeat_history_poll(bContext *C)
|
||||
return false;
|
||||
}
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
return !BLI_listbase_is_empty(&wm->operators);
|
||||
return !BLI_listbase_is_empty(&wm->runtime->operators);
|
||||
}
|
||||
|
||||
static wmOperatorStatus repeat_last_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
wmOperator *lastop = static_cast<wmOperator *>(wm->operators.last);
|
||||
wmOperator *lastop = static_cast<wmOperator *>(wm->runtime->operators.last);
|
||||
|
||||
/* Seek last registered operator */
|
||||
while (lastop) {
|
||||
@@ -4828,7 +4828,7 @@ static wmOperatorStatus repeat_history_invoke(bContext *C,
|
||||
{
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
|
||||
int items = BLI_listbase_count(&wm->operators);
|
||||
int items = BLI_listbase_count(&wm->runtime->operators);
|
||||
if (items == 0) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
@@ -4839,7 +4839,7 @@ static wmOperatorStatus repeat_history_invoke(bContext *C,
|
||||
|
||||
wmOperator *lastop;
|
||||
int i;
|
||||
for (i = items - 1, lastop = static_cast<wmOperator *>(wm->operators.last); lastop;
|
||||
for (i = items - 1, lastop = static_cast<wmOperator *>(wm->runtime->operators.last); lastop;
|
||||
lastop = lastop->prev, i--)
|
||||
{
|
||||
if ((lastop->type->flag & OPTYPE_REGISTER) && WM_operator_repeat_check(C, lastop)) {
|
||||
@@ -4858,11 +4858,12 @@ static wmOperatorStatus repeat_history_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
|
||||
op = static_cast<wmOperator *>(BLI_findlink(&wm->operators, RNA_int_get(op->ptr, "index")));
|
||||
op = static_cast<wmOperator *>(
|
||||
BLI_findlink(&wm->runtime->operators, RNA_int_get(op->ptr, "index")));
|
||||
if (op) {
|
||||
/* let's put it as last operator in list */
|
||||
BLI_remlink(&wm->operators, op);
|
||||
BLI_addtail(&wm->operators, op);
|
||||
BLI_remlink(&wm->runtime->operators, op);
|
||||
BLI_addtail(&wm->runtime->operators, op);
|
||||
|
||||
WM_operator_repeat(C, op);
|
||||
}
|
||||
|
||||
@@ -1096,8 +1096,8 @@ static wmOperatorStatus min_distance_edit_invoke(bContext *C, wmOperator *op, co
|
||||
|
||||
/* Temporarily disable other paint cursors. */
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
op_data->orig_paintcursors = wm->paintcursors;
|
||||
BLI_listbase_clear(&wm->paintcursors);
|
||||
op_data->orig_paintcursors = wm->runtime->paintcursors;
|
||||
BLI_listbase_clear(&wm->runtime->paintcursors);
|
||||
|
||||
/* Add minimum distance paint cursor. */
|
||||
op_data->cursor = WM_paint_cursor_activate(
|
||||
@@ -1122,7 +1122,7 @@ static wmOperatorStatus min_distance_edit_modal(bContext *C, wmOperator *op, con
|
||||
/* Remove cursor. */
|
||||
WM_paint_cursor_end(static_cast<wmPaintCursor *>(op_data.cursor));
|
||||
/* Restore original paint cursors. */
|
||||
wm->paintcursors = op_data.orig_paintcursors;
|
||||
wm->runtime->paintcursors = op_data.orig_paintcursors;
|
||||
|
||||
ED_region_tag_redraw(region);
|
||||
MEM_delete(&op_data);
|
||||
|
||||
@@ -113,7 +113,7 @@ static wmOperatorStatus outliner_highlight_update_invoke(bContext *C,
|
||||
|
||||
/* Drag and drop does its own highlighting. */
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
if (wm->drags.first) {
|
||||
if (wm->runtime->drags.first) {
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
|
||||
@@ -282,7 +282,7 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup)
|
||||
|
||||
/* Adjust current operator. */
|
||||
/* Don't use 'WM_operator_last_redo' because selection actions will be ignored. */
|
||||
wmOperator *op = static_cast<wmOperator *>(CTX_wm_manager(C)->operators.last);
|
||||
wmOperator *op = static_cast<wmOperator *>(CTX_wm_manager(C)->runtime->operators.last);
|
||||
bool has_redo = (op && op->type == ggd->ot_extrude);
|
||||
wmOperator *op_xform = static_cast<wmOperator *>(has_redo ? op->macro.last : nullptr);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ bool ED_gizmo_poll_or_unlink_delayed_from_operator(const bContext *C,
|
||||
wmOperator *op = WM_operator_last_redo(C);
|
||||
#else
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
wmOperator *op = static_cast<wmOperator *>(wm->operators.last);
|
||||
wmOperator *op = static_cast<wmOperator *>(wm->runtime->operators.last);
|
||||
#endif
|
||||
|
||||
if (op == nullptr || !STREQ(op->type->idname, idname)) {
|
||||
|
||||
@@ -2096,7 +2096,7 @@ static bool uvedit_live_unwrap_timer_validate(const wmWindowManager *wm)
|
||||
if (g_live_unwrap.timer == nullptr) {
|
||||
return false;
|
||||
}
|
||||
if (BLI_findindex(&wm->timers, g_live_unwrap.timer) != -1) {
|
||||
if (BLI_findindex(&wm->runtime->timers, g_live_unwrap.timer) != -1) {
|
||||
return false;
|
||||
}
|
||||
g_live_unwrap.timer = nullptr;
|
||||
|
||||
@@ -113,29 +113,11 @@ typedef struct wmWindowManager {
|
||||
/** Set after selection to notify outliner to sync. Stores type of selection */
|
||||
short outliner_sync_select_dirty;
|
||||
|
||||
/** Operator registry. */
|
||||
ListBase operators;
|
||||
|
||||
/** Available/pending extensions updates. */
|
||||
int extensions_updates;
|
||||
/** Number of blocked & installed extensions. */
|
||||
int extensions_blocked;
|
||||
|
||||
/** Threaded jobs manager. */
|
||||
ListBase jobs;
|
||||
|
||||
/** Extra overlay cursors to draw, like circles. */
|
||||
ListBase paintcursors;
|
||||
|
||||
/** Active dragged items. */
|
||||
ListBase drags;
|
||||
|
||||
/**
|
||||
* Known key configurations.
|
||||
* This includes all the #wmKeyConfig members (`defaultconf`, `addonconf`, etc).
|
||||
*/
|
||||
ListBase keyconfigs;
|
||||
|
||||
/** Default configuration. */
|
||||
struct wmKeyConfig *defaultconf;
|
||||
/** Addon configuration. */
|
||||
@@ -143,8 +125,6 @@ typedef struct wmWindowManager {
|
||||
/** User configuration. */
|
||||
struct wmKeyConfig *userconf;
|
||||
|
||||
/** Active timers. */
|
||||
ListBase timers;
|
||||
/** Timer for auto save. */
|
||||
struct wmTimer *autosavetimer;
|
||||
/** Auto-save timer was up, but it wasn't possible to auto-save in the current mode. */
|
||||
|
||||
@@ -656,7 +656,8 @@ static wmOperator *rna_OperatorProperties_find_operator(PointerRNA *ptr)
|
||||
wmWindowManager *wm = (wmWindowManager *)ptr->owner_id;
|
||||
|
||||
IDProperty *properties = (IDProperty *)ptr->data;
|
||||
for (wmOperator *op = static_cast<wmOperator *>(wm->operators.last); op; op = op->prev) {
|
||||
for (wmOperator *op = static_cast<wmOperator *>(wm->runtime->operators.last); op; op = op->prev)
|
||||
{
|
||||
if (op->properties == properties) {
|
||||
return op;
|
||||
}
|
||||
@@ -1189,7 +1190,7 @@ static const EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C,
|
||||
wmKeyConfig *kc;
|
||||
wmKeyMap *km;
|
||||
|
||||
for (kc = static_cast<wmKeyConfig *>(wm->keyconfigs.first); kc; kc = kc->next) {
|
||||
for (kc = static_cast<wmKeyConfig *>(wm->runtime->keyconfigs.first); kc; kc = kc->next) {
|
||||
for (km = static_cast<wmKeyMap *>(kc->keymaps.first); km; km = km->next) {
|
||||
/* only check if it's a modal keymap */
|
||||
if (km->modal_items) {
|
||||
@@ -1268,7 +1269,7 @@ static PointerRNA rna_WindowManager_active_keyconfig_get(PointerRNA *ptr)
|
||||
wmKeyConfig *kc;
|
||||
|
||||
kc = static_cast<wmKeyConfig *>(
|
||||
BLI_findstring(&wm->keyconfigs, U.keyconfigstr, offsetof(wmKeyConfig, idname)));
|
||||
BLI_findstring(&wm->runtime->keyconfigs, U.keyconfigstr, offsetof(wmKeyConfig, idname)));
|
||||
|
||||
if (!kc) {
|
||||
kc = wm->defaultconf;
|
||||
@@ -1479,6 +1480,18 @@ static bool rna_KeyMapItem_userdefined_get(PointerRNA *ptr)
|
||||
return kmi->id < 0;
|
||||
}
|
||||
|
||||
static void rna_WindowManager_operators_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
||||
{
|
||||
wmWindowManager *wm = static_cast<wmWindowManager *>(ptr->data);
|
||||
rna_iterator_listbase_begin(iter, ptr, &wm->runtime->operators, nullptr);
|
||||
}
|
||||
|
||||
static void rna_WindowManager_keyconfigs_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
|
||||
{
|
||||
wmWindowManager *wm = static_cast<wmWindowManager *>(ptr->data);
|
||||
rna_iterator_listbase_begin(iter, ptr, &wm->runtime->keyconfigs, nullptr);
|
||||
}
|
||||
|
||||
static PointerRNA rna_WindowManager_xr_session_state_get(PointerRNA *ptr)
|
||||
{
|
||||
wmWindowManager *wm = static_cast<wmWindowManager *>(ptr->data);
|
||||
@@ -2830,6 +2843,15 @@ static void rna_def_windowmanager(BlenderRNA *brna)
|
||||
|
||||
prop = RNA_def_property(srna, "operators", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "Operator");
|
||||
RNA_def_property_collection_funcs(prop,
|
||||
"rna_WindowManager_operators_begin",
|
||||
"rna_iterator_listbase_next",
|
||||
"rna_iterator_listbase_end",
|
||||
"rna_iterator_listbase_get",
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
RNA_def_property_ui_text(prop, "Operators", "Operator registry");
|
||||
|
||||
prop = RNA_def_property(srna, "windows", PROP_COLLECTION, PROP_NONE);
|
||||
@@ -2838,6 +2860,15 @@ static void rna_def_windowmanager(BlenderRNA *brna)
|
||||
|
||||
prop = RNA_def_property(srna, "keyconfigs", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_struct_type(prop, "KeyConfig");
|
||||
RNA_def_property_collection_funcs(prop,
|
||||
"rna_WindowManager_keyconfigs_begin",
|
||||
"rna_iterator_listbase_next",
|
||||
"rna_iterator_listbase_end",
|
||||
"rna_iterator_listbase_get",
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr);
|
||||
RNA_def_property_ui_text(prop, "Key Configurations", "Registered key configurations");
|
||||
rna_def_wm_keyconfigs(brna, prop);
|
||||
|
||||
|
||||
@@ -566,7 +566,7 @@ wmKeyConfig *rna_KeyConfig_new(wmWindowManager *wm, const char *idname)
|
||||
static void rna_KeyConfig_remove(wmWindowManager *wm, ReportList *reports, PointerRNA *keyconf_ptr)
|
||||
{
|
||||
wmKeyConfig *keyconf = static_cast<wmKeyConfig *>(keyconf_ptr->data);
|
||||
if (UNLIKELY(BLI_findindex(&wm->keyconfigs, keyconf) == -1)) {
|
||||
if (UNLIKELY(BLI_findindex(&wm->runtime->keyconfigs, keyconf) == -1)) {
|
||||
BKE_reportf(reports, RPT_ERROR, "KeyConfig '%s' cannot be removed", keyconf->idname);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -819,13 +819,6 @@ wmTimer *WM_event_timer_add_notifier(wmWindowManager *wm,
|
||||
double time_step);
|
||||
|
||||
void WM_event_timer_free_data(wmTimer *timer);
|
||||
/**
|
||||
* Free all timers immediately.
|
||||
*
|
||||
* \note This should only be used on-exit,
|
||||
* in all other cases timers should be tagged for removal by #WM_event_timer_remove.
|
||||
*/
|
||||
void WM_event_timers_free_all(wmWindowManager *wm);
|
||||
|
||||
/**
|
||||
* Mark the given `timer` to be removed, actual removal and deletion is deferred and handled
|
||||
|
||||
@@ -200,11 +200,6 @@ static void window_manager_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
|
||||
direct_link_wm_xr_data(reader, &wm->xr);
|
||||
|
||||
BLI_listbase_clear(&wm->timers);
|
||||
BLI_listbase_clear(&wm->operators);
|
||||
BLI_listbase_clear(&wm->paintcursors);
|
||||
|
||||
BLI_listbase_clear(&wm->keyconfigs);
|
||||
wm->defaultconf = nullptr;
|
||||
wm->addonconf = nullptr;
|
||||
wm->userconf = nullptr;
|
||||
@@ -214,9 +209,6 @@ static void window_manager_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
|
||||
wm->xr.runtime = nullptr;
|
||||
|
||||
BLI_listbase_clear(&wm->jobs);
|
||||
BLI_listbase_clear(&wm->drags);
|
||||
|
||||
wm->windrawable = nullptr;
|
||||
wm->winactive = nullptr;
|
||||
wm->init_flag = 0;
|
||||
@@ -312,7 +304,7 @@ void WM_operator_free_all_after(wmWindowManager *wm, wmOperator *op)
|
||||
op = op->next;
|
||||
while (op != nullptr) {
|
||||
wmOperator *op_next = op->next;
|
||||
BLI_remlink(&wm->operators, op);
|
||||
BLI_remlink(&wm->runtime->operators, op);
|
||||
WM_operator_free(op);
|
||||
op = op_next;
|
||||
}
|
||||
@@ -351,7 +343,7 @@ void wm_operator_register(bContext *C, wmOperator *op)
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
int tot = 0;
|
||||
|
||||
BLI_addtail(&wm->operators, op);
|
||||
BLI_addtail(&wm->runtime->operators, op);
|
||||
|
||||
/* Only count registered operators. */
|
||||
while (op) {
|
||||
@@ -360,7 +352,7 @@ void wm_operator_register(bContext *C, wmOperator *op)
|
||||
tot += 1;
|
||||
}
|
||||
if (tot > MAX_OP_REGISTERED) {
|
||||
BLI_remlink(&wm->operators, op);
|
||||
BLI_remlink(&wm->runtime->operators, op);
|
||||
WM_operator_free(op);
|
||||
}
|
||||
op = op_prev;
|
||||
@@ -373,7 +365,7 @@ void wm_operator_register(bContext *C, wmOperator *op)
|
||||
|
||||
void WM_operator_stack_clear(wmWindowManager *wm)
|
||||
{
|
||||
while (wmOperator *op = static_cast<wmOperator *>(BLI_pophead(&wm->operators))) {
|
||||
while (wmOperator *op = static_cast<wmOperator *>(BLI_pophead(&wm->runtime->operators))) {
|
||||
WM_operator_free(op);
|
||||
}
|
||||
|
||||
@@ -585,14 +577,6 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
|
||||
wm_window_free(C, wm, win);
|
||||
}
|
||||
|
||||
while (wmOperator *op = static_cast<wmOperator *>(BLI_pophead(&wm->operators))) {
|
||||
WM_operator_free(op);
|
||||
}
|
||||
|
||||
while (wmKeyConfig *keyconf = static_cast<wmKeyConfig *>(BLI_pophead(&wm->keyconfigs))) {
|
||||
WM_keyconfig_free(keyconf);
|
||||
}
|
||||
|
||||
if (wm->message_bus != nullptr) {
|
||||
WM_msgbus_destroy(wm->message_bus);
|
||||
}
|
||||
@@ -600,17 +584,9 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
|
||||
#ifdef WITH_PYTHON
|
||||
BPY_callback_wm_free(wm);
|
||||
#endif
|
||||
BLI_freelistN(&wm->paintcursors);
|
||||
|
||||
WM_drag_free_list(&wm->drags);
|
||||
|
||||
wm_reports_free(wm);
|
||||
|
||||
/* NOTE(@ideasman42): typically timers are associated with windows and timers will have been
|
||||
* freed when the windows are removed. However timers can be created which don't have windows
|
||||
* and in this case it's necessary to free them on exit, see: #109953. */
|
||||
WM_event_timers_free_all(wm);
|
||||
|
||||
if (wm->undo_stack) {
|
||||
BKE_undosys_stack_destroy(wm->undo_stack);
|
||||
wm->undo_stack = nullptr;
|
||||
|
||||
@@ -310,7 +310,7 @@ void WM_event_start_prepared_drag(bContext *C, wmDrag *drag)
|
||||
{
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
|
||||
BLI_addtail(&wm->drags, drag);
|
||||
BLI_addtail(&wm->runtime->drags, drag);
|
||||
wm_dropbox_invoke(C, drag);
|
||||
}
|
||||
|
||||
@@ -599,7 +599,7 @@ void wm_drags_check_ops(bContext *C, const wmEvent *event)
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
|
||||
bool any_active = false;
|
||||
LISTBASE_FOREACH (wmDrag *, drag, &wm->drags) {
|
||||
LISTBASE_FOREACH (wmDrag *, drag, &wm->runtime->drags) {
|
||||
wm_drop_update_active(C, drag, event);
|
||||
|
||||
if (drag->drop_state.active_dropbox) {
|
||||
@@ -609,7 +609,7 @@ void wm_drags_check_ops(bContext *C, const wmEvent *event)
|
||||
|
||||
/* Change the cursor to display that dropping isn't possible here. But only if there is something
|
||||
* being dragged actually. Cursor will be restored in #wm_drags_exit(). */
|
||||
if (!BLI_listbase_is_empty(&wm->drags)) {
|
||||
if (!BLI_listbase_is_empty(&wm->runtime->drags)) {
|
||||
WM_cursor_modal_set(CTX_wm_window(C), any_active ? WM_CURSOR_DEFAULT : WM_CURSOR_STOP);
|
||||
}
|
||||
}
|
||||
@@ -1264,7 +1264,7 @@ void wm_drags_draw(bContext *C, wmWindow *win)
|
||||
|
||||
/* Should we support multi-line drag draws? Maybe not, more types mixed won't work well. */
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
LISTBASE_FOREACH (wmDrag *, drag, &wm->drags) {
|
||||
LISTBASE_FOREACH (wmDrag *, drag, &wm->runtime->drags) {
|
||||
if (drag->drop_state.active_dropbox) {
|
||||
CTX_wm_area_set(C, drag->drop_state.area_from);
|
||||
CTX_wm_region_set(C, drag->drop_state.region_from);
|
||||
|
||||
@@ -118,7 +118,7 @@ static void wm_paintcursor_draw(bContext *C, ScrArea *area, ARegion *region)
|
||||
return;
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH_MUTABLE (wmPaintCursor *, pc, &wm->paintcursors) {
|
||||
LISTBASE_FOREACH_MUTABLE (wmPaintCursor *, pc, &wm->runtime->paintcursors) {
|
||||
if ((pc->space_type != SPACE_TYPE_ANY) && (area->spacetype != pc->space_type)) {
|
||||
continue;
|
||||
}
|
||||
@@ -1132,7 +1132,8 @@ static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view)
|
||||
if (!region->runtime->visible) {
|
||||
continue;
|
||||
}
|
||||
const bool do_paint_cursor = (wm->paintcursors.first && region == screen->active_region);
|
||||
const bool do_paint_cursor = (wm->runtime->paintcursors.first &&
|
||||
region == screen->active_region);
|
||||
const bool do_draw_overlay = (region->runtime->type && region->runtime->type->draw_overlay);
|
||||
if (!(do_paint_cursor || do_draw_overlay)) {
|
||||
continue;
|
||||
@@ -1189,7 +1190,7 @@ static void wm_draw_window_onscreen(bContext *C, wmWindow *win, int view)
|
||||
}
|
||||
|
||||
/* Needs pixel coords in screen. */
|
||||
if (wm->drags.first) {
|
||||
if (wm->runtime->drags.first) {
|
||||
wm_drags_draw(C, win);
|
||||
wmWindowViewport(win);
|
||||
}
|
||||
|
||||
@@ -1069,8 +1069,8 @@ static intptr_t wm_operator_undo_active_id(const wmWindowManager *wm)
|
||||
|
||||
static intptr_t wm_operator_register_active_id(const wmWindowManager *wm)
|
||||
{
|
||||
if (wm->operators.last) {
|
||||
return intptr_t(wm->operators.last);
|
||||
if (wm->runtime->operators.last) {
|
||||
return intptr_t(wm->runtime->operators.last);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -1448,7 +1448,7 @@ bool WM_operator_is_repeat(const bContext *C, const wmOperator *op)
|
||||
wmOperator *op_prev;
|
||||
if (op->prev == nullptr && op->next == nullptr) {
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
op_prev = static_cast<wmOperator *>(wm->operators.last);
|
||||
op_prev = static_cast<wmOperator *>(wm->runtime->operators.last);
|
||||
}
|
||||
else {
|
||||
op_prev = op->prev;
|
||||
@@ -3838,7 +3838,7 @@ static ARegion *region_event_inside(bContext *C, const int xy[2])
|
||||
static void wm_paintcursor_tag(bContext *C, wmWindowManager *wm, ARegion *region)
|
||||
{
|
||||
if (region) {
|
||||
LISTBASE_FOREACH_MUTABLE (wmPaintCursor *, pc, &wm->paintcursors) {
|
||||
LISTBASE_FOREACH_MUTABLE (wmPaintCursor *, pc, &wm->runtime->paintcursors) {
|
||||
if (pc->poll == nullptr || pc->poll(C)) {
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
WM_paint_cursor_tag_redraw(win, region);
|
||||
@@ -3848,7 +3848,7 @@ static void wm_paintcursor_tag(bContext *C, wmWindowManager *wm, ARegion *region
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on mouse-move, check updates for `wm->paintcursors`.
|
||||
* Called on mouse-move, check updates for `wm->runtime->paintcursors`.
|
||||
*
|
||||
* \note Context was set on active area and region.
|
||||
*/
|
||||
@@ -3856,7 +3856,7 @@ static void wm_paintcursor_test(bContext *C, const wmEvent *event)
|
||||
{
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
|
||||
if (wm->paintcursors.first) {
|
||||
if (wm->runtime->paintcursors.first) {
|
||||
const bScreen *screen = CTX_wm_screen(C);
|
||||
ARegion *region = screen ? screen->active_region : nullptr;
|
||||
|
||||
@@ -3890,7 +3890,7 @@ static eHandlerActionFlag wm_event_drag_and_drop_test(wmWindowManager *wm,
|
||||
{
|
||||
bScreen *screen = WM_window_get_active_screen(win);
|
||||
|
||||
if (BLI_listbase_is_empty(&wm->drags)) {
|
||||
if (BLI_listbase_is_empty(&wm->runtime->drags)) {
|
||||
return WM_HANDLER_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -3899,7 +3899,7 @@ static eHandlerActionFlag wm_event_drag_and_drop_test(wmWindowManager *wm,
|
||||
}
|
||||
else if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) {
|
||||
wm_drags_exit(wm, win);
|
||||
WM_drag_free_list(&wm->drags);
|
||||
WM_drag_free_list(&wm->runtime->drags);
|
||||
|
||||
screen->do_draw_drag = true;
|
||||
|
||||
@@ -3913,7 +3913,7 @@ static eHandlerActionFlag wm_event_drag_and_drop_test(wmWindowManager *wm,
|
||||
wm_event_custom_clear(event);
|
||||
|
||||
event->custom = EVT_DATA_DRAGDROP;
|
||||
event->customdata = &wm->drags;
|
||||
event->customdata = &wm->runtime->drags;
|
||||
event->customdata_free = true;
|
||||
|
||||
/* Clear drop icon. */
|
||||
@@ -4052,7 +4052,7 @@ static eHandlerActionFlag wm_event_do_region_handlers(bContext *C, wmEvent *even
|
||||
wm_region_mouse_co(C, event);
|
||||
|
||||
const wmWindowManager *wm = CTX_wm_manager(C);
|
||||
if (!BLI_listbase_is_empty(&wm->drags)) {
|
||||
if (!BLI_listbase_is_empty(&wm->runtime->drags)) {
|
||||
/* Does polls for drop regions and checks #uiButs. */
|
||||
/* Need to be here to make sure region context is true. */
|
||||
if (ELEM(event->type, MOUSEMOVE, EVT_DROP) || ISKEYMODIFIER(event->type)) {
|
||||
|
||||
@@ -377,12 +377,12 @@ static void wm_file_read_setup_wm_use_new(bContext *C,
|
||||
wm->op_undo_depth = old_wm->op_undo_depth;
|
||||
|
||||
/* Move existing key configurations into the new WM. */
|
||||
wm->keyconfigs = old_wm->keyconfigs;
|
||||
wm->runtime->keyconfigs = old_wm->runtime->keyconfigs;
|
||||
wm->addonconf = old_wm->addonconf;
|
||||
wm->defaultconf = old_wm->defaultconf;
|
||||
wm->userconf = old_wm->userconf;
|
||||
|
||||
BLI_listbase_clear(&old_wm->keyconfigs);
|
||||
BLI_listbase_clear(&old_wm->runtime->keyconfigs);
|
||||
old_wm->addonconf = nullptr;
|
||||
old_wm->defaultconf = nullptr;
|
||||
old_wm->userconf = nullptr;
|
||||
|
||||
@@ -161,21 +161,21 @@ static void wm_job_main_thread_yield(wmJob *wm_job)
|
||||
static wmJob *wm_job_find(const wmWindowManager *wm, const void *owner, const eWM_JobType job_type)
|
||||
{
|
||||
if (owner && (job_type != WM_JOB_TYPE_ANY)) {
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) {
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->runtime->jobs) {
|
||||
if (wm_job->owner == owner && wm_job->job_type == job_type) {
|
||||
return wm_job;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (owner) {
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) {
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->runtime->jobs) {
|
||||
if (wm_job->owner == owner) {
|
||||
return wm_job;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (job_type != WM_JOB_TYPE_ANY) {
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) {
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->runtime->jobs) {
|
||||
if (wm_job->job_type == job_type) {
|
||||
return wm_job;
|
||||
}
|
||||
@@ -199,7 +199,7 @@ wmJob *WM_jobs_get(wmWindowManager *wm,
|
||||
if (wm_job == nullptr) {
|
||||
wm_job = MEM_callocN<wmJob>("new job");
|
||||
|
||||
BLI_addtail(&wm->jobs, wm_job);
|
||||
BLI_addtail(&wm->runtime->jobs, wm_job);
|
||||
wm_job->win = win;
|
||||
wm_job->owner = owner;
|
||||
wm_job->flag = flag;
|
||||
@@ -224,7 +224,7 @@ wmJob *WM_jobs_get(wmWindowManager *wm,
|
||||
bool WM_jobs_test(const wmWindowManager *wm, const void *owner, int job_type)
|
||||
{
|
||||
/* Job can be running or about to run (suspended). */
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) {
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->runtime->jobs) {
|
||||
if (wm_job->owner != owner) {
|
||||
continue;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ static void wm_jobs_update_progress_bars(wmWindowManager *wm)
|
||||
float total_progress = 0.0f;
|
||||
float jobs_progress = 0;
|
||||
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) {
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->runtime->jobs) {
|
||||
if (wm_job->threads.first && !wm_job->ready) {
|
||||
if (wm_job->flag & WM_JOB_PROGRESS) {
|
||||
/* Accumulate global progress for running jobs. */
|
||||
@@ -414,7 +414,7 @@ static void wm_jobs_test_suspend_stop(wmWindowManager *wm, wmJob *test)
|
||||
}
|
||||
else {
|
||||
/* Check other jobs. */
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) {
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->runtime->jobs) {
|
||||
/* Obvious case, no test needed. */
|
||||
if (wm_job == test || !wm_job->running) {
|
||||
continue;
|
||||
@@ -530,7 +530,7 @@ static void wm_job_end(wmWindowManager *wm, wmJob *wm_job)
|
||||
|
||||
static void wm_job_free(wmWindowManager *wm, wmJob *wm_job)
|
||||
{
|
||||
BLI_remlink(&wm->jobs, wm_job);
|
||||
BLI_remlink(&wm->runtime->jobs, wm_job);
|
||||
WM_job_main_thread_lock_release(wm_job);
|
||||
BLI_ticket_mutex_free(wm_job->main_thread_mutex);
|
||||
|
||||
@@ -578,7 +578,7 @@ void WM_jobs_kill_all(wmWindowManager *wm)
|
||||
{
|
||||
wmJob *wm_job;
|
||||
|
||||
while ((wm_job = static_cast<wmJob *>(wm->jobs.first))) {
|
||||
while ((wm_job = static_cast<wmJob *>(wm->runtime->jobs.first))) {
|
||||
wm_jobs_kill_job(wm, wm_job);
|
||||
}
|
||||
|
||||
@@ -588,7 +588,7 @@ void WM_jobs_kill_all(wmWindowManager *wm)
|
||||
|
||||
void WM_jobs_kill_all_except(wmWindowManager *wm, const void *owner)
|
||||
{
|
||||
LISTBASE_FOREACH_MUTABLE (wmJob *, wm_job, &wm->jobs) {
|
||||
LISTBASE_FOREACH_MUTABLE (wmJob *, wm_job, &wm->runtime->jobs) {
|
||||
if (wm_job->owner != owner) {
|
||||
wm_jobs_kill_job(wm, wm_job);
|
||||
}
|
||||
@@ -599,7 +599,7 @@ void WM_jobs_kill_type(wmWindowManager *wm, const void *owner, int job_type)
|
||||
{
|
||||
BLI_assert(job_type != WM_JOB_TYPE_ANY);
|
||||
|
||||
LISTBASE_FOREACH_MUTABLE (wmJob *, wm_job, &wm->jobs) {
|
||||
LISTBASE_FOREACH_MUTABLE (wmJob *, wm_job, &wm->runtime->jobs) {
|
||||
if (owner && wm_job->owner != owner) {
|
||||
continue;
|
||||
}
|
||||
@@ -612,7 +612,7 @@ void WM_jobs_kill_type(wmWindowManager *wm, const void *owner, int job_type)
|
||||
|
||||
void WM_jobs_kill_all_from_owner(wmWindowManager *wm, const void *owner)
|
||||
{
|
||||
LISTBASE_FOREACH_MUTABLE (wmJob *, wm_job, &wm->jobs) {
|
||||
LISTBASE_FOREACH_MUTABLE (wmJob *, wm_job, &wm->runtime->jobs) {
|
||||
if (wm_job->owner == owner) {
|
||||
wm_jobs_kill_job(wm, wm_job);
|
||||
}
|
||||
@@ -623,7 +623,7 @@ void WM_jobs_stop_type(wmWindowManager *wm, const void *owner, eWM_JobType job_t
|
||||
{
|
||||
BLI_assert(job_type != WM_JOB_TYPE_ANY);
|
||||
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) {
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->runtime->jobs) {
|
||||
if (owner && wm_job->owner != owner) {
|
||||
continue;
|
||||
}
|
||||
@@ -637,7 +637,7 @@ void WM_jobs_stop_type(wmWindowManager *wm, const void *owner, eWM_JobType job_t
|
||||
|
||||
void WM_jobs_stop_all_from_owner(wmWindowManager *wm, const void *owner)
|
||||
{
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) {
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->runtime->jobs) {
|
||||
if (wm_job->owner == owner) {
|
||||
if (wm_job->running) {
|
||||
wm_job->worker_status.stop = true;
|
||||
@@ -648,7 +648,7 @@ void WM_jobs_stop_all_from_owner(wmWindowManager *wm, const void *owner)
|
||||
|
||||
void wm_jobs_timer_end(wmWindowManager *wm, wmTimer *wt)
|
||||
{
|
||||
wmJob *wm_job = static_cast<wmJob *>(BLI_findptr(&wm->jobs, wt, offsetof(wmJob, wt)));
|
||||
wmJob *wm_job = static_cast<wmJob *>(BLI_findptr(&wm->runtime->jobs, wt, offsetof(wmJob, wt)));
|
||||
if (wm_job) {
|
||||
wm_jobs_kill_job(wm, wm_job);
|
||||
}
|
||||
@@ -656,7 +656,7 @@ void wm_jobs_timer_end(wmWindowManager *wm, wmTimer *wt)
|
||||
|
||||
void wm_jobs_timer(wmWindowManager *wm, wmTimer *wt)
|
||||
{
|
||||
wmJob *wm_job = static_cast<wmJob *>(BLI_findptr(&wm->jobs, wt, offsetof(wmJob, wt)));
|
||||
wmJob *wm_job = static_cast<wmJob *>(BLI_findptr(&wm->runtime->jobs, wt, offsetof(wmJob, wt)));
|
||||
|
||||
if (wm_job) {
|
||||
/* Running threads. */
|
||||
@@ -745,7 +745,7 @@ void wm_jobs_timer(wmWindowManager *wm, wmTimer *wt)
|
||||
|
||||
bool WM_jobs_has_running(const wmWindowManager *wm)
|
||||
{
|
||||
LISTBASE_FOREACH (const wmJob *, wm_job, &wm->jobs) {
|
||||
LISTBASE_FOREACH (const wmJob *, wm_job, &wm->runtime->jobs) {
|
||||
if (wm_job->running) {
|
||||
return true;
|
||||
}
|
||||
@@ -756,7 +756,7 @@ bool WM_jobs_has_running(const wmWindowManager *wm)
|
||||
|
||||
bool WM_jobs_has_running_type(const wmWindowManager *wm, int job_type)
|
||||
{
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->jobs) {
|
||||
LISTBASE_FOREACH (wmJob *, wm_job, &wm->runtime->jobs) {
|
||||
if (wm_job->running && wm_job->job_type == job_type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -290,11 +290,11 @@ static void wm_keymap_diff_item_free(wmKeyMapDiffItem *kmdi)
|
||||
|
||||
wmKeyConfig *WM_keyconfig_new(wmWindowManager *wm, const char *idname, bool user_defined)
|
||||
{
|
||||
BLI_assert(!BLI_findstring(&wm->keyconfigs, idname, offsetof(wmKeyConfig, idname)));
|
||||
BLI_assert(!BLI_findstring(&wm->runtime->keyconfigs, idname, offsetof(wmKeyConfig, idname)));
|
||||
/* Create new configuration. */
|
||||
wmKeyConfig *keyconf = MEM_callocN<wmKeyConfig>("wmKeyConfig");
|
||||
STRNCPY_UTF8(keyconf->idname, idname);
|
||||
BLI_addtail(&wm->keyconfigs, keyconf);
|
||||
BLI_addtail(&wm->runtime->keyconfigs, keyconf);
|
||||
|
||||
if (user_defined) {
|
||||
keyconf->flag |= KEYCONF_USER;
|
||||
@@ -306,7 +306,7 @@ wmKeyConfig *WM_keyconfig_new(wmWindowManager *wm, const char *idname, bool user
|
||||
wmKeyConfig *WM_keyconfig_ensure(wmWindowManager *wm, const char *idname, bool user_defined)
|
||||
{
|
||||
wmKeyConfig *keyconf = static_cast<wmKeyConfig *>(
|
||||
BLI_findstring(&wm->keyconfigs, idname, offsetof(wmKeyConfig, idname)));
|
||||
BLI_findstring(&wm->runtime->keyconfigs, idname, offsetof(wmKeyConfig, idname)));
|
||||
if (keyconf) {
|
||||
if (keyconf == wm->defaultconf) {
|
||||
/* For default configuration, we need to keep keymap
|
||||
@@ -328,14 +328,14 @@ wmKeyConfig *WM_keyconfig_ensure(wmWindowManager *wm, const char *idname, bool u
|
||||
|
||||
void WM_keyconfig_remove(wmWindowManager *wm, wmKeyConfig *keyconf)
|
||||
{
|
||||
BLI_assert(BLI_findindex(&wm->keyconfigs, keyconf) != -1);
|
||||
BLI_assert(BLI_findindex(&wm->runtime->keyconfigs, keyconf) != -1);
|
||||
if (STREQLEN(U.keyconfigstr, keyconf->idname, sizeof(U.keyconfigstr))) {
|
||||
STRNCPY(U.keyconfigstr, wm->defaultconf->idname);
|
||||
U.runtime.is_dirty = true;
|
||||
WM_keyconfig_update_tag(nullptr, nullptr);
|
||||
}
|
||||
|
||||
BLI_remlink(&wm->keyconfigs, keyconf);
|
||||
BLI_remlink(&wm->runtime->keyconfigs, keyconf);
|
||||
WM_keyconfig_free(keyconf);
|
||||
|
||||
/* Clear pointers. */
|
||||
@@ -370,7 +370,7 @@ static wmKeyConfig *WM_keyconfig_active(wmWindowManager *wm)
|
||||
|
||||
/* First try from preset. */
|
||||
keyconf = static_cast<wmKeyConfig *>(
|
||||
BLI_findstring(&wm->keyconfigs, U.keyconfigstr, offsetof(wmKeyConfig, idname)));
|
||||
BLI_findstring(&wm->runtime->keyconfigs, U.keyconfigstr, offsetof(wmKeyConfig, idname)));
|
||||
if (keyconf) {
|
||||
return keyconf;
|
||||
}
|
||||
@@ -1900,7 +1900,7 @@ void WM_keyconfig_update_ex(wmWindowManager *wm, bool keep_properties)
|
||||
/* One or more operator-types have been removed, this won't happen often
|
||||
* but when it does we have to check _every_ key-map item. */
|
||||
wm_keymap_item_properties_update_ot_from_list(&U.user_keymaps, keep_properties);
|
||||
LISTBASE_FOREACH (wmKeyConfig *, kc, &wm->keyconfigs) {
|
||||
LISTBASE_FOREACH (wmKeyConfig *, kc, &wm->runtime->keyconfigs) {
|
||||
wm_keymap_item_properties_update_ot_from_list(&kc->keymaps, keep_properties);
|
||||
}
|
||||
|
||||
|
||||
@@ -1292,7 +1292,7 @@ wmOperator *WM_operator_last_redo(const bContext *C)
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
|
||||
/* Only for operators that are registered and did an undo push. */
|
||||
LISTBASE_FOREACH_BACKWARD (wmOperator *, op, &wm->operators) {
|
||||
LISTBASE_FOREACH_BACKWARD (wmOperator *, op, &wm->runtime->operators) {
|
||||
if ((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO)) {
|
||||
return op;
|
||||
}
|
||||
@@ -2489,7 +2489,7 @@ wmPaintCursor *WM_paint_cursor_activate(short space_type,
|
||||
|
||||
wmPaintCursor *pc = MEM_callocN<wmPaintCursor>("paint cursor");
|
||||
|
||||
BLI_addtail(&wm->paintcursors, pc);
|
||||
BLI_addtail(&wm->runtime->paintcursors, pc);
|
||||
|
||||
pc->customdata = customdata;
|
||||
pc->poll = poll;
|
||||
@@ -2504,9 +2504,9 @@ wmPaintCursor *WM_paint_cursor_activate(short space_type,
|
||||
bool WM_paint_cursor_end(wmPaintCursor *handle)
|
||||
{
|
||||
wmWindowManager *wm = static_cast<wmWindowManager *>(G_MAIN->wm.first);
|
||||
LISTBASE_FOREACH (wmPaintCursor *, pc, &wm->paintcursors) {
|
||||
LISTBASE_FOREACH (wmPaintCursor *, pc, &wm->runtime->paintcursors) {
|
||||
if (pc == handle) {
|
||||
BLI_remlink(&wm->paintcursors, pc);
|
||||
BLI_remlink(&wm->runtime->paintcursors, pc);
|
||||
MEM_freeN(pc);
|
||||
return true;
|
||||
}
|
||||
@@ -2516,12 +2516,12 @@ bool WM_paint_cursor_end(wmPaintCursor *handle)
|
||||
|
||||
void WM_paint_cursor_remove_by_type(wmWindowManager *wm, void *draw_fn, void (*free)(void *))
|
||||
{
|
||||
LISTBASE_FOREACH_MUTABLE (wmPaintCursor *, pc, &wm->paintcursors) {
|
||||
LISTBASE_FOREACH_MUTABLE (wmPaintCursor *, pc, &wm->runtime->paintcursors) {
|
||||
if (pc->draw == draw_fn) {
|
||||
if (free) {
|
||||
free(pc->customdata);
|
||||
}
|
||||
BLI_remlink(&wm->paintcursors, pc);
|
||||
BLI_remlink(&wm->runtime->paintcursors, pc);
|
||||
MEM_freeN(pc);
|
||||
}
|
||||
}
|
||||
@@ -3195,8 +3195,8 @@ static wmOperatorStatus radial_control_invoke(bContext *C, wmOperator *op, const
|
||||
|
||||
/* Temporarily disable other paint cursors. */
|
||||
wmWindowManager *wm = CTX_wm_manager(C);
|
||||
rc->orig_paintcursors = wm->paintcursors;
|
||||
BLI_listbase_clear(&wm->paintcursors);
|
||||
rc->orig_paintcursors = wm->runtime->paintcursors;
|
||||
BLI_listbase_clear(&wm->runtime->paintcursors);
|
||||
|
||||
/* Add radial control paint cursor. */
|
||||
rc->cursor = WM_paint_cursor_activate(
|
||||
@@ -3237,7 +3237,7 @@ static void radial_control_cancel(bContext *C, wmOperator *op)
|
||||
WM_paint_cursor_end(static_cast<wmPaintCursor *>(rc->cursor));
|
||||
|
||||
/* Restore original paint cursors. */
|
||||
wm->paintcursors = rc->orig_paintcursors;
|
||||
wm->runtime->paintcursors = rc->orig_paintcursors;
|
||||
|
||||
/* Not sure if this is a good notifier to use;
|
||||
* intended purpose is to update the UI so that the
|
||||
|
||||
@@ -255,7 +255,7 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
|
||||
BKE_screen_area_map_free(&win->global_areas);
|
||||
|
||||
/* End running jobs, a job end also removes its timer. */
|
||||
LISTBASE_FOREACH_MUTABLE (wmTimer *, wt, &wm->timers) {
|
||||
LISTBASE_FOREACH_MUTABLE (wmTimer *, wt, &wm->runtime->timers) {
|
||||
if (wt->flags & WM_TIMER_TAGGED_FOR_REMOVAL) {
|
||||
continue;
|
||||
}
|
||||
@@ -265,7 +265,7 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
|
||||
}
|
||||
|
||||
/* Timer removing, need to call this API function. */
|
||||
LISTBASE_FOREACH_MUTABLE (wmTimer *, wt, &wm->timers) {
|
||||
LISTBASE_FOREACH_MUTABLE (wmTimer *, wt, &wm->runtime->timers) {
|
||||
if (wt->flags & WM_TIMER_TAGGED_FOR_REMOVAL) {
|
||||
continue;
|
||||
}
|
||||
@@ -1816,7 +1816,7 @@ static bool ghost_event_proc(GHOST_EventHandle ghost_event, GHOST_TUserDataPtr C
|
||||
event.type = EVT_DROP;
|
||||
event.val = KM_RELEASE;
|
||||
event.custom = EVT_DATA_DRAGDROP;
|
||||
event.customdata = &wm->drags;
|
||||
event.customdata = &wm->runtime->drags;
|
||||
event.customdata_free = true;
|
||||
|
||||
WM_event_add(win, &event);
|
||||
@@ -1913,7 +1913,7 @@ static bool wm_window_timers_process(const bContext *C, int *sleep_us_p)
|
||||
double ntime_min = DBL_MAX;
|
||||
|
||||
/* Mutable in case the timer gets removed. */
|
||||
LISTBASE_FOREACH_MUTABLE (wmTimer *, wt, &wm->timers) {
|
||||
LISTBASE_FOREACH_MUTABLE (wmTimer *, wt, &wm->runtime->timers) {
|
||||
if (wt->flags & WM_TIMER_TAGGED_FOR_REMOVAL) {
|
||||
continue;
|
||||
}
|
||||
@@ -2239,7 +2239,7 @@ eWM_CapabilitiesFlag WM_capabilities_flag()
|
||||
void WM_event_timer_sleep(wmWindowManager *wm, wmWindow * /*win*/, wmTimer *timer, bool do_sleep)
|
||||
{
|
||||
/* Extra security check. */
|
||||
if (BLI_findindex(&wm->timers, timer) == -1) {
|
||||
if (BLI_findindex(&wm->runtime->timers, timer) == -1) {
|
||||
return;
|
||||
}
|
||||
/* It's disputable if this is needed, when tagged for removal,
|
||||
@@ -2267,7 +2267,7 @@ wmTimer *WM_event_timer_add(wmWindowManager *wm,
|
||||
wt->time_step = time_step;
|
||||
wt->win = win;
|
||||
|
||||
BLI_addtail(&wm->timers, wt);
|
||||
BLI_addtail(&wm->runtime->timers, wt);
|
||||
|
||||
return wt;
|
||||
}
|
||||
@@ -2289,20 +2289,20 @@ wmTimer *WM_event_timer_add_notifier(wmWindowManager *wm,
|
||||
wt->customdata = POINTER_FROM_UINT(type);
|
||||
wt->flags |= WM_TIMER_NO_FREE_CUSTOM_DATA;
|
||||
|
||||
BLI_addtail(&wm->timers, wt);
|
||||
BLI_addtail(&wm->runtime->timers, wt);
|
||||
|
||||
return wt;
|
||||
}
|
||||
|
||||
void wm_window_timers_delete_removed(wmWindowManager *wm)
|
||||
{
|
||||
LISTBASE_FOREACH_MUTABLE (wmTimer *, wt, &wm->timers) {
|
||||
LISTBASE_FOREACH_MUTABLE (wmTimer *, wt, &wm->runtime->timers) {
|
||||
if ((wt->flags & WM_TIMER_TAGGED_FOR_REMOVAL) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Actual removal and freeing of the timer. */
|
||||
BLI_remlink(&wm->timers, wt);
|
||||
BLI_remlink(&wm->runtime->timers, wt);
|
||||
MEM_freeN(wt);
|
||||
}
|
||||
}
|
||||
@@ -2315,20 +2315,10 @@ void WM_event_timer_free_data(wmTimer *timer)
|
||||
}
|
||||
}
|
||||
|
||||
void WM_event_timers_free_all(wmWindowManager *wm)
|
||||
{
|
||||
BLI_assert_msg(BLI_listbase_is_empty(&wm->windows),
|
||||
"This should only be called when freeing the window-manager");
|
||||
while (wmTimer *timer = static_cast<wmTimer *>(BLI_pophead(&wm->timers))) {
|
||||
WM_event_timer_free_data(timer);
|
||||
MEM_freeN(timer);
|
||||
}
|
||||
}
|
||||
|
||||
void WM_event_timer_remove(wmWindowManager *wm, wmWindow * /*win*/, wmTimer *timer)
|
||||
{
|
||||
/* Extra security check. */
|
||||
if (BLI_findindex(&wm->timers, timer) == -1) {
|
||||
if (BLI_findindex(&wm->runtime->timers, timer) == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user