Go to the documentation of this file.
13 #include <boost/function.hpp>
26 auto* w =
reinterpret_cast<T*
>(data);
34 std::pair<GSourceFunc, gpointer>
wrap(T f)
36 return std::make_pair<GSourceFunc, gpointer>(Detail::gtkWrapper<T>,
new T(std::move(f)));
44 const auto& [
function, data] =
wrap(std::move(f));
45 gdk_threads_add_idle(
function, data);
52 std::packaged_task<void(
void)> t(f);
53 std::future<void>
const future = t.get_future();
73 cairo_rectangle_int_t rect;
85 inline bool operator==(cairo_rectangle_int_t
const& left, cairo_rectangle_int_t
const& right)
87 return left.x == right.x && left.y == right.y && left.width == right.width && left.height == right.height;
90 inline bool operator==(
const GdkPoint& left,
const GdkPoint& right) {
return left.x == right.x && left.y == right.y; }
92 std::ostream&
operator<<(std::ostream& os, cairo_rectangle_int_t
const& r);
93 std::ostream&
operator<<(std::ostream& os,
const GdkPoint& p);
void async_on_ui_thread(T f)
Definition: gtk-helpers.hh:42
static int gtkWrapper(gpointer data)
Definition: gtk-helpers.hh:24
GtkWindow * get_parent_window(GtkWidget *widget)
Definition: gtk-helpers.cc:17
Definition: gtk-helpers.hh:19
#define require(expr)
Definition: assertions.hh:28
void sync_on_ui_thread(T f)
Definition: gtk-helpers.hh:59
void async_on_ui_thread_and_wait(T f)
Definition: gtk-helpers.hh:49
bool on_ui_thread()
Definition: gtk-helpers.cc:15
bool operator==(cairo_rectangle_int_t const &left, cairo_rectangle_int_t const &right)
Definition: gtk-helpers.hh:85
std::pair< GSourceFunc, gpointer > wrap(T f)
Definition: gtk-helpers.hh:34
Definition: async-deleter.hh:12
std::ostream & operator<<(std::ostream &os, cairo_rectangle_int_t const &r)
Definition: rectangle.hh:309
cairo_rectangle_int_t createCairoIntRectangle(int x, int y, int width, int height)
Definition: gtk-helpers.hh:71