Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cli/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ int main(int argc, char *arg[])
if(!g_file_test(fullname, G_FILE_TEST_IS_DIR) && dt_supported_image(fname))
{
// Import each supported image file directly
const dt_imgid_t imgid = dt_image_import(filmid, fullname, TRUE, TRUE);
const dt_imgid_t imgid = dt_image_import(filmid, fullname, TRUE, FALSE);
if(dt_is_valid_imgid(imgid))
{
id_list = g_list_append(id_list, GINT_TO_POINTER(imgid));
Expand Down Expand Up @@ -598,7 +598,7 @@ int main(int argc, char *arg[])

gchar *directory = g_path_get_dirname(input);
filmid = dt_film_new(&film, directory);
const dt_imgid_t id = dt_image_import(filmid, input, TRUE, TRUE);
const dt_imgid_t id = dt_image_import(filmid, input, TRUE, FALSE);
g_free(directory);
if(!dt_is_valid_imgid(id))
{
Expand Down
68 changes: 27 additions & 41 deletions src/common/darktable.c
Original file line number Diff line number Diff line change
Expand Up @@ -1699,7 +1699,6 @@ int dt_init(int argc,
gchar *styledir = g_build_filename(sharedir, "darktable/styles", NULL);
if(styledir)
{
dt_gui_process_events();
darktable_splash_screen_set_progress(_("importing default styles"));
dt_import_default_styles(styledir);
g_free(styledir);
Expand Down Expand Up @@ -1861,6 +1860,9 @@ int dt_init(int argc,
darktable.camctl = dt_camctl_new();
#endif

darktable.develop = malloc(sizeof(dt_develop_t));
dt_dev_init(darktable.develop, TRUE);

// The GUI must be initialized before the views, because the init()
// functions of the views depend on darktable.control->accels_* to
// register their keyboard accelerators
Expand All @@ -1881,26 +1883,16 @@ int dt_init(int argc,
!dt_gimpmode()
&& dt_get_num_threads() >= 4
&& !(dbfilename_from_command && !strcmp(dbfilename_from_command, ":memory:"));

}
else
darktable.gui = NULL;

darktable.view_manager = (dt_view_manager_t *)calloc(1, sizeof(dt_view_manager_t));
dt_view_manager_init(darktable.view_manager);

// check whether we were able to load darkroom view. if we failed,
// we'll crash everywhere later on.
if(!darktable.develop)
{
dt_print(DT_DEBUG_ALWAYS, "[dt_init] ERROR: can't init develop system, aborting.");
darktable_splash_screen_destroy();
return 1;
}

darktable_splash_screen_set_progress(_("loading processing modules"));
darktable_splash_screen_set_progress(_("loading image formats"));
darktable.imageio = (dt_imageio_t *)calloc(1, sizeof(dt_imageio_t));
dt_imageio_init(darktable.imageio);

darktable_splash_screen_set_progress(_("loading processing modules"));
// load default iop order
darktable.iop_order_list = dt_ioppr_get_iop_order_list(0, FALSE);
// load iop order rules
Expand Down Expand Up @@ -1932,20 +1924,18 @@ int dt_init(int argc,

if(init_gui)
{
darktable_splash_screen_set_progress(_("loading views"));
darktable.view_manager = (dt_view_manager_t *)calloc(1, sizeof(dt_view_manager_t));
dt_view_manager_init(darktable.view_manager);

darktable_splash_screen_set_progress(_("loading utility modules"));
darktable.lib = (dt_lib_t *)calloc(1, sizeof(dt_lib_t));
dt_lib_init(darktable.lib);

// init the gui part of views
darktable_splash_screen_set_progress(_("loading views"));
dt_view_manager_gui_init(darktable.view_manager);
}

/* init lua last, since it's user made stuff it must be in the real environment */
#ifdef USE_LUA
darktable_splash_screen_set_progress(_("initializing Lua"));
// after the following Lua startup call, we can no longer use dt_gui_process_events() or we hang;
// this also means no more calls to darktable_splash_screen_set_progress()
dt_lua_init(darktable.lua_state.state, lua_command);
#endif

Expand Down Expand Up @@ -1974,9 +1964,7 @@ int dt_init(int argc,
if(argc == 2 && !_is_directory(argv[1]))
{
// If only one image is listed, attempt to load it in darkroom
#ifndef USE_LUA // may cause UI hang since after LUA init
darktable_splash_screen_set_progress(_("importing image"));
#endif
dt_load_from_string(argv[1], TRUE, NULL);
}
else if(argc >= 2)
Expand Down Expand Up @@ -2005,16 +1993,26 @@ int dt_init(int argc,
dt_conf_set_int("performance_configuration_version_completed",
DT_CURRENT_PERFORMANCE_CONFIGURE_VERSION);
}

if(changed_xmp_files)
{
// construct the popup that asks the user how to handle images whose xmp
// files are newer than the db entry
dt_control_crawler_show_image_list(changed_xmp_files);
}
}
}
free(config_info);

if(init_gui && !dt_gimpmode() && changed_xmp_files)
{
// construct the popup that asks the user how to handle images whose xmp
// files are newer than the db entry
dt_control_crawler_show_image_list(changed_xmp_files);
// show the main window and restore its geometry to that saved in the config file
gtk_widget_show_all(dt_ui_main_window(darktable.gui->ui));
dt_gui_gtk_load_config();
dt_gui_process_events();
darktable_splash_screen_destroy();

// finally set the cursor to be the default.
// for some reason this is needed on some systems to pick up the correctly themed cursor
dt_control_change_cursor(GDK_LEFT_PTR);
}
free(config_info);

// fire up a background job to perform sidecar writes
dt_control_sidecar_synch_start();
Expand All @@ -2029,18 +2027,6 @@ int dt_init(int argc,
dt_capabilities_add("nonapple");
#endif

if(init_gui)
{
// show the main window and restore its geometry to that saved in the config file
gtk_widget_show_all(dt_ui_main_window(darktable.gui->ui));
dt_gui_gtk_load_config();
darktable_splash_screen_destroy();

// finally set the cursor to be the default.
// for some reason this is needed on some systems to pick up the correctly themed cursor
dt_control_change_cursor(GDK_LEFT_PTR);
}

dt_print(DT_DEBUG_CONTROL,
"[dt_init] startup took %f seconds", dt_get_wtime() - start_wtime);

Expand Down
9 changes: 6 additions & 3 deletions src/control/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ typedef struct async_com_data
GCond end_cond;
GMutex end_mutex;
gpointer user_data;
gboolean finished;
} async_com_data;

gboolean _async_com_callback(gpointer data)
Expand All @@ -278,6 +279,7 @@ gboolean _async_com_callback(gpointer data)
g_mutex_lock(&communication->end_mutex);
_signal_raise(communication->user_data);

communication->finished = TRUE;
g_cond_signal(&communication->end_cond);
g_mutex_unlock(&communication->end_mutex);
return G_SOURCE_REMOVE;
Expand Down Expand Up @@ -376,13 +378,14 @@ void dt_control_signal_raise(const dt_control_signal_t *ctlsig, dt_signal_t sign
}
else
{
async_com_data communication;
async_com_data communication = {};
g_mutex_init(&communication.end_mutex);
g_cond_init(&communication.end_cond);
g_mutex_lock(&communication.end_mutex);
communication.user_data = params;
g_main_context_invoke_full(NULL,G_PRIORITY_HIGH_IDLE, _async_com_callback,&communication, NULL);
g_cond_wait(&communication.end_cond,&communication.end_mutex);
g_mutex_lock(&communication.end_mutex);
while(!communication.finished)
g_cond_wait(&communication.end_cond,&communication.end_mutex);
g_mutex_unlock(&communication.end_mutex);
g_mutex_clear(&communication.end_mutex);
}
Expand Down
8 changes: 0 additions & 8 deletions src/develop/develop.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,6 @@ void dt_dev_init(dt_develop_t *dev,
dev->histogram_pre_levels_max = -1;
dev->darkroom_mouse_in_center_area = FALSE;
dev->darkroom_skip_mouse_events = FALSE;

if(darktable.gui)
{
dev->full.ppd = darktable.gui->ppd;
dev->full.dpi = darktable.gui->dpi;
dev->full.dpi_factor = darktable.gui->dpi_factor;
dev->full.widget = dt_ui_center(darktable.gui->ui);
}
}

dev->iop_instance = 0;
Expand Down
3 changes: 1 addition & 2 deletions src/gui/gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -4541,7 +4541,6 @@ void dt_gui_cursor_clear_busy()
GtkWidget *toplevel = darktable.gui->ui->main_window;
GdkWindow *window = gtk_widget_get_window(toplevel);
gdk_window_set_cursor(window, busy_prev_cursor);
dt_gui_process_events();
g_object_unref(busy_prev_cursor);
busy_prev_cursor = NULL;
dt_control_allow_change_cursor();
Expand All @@ -4554,7 +4553,7 @@ void dt_gui_process_events()
{
// process pending Gtk/GDK events; we need to limit the total calls because once the LUA
// interpreeter starts the script installer we would end up in an infinite loop
unsigned max_iter = 200;
unsigned max_iter = 1000;
while(g_main_context_iteration(NULL, FALSE) && --max_iter > 0)
continue;
}
Expand Down
9 changes: 6 additions & 3 deletions src/imageio/imageio_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,12 @@ static int dt_imageio_load_modules_format(dt_imageio_t *iio)
continue;
}
module->gui_data = NULL;
if(darktable.gui) ++darktable.gui->reset;
module->gui_init(module);
if(darktable.gui) --darktable.gui->reset;
if(darktable.gui)
{
++darktable.gui->reset;
module->gui_init(module);
--darktable.gui->reset;
}
if(module->widget) g_object_ref(module->widget);
g_free(libname);
res = g_list_insert_sorted(res, module, dt_imageio_sort_modules_format);
Expand Down
69 changes: 1 addition & 68 deletions src/libs/tools/module_toolbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,6 @@

DT_MODULE(1)

/* proxy function, to add a widget to toolbox */
static void _lib_module_toolbox_add(dt_lib_module_t *self,
GtkWidget *widget,
dt_view_type_flags_t views);


typedef struct child_data_t
{
GtkWidget * child;
dt_view_type_flags_t views;

} child_data_t;

typedef struct dt_lib_module_toolbox_t
{
GtkWidget *container;
GList * child_views;
} dt_lib_module_toolbox_t;

const char *name(dt_lib_module_t *self)
{
return _("module toolbox");
Expand Down Expand Up @@ -71,60 +52,12 @@ int position(const dt_lib_module_t *self)

void gui_init(dt_lib_module_t *self)
{
/* initialize ui widgets */
dt_lib_module_toolbox_t *d = g_malloc0(sizeof(dt_lib_module_toolbox_t));
self->data = (void *)d;

/* the toolbar container */
d->container = self->widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);

/* setup proxy */
darktable.view_manager->proxy.module_toolbox.module = self;
darktable.view_manager->proxy.module_toolbox.add = _lib_module_toolbox_add;
self->widget = darktable.view_manager->module_toolbox;
}

void gui_cleanup(dt_lib_module_t *self)
{
dt_lib_module_toolbox_t *d = self->data;
g_list_free_full(d->child_views,free);
g_free(self->data);
self->data = NULL;
}

void view_enter(dt_lib_module_t *self,
dt_view_t *old_view,
dt_view_t *new_view)
{
dt_lib_module_toolbox_t *d = self->data;
dt_view_type_flags_t nv= new_view->view(new_view);
gtk_widget_set_no_show_all(d->container, TRUE);
for(const GList *child_elt = d->child_views; child_elt; child_elt = g_list_next(child_elt))
{
child_data_t* child_data = child_elt->data;
if(child_data->views & nv)
{
gtk_widget_show_all(child_data->child);
}
else
{
gtk_widget_hide(child_data->child);
}
}
}

static void _lib_module_toolbox_add(dt_lib_module_t *self,
GtkWidget *widget,
dt_view_type_flags_t views)
{
dt_lib_module_toolbox_t *d = self->data;
gtk_box_pack_start(GTK_BOX(d->container), widget, TRUE, FALSE, 0);
gtk_widget_show_all(widget);

child_data_t *child_data = malloc(sizeof(child_data_t));
child_data->child = widget;
child_data->views = views;
d->child_views = g_list_prepend(d->child_views,child_data);

}
// clang-format off
// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
Expand Down
Loading
Loading