// Copyright (c) 2026 Storm Dragon // Authors: Storm Dragon, Angus Kola // SPDX-License-Identifier: GPL-3.0-or-later #include int cthulhu_ocr_confirm(const char *word) { if (!gtk_init_check(NULL, NULL)) return 0; GtkWidget *dialog = gtk_dialog_new_with_buttons("Confirm OCR click", NULL, GTK_DIALOG_MODAL, "_Cancel", GTK_RESPONSE_CANCEL, "_Activate", GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL); GtkWidget *content = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); gchar *message = g_strdup_printf("Activate recognized word ā€œ%sā€ at its screen position?", word); GtkWidget *label = gtk_label_new(message); g_free(message); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_container_add(GTK_CONTAINER(content), label); gtk_widget_show_all(dialog); int response = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); while (gtk_events_pending()) gtk_main_iteration(); return response == GTK_RESPONSE_OK; }