999a225edb
* refactor: use stubs for gdk-pixbuf dependency * Adjust build file * Add includes * Merge gdk_pixbuf stubs into gtk stubs * Split pixbuf sigs into own file again * Add initialization check * Apply PR feedback
72 lines
1.9 KiB
Diff
72 lines
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: deepak1556 <hop2deep@gmail.com>
|
|
Date: Thu, 7 Apr 2022 20:30:16 +0900
|
|
Subject: Make gtk::GetLibGtk and gtk::GetLibGdkPixbuf public
|
|
|
|
Allows embedders to get a handle to the gtk and
|
|
gdk_pixbuf libraries already loaded in the process.
|
|
|
|
diff --git a/ui/gtk/gtk_compat.cc b/ui/gtk/gtk_compat.cc
|
|
index b5c7af5bdb93b320f95252d35d2d76bae7f8c445..65b097cfab72b92f301968715eb218ef0e468567 100644
|
|
--- a/ui/gtk/gtk_compat.cc
|
|
+++ b/ui/gtk/gtk_compat.cc
|
|
@@ -66,11 +66,6 @@ void* GetLibGio() {
|
|
return libgio;
|
|
}
|
|
|
|
-void* GetLibGdkPixbuf() {
|
|
- static void* libgdk_pixbuf = DlOpen("libgdk_pixbuf-2.0.so.0");
|
|
- return libgdk_pixbuf;
|
|
-}
|
|
-
|
|
void* GetLibGdk3() {
|
|
static void* libgdk3 = DlOpen("libgdk-3.so.0");
|
|
return libgdk3;
|
|
@@ -86,12 +81,6 @@ void* GetLibGtk4(bool check = true) {
|
|
return libgtk4;
|
|
}
|
|
|
|
-void* GetLibGtk() {
|
|
- if (GtkCheckVersion(4))
|
|
- return GetLibGtk4();
|
|
- return GetLibGtk3();
|
|
-}
|
|
-
|
|
bool LoadGtk3() {
|
|
if (!GetLibGtk3(false))
|
|
return false;
|
|
@@ -134,6 +123,17 @@ gfx::Insets InsetsFromGtkBorder(const GtkBorder& border) {
|
|
|
|
} // namespace
|
|
|
|
+void* GetLibGdkPixbuf() {
|
|
+ static void* libgdk_pixbuf = DlOpen("libgdk_pixbuf-2.0.so.0");
|
|
+ return libgdk_pixbuf;
|
|
+}
|
|
+
|
|
+void* GetLibGtk() {
|
|
+ if (GtkCheckVersion(4))
|
|
+ return GetLibGtk4();
|
|
+ return GetLibGtk3();
|
|
+}
|
|
+
|
|
bool LoadGtk() {
|
|
static bool loaded = LoadGtkImpl();
|
|
return loaded;
|
|
diff --git a/ui/gtk/gtk_compat.h b/ui/gtk/gtk_compat.h
|
|
index 57e55b9e749b43d327deff449a530e1f435a8e8b..37720be9e393d192b3b7db13a007431a9ce77ddc 100644
|
|
--- a/ui/gtk/gtk_compat.h
|
|
+++ b/ui/gtk/gtk_compat.h
|
|
@@ -34,6 +34,12 @@ using SkColor = uint32_t;
|
|
|
|
namespace gtk {
|
|
|
|
+// Get handle to the currently loaded gdk_pixbuf library in the process.
|
|
+void* GetLibGdkPixbuf();
|
|
+
|
|
+// Get handle to the currently loaded gtk library in the process.
|
|
+void* GetLibGtk();
|
|
+
|
|
// Loads libgtk and related libraries and returns true on success.
|
|
bool LoadGtk();
|
|
|