Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
control.h File Reference
#include <gtk/gtk.h>
#include "system/dtpthread.h"
#include <inttypes.h>
#include "control/jobs.h"
#include "control/user_message.h"
#include "control/redraw.h"
#include "control/progress.h"
#include "libs/lib.h"
#include <shobjidl.h>
+ Include dependency graph for control.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dt_control_pointer_input_t
 
struct  dt_control_t
 

Macros

#define dt_control_change_cursor(cursor)    dt_control_change_cursor_EXT((cursor), __FILE__, __LINE__)
 
#define dt_control_queue_cursor(cursor)    dt_control_queue_cursor_EXT((cursor), __FILE__, __LINE__)
 
#define dt_control_set_cursor_visible(visible)    dt_control_set_cursor_visible_EXT((visible), __FILE__, __LINE__)
 
#define DT_CTL_LOG_SIZE   10
 
#define DT_CTL_LOG_MSG_SIZE   1000
 
#define DT_CTL_LOG_TIMEOUT   8000
 
#define DT_CTL_TOAST_SIZE   10
 
#define DT_CTL_TOAST_MSG_SIZE   300
 
#define DT_CTL_TOAST_TIMEOUT   5000
 

Typedefs

typedef GdkCursorType dt_cursor_t
 
typedef struct dt_control_pointer_input_t dt_control_pointer_input_t
 
typedef struct dt_control_t dt_control_t
 

Functions

void dt_control_expose (cairo_t *cr, int width, int height)
 
void dt_control_button_pressed (double x, double y, double pressure, int which, int type, uint32_t state)
 
char * dt_get_main_message_copy (void)
 
void dt_set_main_message (char *message)
 
void dt_control_button_released (double x, double y, int which, uint32_t state)
 
void dt_control_mouse_moved (double x, double y, double pressure, int which)
 
void dt_control_set_pointer_input (const dt_control_pointer_input_t *input)
 
void dt_control_get_pointer_input (dt_control_pointer_input_t *input)
 
void dt_control_key_pressed (GdkEventKey *event)
 
void dt_control_mouse_leave ()
 
void dt_control_mouse_enter ()
 
gboolean dt_control_configure (GtkWidget *da, GdkEventConfigure *event, gpointer user_data)
 
void dt_control_draw_busy_msg (cairo_t *cr, int width, int height)
 
void dt_control_forbid_change_cursor ()
 
void dt_control_allow_change_cursor ()
 
void dt_control_change_cursor_EXT (dt_cursor_t cursor, const char *file, int line)
 
void dt_control_change_cursor_by_name (const char *curs_str)
 Apply a GTK named cursor immediately without replacing the queued cursor state.
 
void dt_control_change_cursor_by_name_and_flush (const char *curs_str)
 Apply a GTK named cursor immediately and flush display updates.
 
void dt_control_queue_cursor_EXT (dt_cursor_t cursor, const char *file, int line)
 
void dt_control_queue_cursor_by_name (const char *curs_str)
 Queue a GTK named cursor for the next cursor commit.
 
void dt_control_commit_cursor ()
 
void dt_control_set_cursor_visible_EXT (gboolean visible, const char *file, int line)
 Set whether the cursor should be visible or not.
 
void dt_control_mouse_is_dragging (gboolean state)
 
void dt_control_mouse_is_painting (gboolean state)
 
void dt_control_write_sidecar_files ()
 
void dt_control_save_xmp (const int32_t imgid)
 
void dt_control_save_xmps (const GList *imgids, const gboolean check_history)
 
void dt_control_save_xmps_forced (const GList *imgids)
 
void dt_control_delete_images ()
 
void dt_control_queue_redraw_widget (GtkWidget *widget)
 threadsafe request of redraw of specific widget. Use this function if you need to redraw a specific widget if your current thread context is not gtk main thread.
 
void dt_ctl_switch_mode_to (const char *mode)
 
void dt_ctl_switch_mode_to_by_view (const dt_view_t *view)
 
void dt_ctl_open_image_in_darkroom (const int32_t imgid)
 open one specific image in the darkroom, from any view and any thread.
 
void dt_control_hinter_message (const struct dt_control_t *s, const char *message)
 
void dt_control_init (dt_control_t *s)
 
struct dt_control_tdt_control_get_global (void)
 
void dt_control_shutdown (dt_control_t *s)
 
void dt_control_cleanup (dt_control_t *s)
 
void dt_control_quit ()
 
int dt_control_running ()
 
int32_t dt_control_get_mouse_over_id ()
 
