#include "ui/gtk/gtk_compat.h"
#include <dlfcn.h>
#include "base/check.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/debug/leak_annotations.h"
#include "base/no_destructor.h"
#include "base/strings/string_number_conversions.h"
#include "ui/gfx/color_palette.h"
#include "ui/gtk/gtk_stubs.h"
namespace gtk {
namespace {
const char kGtkVersionFlag[] = …;
struct Gdk3Rgba { … };
struct Gdk4Rgba { … };
template <typename T>
SkColor GdkRgbaToSkColor(const T& color) { … }
void* DlOpen(const char* library_name, bool check = true) { … }
void* DlSym(void* library, const char* name) { … }
template <typename T>
auto DlCast(void* symbol) { … }
void* GetLibGio() { … }
void* GetLibGdkPixbuf() { … }
void* GetLibGdk3() { … }
void* GetLibGtk3(bool check = true) { … }
void* GetLibGtk4(bool check = true) { … }
void* GetLibGtk() { … }
bool LoadGtk3() { … }
bool LoadGtk4() { … }
bool LoadGtkImpl() { … }
gfx::Insets InsetsFromGtkBorder(const GtkBorder& border) { … }
}
bool LoadGtk() { … }
const base::Version& GtkVersion() { … }
bool GtkCheckVersion(uint32_t major, uint32_t minor, uint32_t micro) { … }
DISABLE_CFI_DLSYM
bool GtkInitCheck(int* argc, char** argv) { … }
DISABLE_CFI_DLSYM
gfx::Insets GtkStyleContextGetPadding(GtkStyleContext* context) { … }
DISABLE_CFI_DLSYM
gfx::Insets GtkStyleContextGetBorder(GtkStyleContext* context) { … }
DISABLE_CFI_DLSYM
gfx::Insets GtkStyleContextGetMargin(GtkStyleContext* context) { … }
DISABLE_CFI_DLSYM
SkColor GtkStyleContextGetColor(GtkStyleContext* context) { … }
DISABLE_CFI_DLSYM
SkColor GtkStyleContextGetBackgroundColor(GtkStyleContext* context) { … }
DISABLE_CFI_DLSYM
std::optional<SkColor> GtkStyleContextLookupColor(GtkStyleContext* context,
const gchar* color_name) { … }
DISABLE_CFI_DLSYM
bool GtkImContextFilterKeypress(GtkIMContext* context, GdkEventKey* event) { … }
DISABLE_CFI_DLSYM
bool GtkFileChooserSetCurrentFolder(GtkFileChooser* dialog,
const base::FilePath& path) { … }
DISABLE_CFI_DLSYM
void GtkRenderIcon(GtkStyleContext* context,
cairo_t* cr,
GdkPixbuf* pixbuf,
GdkTexture* texture,
double x,
double y) { … }
DISABLE_CFI_DLSYM
GtkWidget* GtkToplevelWindowNew() { … }
DISABLE_CFI_DLSYM
void GtkCssProviderLoadFromData(GtkCssProvider* css_provider,
const char* data,
gssize length) { … }
ScopedGObject<GListModel> Gtk4FileChooserGetFiles(GtkFileChooser* dialog) { … }
void GtkStyleContextGet(GtkStyleContext* context, ...) { … }
void GtkStyleContextGetStyle(GtkStyleContext* context, ...) { … }
DISABLE_CFI_DLSYM
ScopedGObject<GtkIconInfo> Gtk3IconThemeLookupByGiconForScale(
GtkIconTheme* theme,
GIcon* icon,
int size,
int scale,
GtkIconLookupFlags flags) { … }
DISABLE_CFI_DLSYM
ScopedGObject<GtkIconPaintable> Gtk4IconThemeLookupIcon(
GtkIconTheme* theme,
const char* icon_name,
const char* fallbacks[],
int size,
int scale,
GtkTextDirection direction,
GtkIconLookupFlags flags) { … }
DISABLE_CFI_DLSYM
ScopedGObject<GtkIconPaintable> Gtk4IconThemeLookupByGicon(
GtkIconTheme* theme,
GIcon* icon,
int size,
int scale,
GtkTextDirection direction,
GtkIconLookupFlags flags) { … }
DISABLE_CFI_DLSYM
GtkWidget* GtkFileChooserDialogNew(const gchar* title,
GtkWindow* parent,
GtkFileChooserAction action,
const gchar* first_button_text,
GtkResponseType first_response,
const gchar* second_button_text,
GtkResponseType second_response) { … }
DISABLE_CFI_DLSYM
GtkTreeStore* GtkTreeStoreNew(GType type) { … }
DISABLE_CFI_DLSYM
GdkEventType GdkEventGetEventType(GdkEvent* event) { … }
DISABLE_CFI_DLSYM
guint32 GdkEventGetTime(GdkEvent* event) { … }
GdkEventType GdkKeyPress() { … }
GdkEventType GdkKeyRelease() { … }
}