mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
* refactor: initialize libgdk stubs before use in `platform_util:Beep` Co-authored-by: Noah Gregory <noahmgregory@gmail.com> * feat: add upstream function to get libgdk handle Co-authored-by: Noah Gregory <noahmgregory@gmail.com> * fix: add missing include for libgdk support Co-authored-by: Noah Gregory <noahmgregory@gmail.com> * style: adjust comment wording and make linter happy Co-authored-by: Noah Gregory <noahmgregory@gmail.com> * style: make linter actually happy Co-authored-by: Noah Gregory <noahmgregory@gmail.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Noah Gregory <noahmgregory@gmail.com>
58 lines
1.7 KiB
Diff
58 lines
1.7 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::GetLibGdkPixbuf and gtk::GetLibGdk public
|
|
|
|
Allows embedders to get handles to the gdk_pixbuf
|
|
and gdk libraries already loaded in the process.
|
|
|
|
diff --git a/ui/gtk/gtk_compat.cc b/ui/gtk/gtk_compat.cc
|
|
index e05b4f2eb1b22d5a647cb020bae4e4052a2e735c..86524a419606bea3e7d090415fda8f2d8ce24df2 100644
|
|
--- a/ui/gtk/gtk_compat.cc
|
|
+++ b/ui/gtk/gtk_compat.cc
|
|
@@ -78,11 +78,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;
|
|
@@ -175,6 +170,15 @@ gfx::Insets InsetsFromGtkBorder(const GtkBorder& border) {
|
|
|
|
} // namespace
|
|
|
|
+void* GetLibGdkPixbuf() {
|
|
+ static void* libgdk_pixbuf = DlOpen("libgdk_pixbuf-2.0.so.0");
|
|
+ return libgdk_pixbuf;
|
|
+}
|
|
+
|
|
+void* GetLibGdk() {
|
|
+ return GtkCheckVersion(4) ? GetLibGtk4() : GetLibGdk3();
|
|
+}
|
|
+
|
|
bool LoadGtk(ui::LinuxUiBackend backend) {
|
|
static bool loaded = LoadGtkImpl(backend);
|
|
return loaded;
|
|
diff --git a/ui/gtk/gtk_compat.h b/ui/gtk/gtk_compat.h
|
|
index 841e2e8fcdbe2da4aac487badd4d352476e461a2..043c3ab4dde02ca71798034e8cb2b3f2d2677af7 100644
|
|
--- a/ui/gtk/gtk_compat.h
|
|
+++ b/ui/gtk/gtk_compat.h
|
|
@@ -42,6 +42,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 gdk library in the process.
|
|
+void* GetLibGdk();
|
|
+
|
|
// Loads libgtk and related libraries and returns true on success.
|
|
bool LoadGtk(ui::LinuxUiBackend backend);
|
|
|