Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
dev_history_gui.c File Reference
#include "develop/imageop_gui.h"
#include "widgets/widget_settings.h"
#include "develop/dev_history_gui.h"
#include "develop/blend_gui.h"
#include "develop/dev_history.h"
#include "develop/gui_throttle.h"
#include "develop/develop.h"
#include "develop/imageop.h"
#include "develop/pixelpipe_hb.h"
#include "system/macros.h"
#include <gtk/gtk.h>
+ Include dependency graph for dev_history_gui.c:

Go to the source code of this file.

Data Structures

struct  dt_dev_pending_commit_t
 

Typedefs

typedef struct dt_dev_pending_commit_t dt_dev_pending_commit_t
 

Functions

static void _undo_restore_gui (dt_develop_t *dev, const int mask_edit_mode, const int request_mask_display)
 
void dt_dev_history_gui_update (dt_develop_t *dev)
 Apply history-loaded params to module GUIs.
 
static gboolean _drain_pending_commits (gpointer user_data)
 
static void _queue_pending_commit (dt_develop_t *dev, dt_iop_module_t *module, const gboolean enable)
 
void dt_dev_history_flush_pending_commits (dt_develop_t *dev)
 Run every history commit still queued for dev, now.
 
void dt_dev_history_drop_pending_commits (dt_develop_t *dev)
 Discard every history commit still queued for dev, without running it.
 
void dt_dev_add_history_item_real (dt_develop_t *dev, dt_iop_module_t *module, gboolean enable, gboolean redraw)
 Thread-safe wrapper around dt_dev_add_history_item_ext().
 
static void _commit_gui (dt_develop_t *dev, dt_iop_module_t *module)
 
void dt_dev_history_gui_init (void)
 Install the history engine's GUI handlers. Called once from dt_init() beside the other handler installs – safe under ansel-cli too, because every handler fires only for a dev with a focused GUI module, which a headless dev never has.
 

Variables

static GQueue _pending_commits = G_QUEUE_INIT
 
static guint _pending_commit_source = 0
 

Typedef Documentation

◆ dt_dev_pending_commit_t

Function Documentation

◆ _commit_gui()

static void _commit_gui ( dt_develop_t dev,
dt_iop_module_t module 
)
static

◆ _drain_pending_commits()

◆ _queue_pending_commit()

◆ _undo_restore_gui()

static void _undo_restore_gui ( dt_develop_t dev,
const int  mask_edit_mode,
const int  request_mask_display 
)
static

◆ dt_dev_add_history_item_real()

void dt_dev_add_history_item_real ( struct dt_develop_t dev,
struct dt_iop_module_t module,
gboolean  enable,
gboolean  redraw 
)

Thread-safe wrapper around dt_dev_add_history_item_ext().

Locks history mutex, invalidates pipelines, triggers recomputation and saves history. This is the typical entry point for GUI actions.

Parameters
devDevelop context.
moduleModule instance.
enableEnable state.
redrawWhether to force a GUI redraw.

Definition at line 283 of file dev_history_gui.c.

References _queue_pending_commit(), enable(), L, and void().

◆ dt_dev_history_drop_pending_commits()

void dt_dev_history_drop_pending_commits ( struct dt_develop_t dev)

Discard every history commit still queued for dev, without running it.

Last-resort counterpart to dt_dev_history_flush_pending_commits(), for a dev already too far torn down to commit to. Prefer the flush wherever the edit can still be saved.

Parameters
devthe develop context, or NULL to drop every pending request.

Definition at line 254 of file dev_history_gui.c.

References _pending_commit_source, _pending_commits, dt_dev_pending_commit_t::dev, dt_free, IS_NULL_PTR, and L.

Referenced by cleanup(), and dt_dev_cleanup().

◆ dt_dev_history_flush_pending_commits()

void dt_dev_history_flush_pending_commits ( struct dt_develop_t dev)

Run every history commit still queued for dev, now.

dt_dev_add_history_item_real() queues its commit rather than running it, so that a slider drag or a combobox scroll does not run one per step. A queued request IS the user's last edit, so it is run here, not discarded.

Any code about to tear down dev's pipe nodes, iop list or history MUST call this while dev is still whole – it is the last moment at which committing is safe, and a request draining after teardown is the darkroom race described in CLAUDE.md, which crashes far from where it is caused.

Parameters
devthe develop context, or NULL to flush every pending request.

Definition at line 218 of file dev_history_gui.c.

References _drain_pending_commits(), _pending_commit_source, _pending_commits, dt_dev_pending_commit_t::dev, dt_dev_history_commit_item_now(), dt_free, dt_gui_throttle_get_timeout_ms(), dt_dev_pending_commit_t::enable, IS_NULL_PTR, and L.

Referenced by leave().

◆ dt_dev_history_gui_init()

void dt_dev_history_gui_init ( void  )

Install the history engine's GUI handlers. Called once from dt_init() beside the other handler installs – safe under ansel-cli too, because every handler fires only for a dev with a focused GUI module, which a headless dev never has.

Definition at line 304 of file dev_history_gui.c.

References _commit_gui(), _undo_restore_gui(), dt_dev_history_set_commit_gui_handler(), and dt_dev_history_set_undo_restore_gui_handler().

Referenced by dt_init().

◆ dt_dev_history_gui_update()

Variable Documentation

◆ _pending_commit_source

guint _pending_commit_source = 0
static

◆ _pending_commits