File: overrides-Gio-Enable-platform-specific-wrappers-only-on-n.patch

package info (click to toggle)
cjs 128.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,264 kB
  • sloc: cpp: 34,377; javascript: 27,762; ansic: 13,033; sh: 1,611; python: 780; xml: 116; makefile: 38
file content (41 lines) | stat: -rw-r--r-- 1,627 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Fri, 12 Sep 2025 00:37:36 +0200
Subject: overrides/Gio: Enable platform-specific wrappers only on newer GLib

---
 modules/core/overrides/Gio.js | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/modules/core/overrides/Gio.js b/modules/core/overrides/Gio.js
index eaa12db..27041a1 100644
--- a/modules/core/overrides/Gio.js
+++ b/modules/core/overrides/Gio.js
@@ -484,16 +484,19 @@ function _init() {
 
     Gio.Application.prototype.runAsync = GLib.MainLoop.prototype.runAsync;
 
-    // Redefine Gio functions with platform-specific implementations to be
-    // backward compatible with gi-repository 1.0, however when possible we
-    // notify a deprecation warning, to ensure that the surrounding code is
-    // updated.
-    try {
-        GioPlatform = imports.gi.GioUnix;
-    } catch {
+    if (GLib.MAJOR_VERSION > 2 ||
+        (GLib.MAJOR_VERSION === 2 && GLib.MINOR_VERSION >= 86)) {
+        // Redefine Gio functions with platform-specific implementations to be
+        // backward compatible with gi-repository 1.0, however when possible we
+        // notify a deprecation warning, to ensure that the surrounding code is
+        // updated.
         try {
-            GioPlatform = imports.gi.GioWin32;
-        } catch {}
+            GioPlatform = imports.gi.GioUnix;
+        } catch {
+            try {
+                GioPlatform = imports.gi.GioWin32;
+            } catch {}
+        }
     }
 
     const platformName = `${GioPlatform?.__name__?.slice(3 /* 'Gio'.length */)}`;