2016-06-29 14:33:30 -05:00
|
|
|
// 29 june 2016
|
|
|
|
#include "uipriv_unix.h"
|
|
|
|
|
|
|
|
// functions FROM THE FUTURE!
|
|
|
|
// in some cases, because being held back by LTS releases sucks :/
|
|
|
|
// in others, because parts of GTK+ being unstable until recently also sucks :/
|
|
|
|
|
|
|
|
// added in pango 1.38; we need 1.36
|
2017-02-20 16:11:52 -06:00
|
|
|
static PangoAttribute *(*newFeaturesAttr)(const gchar *features) = NULL;
|
2016-06-29 14:33:30 -05:00
|
|
|
static PangoAttribute *(*newFGAlphaAttr)(guint16 alpha) = NULL;
|
2018-03-11 19:23:18 -05:00
|
|
|
static PangoAttribute *(*newBGAlphaAttr)(guint16 alpha) = NULL;
|
2016-06-29 14:33:30 -05:00
|
|
|
|
|
|
|
// added in GTK+ 3.20; we need 3.10
|
|
|
|
static void (*gwpIterSetObjectName)(GtkWidgetPath *path, gint pos, const char *name) = NULL;
|
|
|
|
|
|
|
|
// note that we treat any error as "the symbols aren't there" (and don't care if dlclose() failed)
|
2018-05-12 12:19:35 -05:00
|
|
|
void uiprivLoadFutures(void)
|
2016-06-29 14:33:30 -05:00
|
|
|
{
|
|
|
|
void *handle;
|
|
|
|
|
|
|
|
// dlsym() walks the dependency chain, so opening the current process should be sufficient
|
|
|
|
handle = dlopen(NULL, RTLD_LAZY);
|
|
|
|
if (handle == NULL)
|
|
|
|
return;
|
|
|
|
#define GET(var, fn) *((void **) (&var)) = dlsym(handle, #fn)
|
2017-02-20 16:11:52 -06:00
|
|
|
GET(newFeaturesAttr, pango_attr_font_features_new);
|
2016-06-29 14:33:30 -05:00
|
|
|
GET(newFGAlphaAttr, pango_attr_foreground_alpha_new);
|
2018-03-11 19:23:18 -05:00
|
|
|
GET(newBGAlphaAttr, pango_attr_background_alpha_new);
|
2016-06-29 14:33:30 -05:00
|
|
|
GET(gwpIterSetObjectName, gtk_widget_path_iter_set_object_name);
|
|
|
|
dlclose(handle);
|
|
|
|
}
|
|
|
|
|
2018-05-12 12:19:35 -05:00
|
|
|
PangoAttribute *uiprivFUTURE_pango_attr_font_features_new(const gchar *features)
|
2017-02-20 16:11:52 -06:00
|
|
|
{
|
|
|
|
if (newFeaturesAttr == NULL)
|
|
|
|
return NULL;
|
|
|
|
return (*newFeaturesAttr)(features);
|
|
|
|
}
|
|
|
|
|
2018-05-12 12:19:35 -05:00
|
|
|
PangoAttribute *uiprivFUTURE_pango_attr_foreground_alpha_new(guint16 alpha)
|
2016-06-29 14:33:30 -05:00
|
|
|
{
|
|
|
|
if (newFGAlphaAttr == NULL)
|
|
|
|
return NULL;
|
|
|
|
return (*newFGAlphaAttr)(alpha);
|
|
|
|
}
|
|
|
|
|
2018-05-12 12:19:35 -05:00
|
|
|
PangoAttribute *uiprivFUTURE_pango_attr_background_alpha_new(guint16 alpha)
|
2018-03-11 19:23:18 -05:00
|
|
|
{
|
|
|
|
if (newBGAlphaAttr == NULL)
|
|
|
|
return NULL;
|
|
|
|
return (*newBGAlphaAttr)(alpha);
|
|
|
|
}
|
|
|
|
|
2018-05-12 12:19:35 -05:00
|
|
|
gboolean uiprivFUTURE_gtk_widget_path_iter_set_object_name(GtkWidgetPath *path, gint pos, const char *name)
|
2016-06-29 14:33:30 -05:00
|
|
|
{
|
|
|
|
if (gwpIterSetObjectName == NULL)
|
|
|
|
return FALSE;
|
|
|
|
(*gwpIterSetObjectName)(path, pos, name);
|
|
|
|
return TRUE;
|
|
|
|
}
|