void dt_control_set_mouse_over_id (int32_t value)
 
int32_t dt_control_get_keyboard_over_id ()
 
void dt_control_set_keyboard_over_id (int32_t value)
 

Macro Definition Documentation

◆ dt_control_change_cursor

#define dt_control_change_cursor (   cursor)     dt_control_change_cursor_EXT((cursor), __FILE__, __LINE__)

Definition at line 121 of file control.h.

◆ dt_control_queue_cursor

#define dt_control_queue_cursor (   cursor)     dt_control_queue_cursor_EXT((cursor), __FILE__, __LINE__)

Definition at line 140 of file control.h.

◆ dt_control_set_cursor_visible

#define dt_control_set_cursor_visible (   visible)     dt_control_set_cursor_visible_EXT((visible), __FILE__, __LINE__)

Definition at line 153 of file control.h.

◆ DT_CTL_LOG_MSG_SIZE

#define DT_CTL_LOG_MSG_SIZE   1000

Definition at line 194 of file control.h.

◆ DT_CTL_LOG_SIZE

#define DT_CTL_LOG_SIZE   10

Definition at line 193 of file control.h.

◆ DT_CTL_LOG_TIMEOUT

#define DT_CTL_LOG_TIMEOUT   8000

Definition at line 195 of file control.h.

◆ DT_CTL_TOAST_MSG_SIZE

#define DT_CTL_TOAST_MSG_SIZE   300

Definition at line 197 of file control.h.

◆ DT_CTL_TOAST_SIZE

#define DT_CTL_TOAST_SIZE   10

Definition at line 196 of file control.h.

◆ DT_CTL_TOAST_TIMEOUT

#define DT_CTL_TOAST_TIMEOUT   5000

Definition at line 198 of file control.h.

Typedef Documentation

◆ dt_control_pointer_input_t

◆ dt_control_t

typedef struct dt_control_t dt_control_t

this manages everything time-consuming. distributes the jobs on all processors, performs scheduling.

◆ dt_cursor_t

typedef GdkCursorType dt_cursor_t

Definition at line 71 of file control.h.

Function Documentation

◆ dt_control_allow_change_cursor()

void dt_control_allow_change_cursor ( )

◆ dt_control_button_pressed()

◆ dt_control_button_released()

void dt_control_button_released ( double  x,
double  y,
int  which,
uint32_t  state 
)

Definition at line 672 of file control.c.

References darktable, dt_view_manager_button_released(), state, darktable_t::view_manager, and x.

Referenced by _button_released().

◆ dt_control_change_cursor_by_name()

void dt_control_change_cursor_by_name ( const char *  curs_str)

Apply a GTK named cursor immediately without replacing the queued cursor state.

This is used for temporary cursors such as "progress" while synchronous UI-thread operations are running.

Apply a GTK named cursor immediately without replacing the queued cursor state.

Named cursors report GDK_CURSOR_IS_PIXMAP as their type, which is only a marker for GTK's cursor cache. The queued cursor state is owned by dt_control_queue_cursor_by_name(), so temporary named cursors such as the busy cursor do not overwrite the cursor that should be restored later.

Definition at line 283 of file control.c.

References _control_apply_cursor(), _control_store_current_cursor(), darktable_t::control, dt_control_t::current_shape, dt_control_t::current_shape_str, dt_control_t::cursor, darktable, dt_control_queue_cursor_by_name(), DT_DEBUG_CONTROL, DT_DEBUG_VERBOSE, dt_get_debug_flags(), dt_print(), dt_control_t::hide, IS_NULL_PTR, and dt_control_t::lock.

Referenced by dt_control_change_cursor_by_name_and_flush(), dt_control_commit_cursor(), and dt_control_expose().

◆ dt_control_change_cursor_by_name_and_flush()

void dt_control_change_cursor_by_name_and_flush ( const char *  curs_str)

Apply a GTK named cursor immediately and flush display updates.

This helper is intended for synchronous UI-thread work that blocks right after setting the cursor, ensuring the new shape is visible before computation starts.

Apply a GTK named cursor immediately and flush display updates.

Some synchronous UI-thread operations perform heavy work right after cursor setup. Without an explicit display flush, GTK may delay painting and the busy cursor can remain invisible until the computation already finished.

Parameters
curs_strGTK cursor name (for example "progress").

Definition at line 335 of file control.c.

References dt_control_change_cursor_by_name(), and IS_NULL_PTR.

