/* * Xournal++ * * Xournal util functions * * @author Xournal++ Team * https://github.com/xournalpp/xournalpp * * @license GNU GPLv2 or later */ #pragma once #include #include #include #include #include #include "OutputStream.h" #include "filesystem.h" using std::string; namespace Util { pid_t getPid(); /** * Wrap the system call to redirect errors to a dialog */ void systemWithMessage(const char* command); /** * Execute the callback in the UI Thread. * * Make sure the container class is not deleted before the UI stuff is finished! */ void execInUiThread(std::function&& callback, gint priority = G_PRIORITY_DEFAULT_IDLE); gboolean paintBackgroundWhite(GtkWidget* widget, cairo_t* cr, void* unused); /** * Format coordinates to use 8 digits of precision https://m.xkcd.com/2170/ * This function directly writes to the given OutputStream. */ extern void writeCoordinateString(OutputStream* out, double xVal, double yVal); constexpr const gchar* PRECISION_FORMAT_STRING = "%.8f"; constexpr const auto DPI_NORMALIZATION_FACTOR = 72.0; } // namespace Util constexpr auto npos = std::numeric_limits::max();