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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
//! The GTK version a runtime binds to on Linux and BSD.
//!
//! `tauri` binds one GTK version at compile time (its `gtk3`/`gtk4` features) while the runtime is
//! picked at run time, and the pointers crossing [`WindowDispatch::gtk_window`] and friends carry
//! no version information. A runtime declares the version its objects belong to with
//! [`declare_version`] so `tauri` can refuse to wrap them with mismatched bindings instead of
//! reinterpreting a GTK 3 object as a GTK 4 one.
//!
//! Note that GTK 3 and GTK 4 cannot be initialized in the same process - GTK 4 aborts when it
//! detects GTK 2/3 symbols - so a single binary can only ever run one of them.
//!
//! [`WindowDispatch::gtk_window`]: crate::WindowDispatch::gtk_window
use ;
/// GTK major version.
static ACTIVE_VERSION: AtomicU8 = new;
/// Declares the GTK version this runtime's GTK object pointers belong to.
///
/// Runtimes must call this before creating any window. The last call wins; since GTK 3 and GTK 4
/// cannot share a process, a binary that declares both is already unable to run.
/// The GTK version declared by the active runtime, or [`None`] if no runtime declared one.