Skip to content

Commit 97008b6

Browse files
committed
Add gdk4-win32
Signed-off-by: Marc-André Lureau <[email protected]>
1 parent 02b24e1 commit 97008b6

39 files changed

+1722
-0
lines changed

Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ members = [
2020
"gdk4-x11/sys",
2121
"gdk4-wayland",
2222
"gdk4-wayland/sys",
23+
"gdk4-win32",
24+
"gdk4-win32/sys",
2325
"gsk4",
2426
"gsk4/sys",
2527
"gtk4",

gdk4-win32/COPYRIGHT

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../COPYRIGHT

gdk4-win32/Cargo.toml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
[package]
2+
authors = ["The gtk-rs Project Developers"]
3+
description = "Rust bindings of the GDK4 Win32 library"
4+
documentation = "https://gtk-rs.org/gtk4-rs/stable/latest/docs/gdk4_win32/"
5+
edition = "2021"
6+
homepage = "https://gtk-rs.org/"
7+
keywords = ["gdk4", "gdk4-win32", "gtk-rs", "gnome", "GUI"]
8+
license = "MIT"
9+
name = "gdk4-win32"
10+
readme = "README.md"
11+
repository = "https://github.com/gtk-rs/gtk4-rs"
12+
version = "0.6.0"
13+
rust-version = "1.63"
14+
build = "build.rs"
15+
16+
[package.metadata.docs.rs]
17+
features = ["dox"]
18+
19+
[package.metadata.system-deps.gtk4_win32]
20+
name = "gtk4-win32"
21+
version = "4"
22+
23+
[features]
24+
v4_4 = ["ffi/v4_4"]
25+
dox = ["ffi/dox", "gdk/dox", "gio/dox", "glib/dox", "egl", "win32"]
26+
egl = ["khronos-egl"]
27+
win32 = ["windows"]
28+
29+
[dependencies]
30+
libc = "0.2"
31+
khronos-egl = {version = "4.1.0", optional = true}
32+
windows = { version = "0.39.0", features = [
33+
"Win32_Foundation",
34+
"Win32_UI_WindowsAndMessaging",
35+
], optional = true }
36+
37+
[dependencies.ffi]
38+
path = "./sys"
39+
package = "gdk4-win32-sys"
40+
version = "0.6.0"
41+
42+
[dependencies.gdk]
43+
path = "../gdk4"
44+
package = "gdk4"
45+
version = "0.6.0"
46+
47+
[dependencies.gio]
48+
git = "https://github.com/gtk-rs/gtk-rs-core"
49+
version = "0.17"
50+
features = ["v2_66"]
51+
52+
[dependencies.glib]
53+
git = "https://github.com/gtk-rs/gtk-rs-core"
54+
version = "0.17"
55+
features = ["v2_66"]
56+
57+
[dev-dependencies]
58+
gir-format-check = "^0.1"
59+
shell-words = "1.0.0"
60+
tempfile = "3"
61+
62+
[build-dependencies]
63+
system-deps = "6"

gdk4-win32/Gir.toml

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
[options]
2+
girs_directories = ["../gir-files"]
3+
library = "GdkWin32"
4+
version = "4.0"
5+
min_cfg_version = "4.0.0"
6+
target_path = "."
7+
work_mode = "normal"
8+
use_gi_docgen = true
9+
single_version_file = true
10+
generate_safety_asserts = true
11+
deprecate_by_min_version = true
12+
trust_return_value_nullability = true
13+
14+
generate = [
15+
"GdkWin32.Win32DisplayManager",
16+
"GdkWin32.Win32Drag",
17+
"GdkWin32.Win32GLContext",
18+
"GdkWin32.Win32MessageFilterReturn",
19+
"GdkWin32.Win32Monitor",
20+
"GdkWin32.Win32Screen",
21+
]
22+
23+
manual = [
24+
"Gdk.Cursor",
25+
"Gdk.DisplayManager",
26+
"Gdk.DrawContext",
27+
"Gdk.Rectangle",
28+
"GdkPixbuf.Pixbuf",
29+
"win32.HCURSOR",
30+
"win32.HICON",
31+
"win32.HWND",
32+
]
33+
34+
[[object]]
35+
name = "Gdk.Device"
36+
status = "manual"
37+
final_type = false
38+
[[object.function]]
39+
name = "get_vendor_id"
40+
ignore = true # docs only, otherwise it gets picked as ExtManual
41+
[[object.function]]
42+
name = "get_product_id"
43+
ignore = true # docs only, otherwise it gets picked as ExtManual
44+
45+
[[object]]
46+
name = "Gdk.Display"
47+
status = "manual"
48+
final_type = false
49+
[[object.function]]
50+
name = "notify_startup_complete"
51+
ignore = true # docs only, otherwise it gets picked as ExtManual
52+
[[object.function]]
53+
name = "get_product_id"
54+
ignore = true # docs only, otherwise it gets picked as ExtManual
55+
56+
[[object]]
57+
name = "Gdk.Drag"
58+
status = "manual"
59+
final_type = false
60+
61+
[[object]]
62+
name = "Gdk.Event" # docs only
63+
status = "manual"
64+
final_type = false
65+
66+
[[object]]
67+
name = "Gdk.GLContext"
68+
status = "manual"
69+
final_type = false
70+
71+
[[object]]
72+
name = "Gdk.Monitor"
73+
status = "manual"
74+
final_type = false
75+
[[object.function]]
76+
name = "get_scale_factor"
77+
ignore = true # docs only, otherwise it gets picked as ExtManual
78+
79+
[[object]]
80+
name = "Gdk.Surface"
81+
status = "manual"
82+
final_type = false
83+
84+
[[object]]
85+
name = "GdkWin32.*"
86+
status = "generate"
87+
88+
[[object.function]]
89+
name = "win32_handle_table_lookup"
90+
ignore = true # to be deprecated upstream, and not clean to bind
91+
92+
[[object]]
93+
name = "GdkWin32.Win32Display"
94+
status = "generate"
95+
[[object.function]]
96+
name = "get_egl_display"
97+
manual = true
98+
99+
[[object]]
100+
name = "GdkWin32.Win32HCursor"
101+
status = "generate"
102+
# doesn't work with HANDLE
103+
# generate_builder = true
104+
[[object.function]]
105+
name = "new"
106+
manual = true
107+
[[object.property]]
108+
name = "handle"
109+
manual = true
110+
111+
[[object]]
112+
name = "GdkWin32.Win32Surface"
113+
status = "generate"
114+
# doesn't work with HANDLE
115+
[[object.function]]
116+
name = "lookup_for_display"
117+
manual = true
118+
[[object.function]]
119+
name = "get_handle"
120+
manual = true
121+
[[object.function]]
122+
name = "get_impl_hwnd"
123+
manual = true

gdk4-win32/LICENSE

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../LICENSE

gdk4-win32/README.md

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Rust GDK 4 Win32 bindings
2+
3+
The project website is [here](https://gtk-rs.org/).
4+
5+
Rust bindings of [GDK 4's Win32 backend](https://docs.gtk.org/gdk4-win32/),
6+
part of [gtk4-rs](https://github.com/gtk-rs/gtk4-rs/).
7+
8+
GDK is an intermediate layer that isolates GTK from the details of the windowing system.
9+
GDK Win32 contains functions specific to the Win32 backend.
10+
11+
## Minimum supported Rust version
12+
13+
Currently, the minimum supported Rust version is `1.63.0`.
14+
15+
## Documentation
16+
17+
- The Rust API [Stable](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gdk4_win32)/[Development](https://gtk-rs.org/gtk4-rs/git/docs/gdk4_win32/)
18+
- [The C API](https://docs.gtk.org/gdk4-win32/)
19+
- [GTK Installation instructions](https://www.gtk.org/docs/installations/)
20+
21+
## Using
22+
23+
We recommend using [crates from crates.io](https://crates.io/keywords/gtk-rs),
24+
as [demonstrated here](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/index.html#library-versions).
25+
26+
If you want to track the bleeding edge, use the git dependency instead:
27+
28+
```toml
29+
[dependencies]
30+
gdk-win32= { git = "https://github.com/gtk-rs/gtk4-rs.git", package = "gdk4-win32" }
31+
```
32+
33+
Avoid mixing versioned and git crates like this:
34+
35+
```toml
36+
# This will not compile
37+
[dependencies]
38+
gdk-x11 = {version = "0.1", package = "gdk4-x11"}
39+
gdk-win32 = { git = "https://github.com/gtk-rs/gtk4-rs.git", package = "gdk4-win32" }
40+
```
41+
42+
### Features
43+
44+
| Feature | Description |
45+
| --- | ----------- |
46+
| `v4_4` | Enable the new APIs part of GTK 4.4 |
47+
| `egl` | Integration with the [khronos-egl](https://crates.io/crates/khronos-egl) crate |
48+
| `win32` | Integration with the [windows](https://crates.io/crates/windows) crate |
49+
50+
### See Also
51+
52+
- [glib](https://crates.io/crates/glib)
53+
- [gio](https://crates.io/crates/gio)
54+
- [gsk4](https://crates.io/crates/gsk4)
55+
- [gdk4](https://crates.io/crates/gdk4)
56+
- [gtk4](https://crates.io/crates/gtk4)
57+
58+
## License
59+
60+
The Rust bindings of __gdk4-win32__ are available under the MIT License, please refer to it.

gdk4-win32/build.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// This file was generated by gir (https://github.com/gtk-rs/gir)
2+
// from ../gir-files
3+
// DO NOT EDIT
4+
5+
#[cfg(not(feature = "dox"))]
6+
use std::process;
7+
8+
#[cfg(feature = "dox")]
9+
fn main() {} // prevent linking libraries to avoid documentation failure
10+
11+
#[cfg(not(feature = "dox"))]
12+
fn main() {
13+
if let Err(s) = system_deps::Config::new().probe() {
14+
println!("cargo:warning={}", s);
15+
process::exit(1);
16+
}
17+
}

gdk4-win32/src/auto/enums.rs

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// This file was generated by gir (https://github.com/gtk-rs/gir)
2+
// from gir-files (https://github.com/gtk-rs/gir-files)
3+
// DO NOT EDIT
4+
5+
use glib::translate::*;
6+
use std::fmt;
7+
8+
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
9+
#[non_exhaustive]
10+
#[doc(alias = "GdkWin32MessageFilterReturn")]
11+
pub enum Win32MessageFilterReturn {
12+
#[doc(alias = "GDK_WIN32_MESSAGE_FILTER_CONTINUE")]
13+
Continue,
14+
#[doc(alias = "GDK_WIN32_MESSAGE_FILTER_REMOVE")]
15+
Remove,
16+
#[doc(hidden)]
17+
__Unknown(i32),
18+
}
19+
20+
impl fmt::Display for Win32MessageFilterReturn {
21+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
22+
write!(
23+
f,
24+
"Win32MessageFilterReturn::{}",
25+
match *self {
26+
Self::Continue => "Continue",
27+
Self::Remove => "Remove",
28+
_ => "Unknown",
29+
}
30+
)
31+
}
32+
}
33+
34+
#[doc(hidden)]
35+
impl IntoGlib for Win32MessageFilterReturn {
36+
type GlibType = ffi::GdkWin32MessageFilterReturn;
37+
38+
fn into_glib(self) -> ffi::GdkWin32MessageFilterReturn {
39+
match self {
40+
Self::Continue => ffi::GDK_WIN32_MESSAGE_FILTER_CONTINUE,
41+
Self::Remove => ffi::GDK_WIN32_MESSAGE_FILTER_REMOVE,
42+
Self::__Unknown(value) => value,
43+
}
44+
}
45+
}
46+
47+
#[doc(hidden)]
48+
impl FromGlib<ffi::GdkWin32MessageFilterReturn> for Win32MessageFilterReturn {
49+
unsafe fn from_glib(value: ffi::GdkWin32MessageFilterReturn) -> Self {
50+
skip_assert_initialized!();
51+
match value {
52+
ffi::GDK_WIN32_MESSAGE_FILTER_CONTINUE => Self::Continue,
53+
ffi::GDK_WIN32_MESSAGE_FILTER_REMOVE => Self::Remove,
54+
value => Self::__Unknown(value),
55+
}
56+
}
57+
}

gdk4-win32/src/auto/mod.rs

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// This file was generated by gir (https://github.com/gtk-rs/gir)
2+
// from gir-files (https://github.com/gtk-rs/gir-files)
3+
// DO NOT EDIT
4+
5+
mod win32_display;
6+
pub use self::win32_display::Win32Display;
7+
8+
mod win32_display_manager;
9+
pub use self::win32_display_manager::Win32DisplayManager;
10+
11+
mod win32_drag;
12+
pub use self::win32_drag::Win32Drag;
13+
14+
mod win32_gl_context;
15+
pub use self::win32_gl_context::Win32GLContext;
16+
17+
mod win32_hcursor;
18+
pub use self::win32_hcursor::Win32HCursor;
19+
20+
mod win32_monitor;
21+
pub use self::win32_monitor::Win32Monitor;
22+
23+
mod win32_screen;
24+
pub use self::win32_screen::Win32Screen;
25+
26+
mod win32_surface;
27+
pub use self::win32_surface::Win32Surface;
28+
29+
mod enums;
30+
pub use self::enums::Win32MessageFilterReturn;

gdk4-win32/src/auto/versions.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Generated by gir (https://github.com/gtk-rs/gir @ 818f714dc796)
2+
from gir-files (https://github.com/gtk-rs/gir-files @ 3b6fe0a33676)

0 commit comments

Comments
 (0)