Referenced by _cache_wait_cursor_progress(), _lib_duplicate_thumb_press_callback(), _lib_snapshot_capture_state(), _undo_announce(), and dt_iop_autoset_advance().

◆ dt_control_change_cursor_EXT()

◆ dt_control_cleanup()

◆ dt_control_commit_cursor()

◆ dt_control_configure()

gboolean dt_control_configure ( GtkWidget da,
GdkEventConfigure *  event,
gpointer  user_data 
)

Definition at line 515 of file control.c.

References darktable, dt_view_manager_configure(), TRUE, and darktable_t::view_manager.

Referenced by _configure().

◆ dt_control_delete_images()

◆ dt_control_draw_busy_msg()

void dt_control_draw_busy_msg ( cairo_t *  cr,
int  width,
int  height 
)

◆ dt_control_expose()

◆ dt_control_forbid_change_cursor()

void dt_control_forbid_change_cursor ( )

◆ dt_control_get_global()

struct dt_control_t * dt_control_get_global ( void  )

Definition at line 651 of file darktable.c.

References darktable_t::control, and darktable.

Referenced by _act_prerender(), _blendop_masks_show_and_edit(), _cache_wait_cursor_progress(), _cache_wait_cursor_restore(), _create_background_layer_from_input(), _darkroom_edge_pan_apply(), _darkroom_edge_pan_update_state(), _enqueue_surface_fetch(), _folder_survey_scan(), _lib_backgroundjobs_cancel_callback_new(), _lib_backgroundjobs_cancellable(), _lib_backgroundjobs_message_updated(), _lib_backgroundjobs_updated(), _load_for_image(), _preload_image_cache_with_max_size(), _print_button_clicked(), _schedule_main_recompute(), _set_hinter_message(), _switch_cursors(), _switch_preview_cursor(), _thumbtable_dnd_scan_folders_and_import(), _ui_log_redraw_callback(), _ui_toast_redraw_callback(), btn_make_radio_callback(), button_released(), dt_collection_hint_message_internal(), dt_control_copy_images(), dt_control_crawler_run_in_background(), dt_control_datetime(), dt_control_delete_image(), dt_control_delete_images(), dt_control_duplicate_images(), dt_control_export(), dt_control_flip_images(), dt_control_get_selected_files(), dt_control_get_threadid(), dt_control_gpx_apply(), dt_control_import(), dt_control_job_add_progress(), dt_control_job_dispose(), dt_control_job_set_progress(), dt_control_job_set_progress_message(), dt_control_job_set_state(), dt_control_merge_hdr(), dt_control_monochrome_images(), dt_control_move_images(), dt_control_refresh_exif(), dt_control_remove_images(), dt_control_reset_local_copy_images(), dt_control_save_xmp(), dt_control_save_xmps(), dt_control_save_xmps_forced(), dt_control_set_local_copy_images(), dt_control_signal_raise(), dt_dev_start_all_pipelines(), dt_dev_write_history(), dt_film_import(), dt_gui_gtk_init(), dt_printers_discovery(), dt_thumbnail_get_image_buffer(), enter(), gui_cleanup(), gui_focus(), gui_init(), key_pressed(), mouse_moved(), mouse_moved(), and mouse_moved().

◆ dt_control_get_keyboard_over_id()

◆ dt_control_get_mouse_over_id()

◆ dt_control_get_pointer_input()

void dt_control_get_pointer_input ( dt_control_pointer_input_t input)

Definition at line 83 of file control.c.

References _pointer_input, and IS_NULL_PTR.

Referenced by _build_raw_input_event(), button_pressed(), button_released(), and gui_post_expose().

◆ dt_control_hinter_message()

◆ dt_control_init()

◆ dt_control_key_pressed()

void dt_control_key_pressed ( GdkEventKey *  event)

Definition at line 667 of file control.c.

References darktable, dt_view_manager_key_pressed(), and darktable_t::view_manager.

Referenced by _key_pressed().

◆ dt_control_mouse_enter()

void dt_control_mouse_enter ( )

Definition at line 657 of file control.c.

References darktable, dt_view_manager_mouse_enter(), and darktable_t::view_manager.

Referenced by _center_enter().

◆ dt_control_mouse_is_dragging()

void dt_control_mouse_is_dragging ( gboolean  state)

◆ dt_control_mouse_is_painting()

void dt_control_mouse_is_painting ( gboolean  state)

◆ dt_control_mouse_leave()

void dt_control_mouse_leave ( )

Definition at line 652 of file control.c.

References darktable, dt_view_manager_mouse_leave(), and darktable_t::view_manager.

Referenced by _center_leave().

◆ dt_control_mouse_moved()

void dt_control_mouse_moved ( double  x,
double  y,
double  pressure,
int  which 
)

Definition at line 662 of file control.c.

References darktable, dt_view_manager_mouse_moved(), darktable_t::view_manager, and x.

Referenced by _mouse_moved().

◆ dt_control_queue_cursor_by_name()

void dt_control_queue_cursor_by_name ( const char *  curs_str)

Queue a GTK named cursor for the next cursor commit.

The cursor object is created only to validate the theme name. The queued ownership remains the string because GTK exposes named cursors as GDK_CURSOR_IS_PIXMAP, which cannot be passed back to gdk_cursor_new_for_display().

Definition at line 407 of file control.c.

References darktable_t::control, dt_control_t::cursor, darktable, IS_NULL_PTR, and dt_control_t::shape_str.

Referenced by _darkroom_set_default_cursor(), _set_cursor_shape(), _switch_cursors(), _switch_preview_cursor(), dt_control_change_cursor_by_name(), gui_post_expose(), mouse_leave(), and mouse_moved().

◆ dt_control_queue_cursor_EXT()

void dt_control_queue_cursor_EXT ( dt_cursor_t  cursor,
const char *  file,
int  line 
)

◆ dt_control_queue_redraw_widget()

◆ dt_control_quit()

◆ dt_control_running()

◆ dt_control_save_xmp()

◆ dt_control_save_xmps()

◆ dt_control_save_xmps_forced()

◆ dt_control_set_cursor_visible_EXT()

void dt_control_set_cursor_visible_EXT ( gboolean  visible,
const char *  file,
int  line 
)

Set whether the cursor should be visible or not.

Cursor visibility changes are routed through a macro so the implementation can log the exact call site that requested the state transition.

Definition at line 425 of file control.c.

References darktable_t::control, dt_control_t::cursor, darktable, DT_DEBUG_CONTROL, DT_DEBUG_VERBOSE, dt_get_debug_flags(), dt_print(), and dt_control_t::hide.

◆ dt_control_set_keyboard_over_id()

◆ dt_control_set_mouse_over_id()

◆ dt_control_set_pointer_input()

void dt_control_set_pointer_input ( const dt_control_pointer_input_t input)

Definition at line 77 of file control.c.

References _pointer_input, and IS_NULL_PTR.

Referenced by _button_pressed(), _button_released(), and _mouse_moved().

◆ dt_control_shutdown()

◆ dt_control_write_sidecar_files()

void dt_control_write_sidecar_files ( )

Definition at line 323 of file control_jobs.c.

References dt_act_on_get_images(), dt_control_save_xmps_forced(), and IS_NULL_PTR.

Referenced by append_run().

◆ dt_ctl_open_image_in_darkroom()

void dt_ctl_open_image_in_darkroom ( const int32_t  imgid)

open one specific image in the darkroom, from any view and any thread.

The darkroom picks the image it opens from the mouse-over id, falling back on the selection. Both are volatile: a pointer motion rewrites the mouse-over id, and leaving the darkroom restores the selection to the image it was editing. A caller that knows which image it wants – an import job, a background task – must therefore not publish the target and request the view switch separately: it has to happen in one go on the GUI thread, which is what this does.

Parameters
imgidthe image to open. The caller owns this contract: an id that names no image only gets the darkroom to refuse the switch and log "No image to open".

Definition at line 745 of file control.c.

References _dt_ctl_open_image_in_darkroom().

Referenced by _dt_collection_change_view_after_import().

◆ dt_ctl_switch_mode_to()

◆ dt_ctl_switch_mode_to_by_view()

void dt_ctl_switch_mode_to_by_view ( const dt_view_t view)

◆ dt_get_main_message_copy()

char * dt_get_main_message_copy ( void  )

Message painted over the main preview while the pipeline is working. Written by the pipeline (develop/pixelpipe_hb.c) from WORKER threads, rendered by control/control.c on the GUI thread; the storage belongs to the orchestrator and carries its own lock.

dt_set_main_message() TAKES OWNERSHIP of message and frees the previous one; pass NULL to clear. The reader gets a COPY it must free – there is no safe way to lend the pointer, since the next write frees it and the writer is on another thread.

Definition at line 583 of file darktable.c.

References _main_message_lock, copy(), darktable, dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), IS_NULL_PTR, and darktable_t::main_message.

Referenced by dt_control_draw_busy_msg().

◆ dt_set_main_message()

void dt_set_main_message ( char *  message)