Skip to content

Commit 946c512

Browse files
committed
WIP: add gdk4-win32
Signed-off-by: Marc-André Lureau <[email protected]>
1 parent fcf8682 commit 946c512

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1658
-11
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
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-wayland/src/auto/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Generated by gir (https://github.com/gtk-rs/gir @ 54e116a11822)
2-
from gir-files (https://github.com/gtk-rs/gir-files.git @ df20f22974b6)
2+
from gir-files (https://github.com/gtk-rs/gir-files.git @ c2287d4de121)

gdk4-wayland/sys/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Generated by gir (https://github.com/gtk-rs/gir @ 54e116a11822)
2-
from gir-files (https://github.com/gtk-rs/gir-files.git @ df20f22974b6)
2+
from gir-files (https://github.com/gtk-rs/gir-files.git @ c2287d4de121)

gdk4-win32/COPYRIGHT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../COPYRIGHT

gdk4-win32/Cargo.toml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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.5.0"
13+
rust-version = "1.57"
14+
build = "build.rs"
15+
[package.metadata.docs.rs]
16+
features = ["dox"]
17+
[package.metadata.system-deps.gtk4_win32]
18+
name = "gtk4-win32"
19+
version = "4"
20+
21+
[features]
22+
v4_4 = ["ffi/v4_4"]
23+
dox = []
24+
25+
[dependencies]
26+
libc = "0.2"
27+
28+
[dependencies.ffi]
29+
path = "./sys"
30+
package = "gdk4-win32-sys"
31+
version = "0.5.0"
32+
33+
[dependencies.gdk]
34+
path = "../gdk4"
35+
package = "gdk4"
36+
version = "0.5.0"
37+
38+
[dependencies.gio]
39+
git = "https://github.com/gtk-rs/gtk-rs-core"
40+
version = "0.16"
41+
features = ["v2_66"]
42+
43+
[dependencies.glib]
44+
git = "https://github.com/gtk-rs/gtk-rs-core"
45+
version = "0.16"
46+
features = ["v2_66"]
47+
48+
[dev-dependencies]
49+
gir-format-check = "^0.1"
50+
shell-words = "1.0.0"
51+
tempfile = "3"
52+
53+
[build-dependencies]
54+
system-deps = "6"

gdk4-win32/Gir.toml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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.Win32Display",
16+
"GdkWin32.Win32DisplayManager",
17+
"GdkWin32.Win32Drag",
18+
"GdkWin32.Win32GLContext",
19+
"GdkWin32.Win32MessageFilterReturn",
20+
"GdkWin32.Win32Monitor",
21+
"GdkWin32.Win32Screen",
22+
]
23+
24+
manual = [
25+
"Gdk.Cursor",
26+
"Gdk.DisplayManager",
27+
"Gdk.DrawContext",
28+
"Gdk.Rectangle",
29+
"GdkPixbuf.Pixbuf",
30+
"win32.HCURSOR",
31+
"win32.HICON",
32+
"win32.HWND",
33+
]
34+
35+
[[object]]
36+
name = "Gdk.Device"
37+
status = "manual"
38+
final_type = false
39+
[[object.function]]
40+
name = "get_vendor_id"
41+
ignore = true # docs only, otherwise it gets picked as ExtManual
42+
[[object.function]]
43+
name = "get_product_id"
44+
ignore = true # docs only, otherwise it gets picked as ExtManual
45+
46+
[[object]]
47+
name = "Gdk.Display"
48+
status = "manual"
49+
final_type = false
50+
[[object.function]]
51+
name = "notify_startup_complete"
52+
ignore = true # docs only, otherwise it gets picked as ExtManual
53+
[[object.function]]
54+
name = "get_product_id"
55+
ignore = true # docs only, otherwise it gets picked as ExtManual
56+
57+
[[object]]
58+
name = "Gdk.Drag"
59+
status = "manual"
60+
final_type = false
61+
62+
[[object]]
63+
name = "Gdk.Event" # docs only
64+
status = "manual"
65+
final_type = false
66+
67+
[[object]]
68+
name = "Gdk.GLContext"
69+
status = "manual"
70+
final_type = false
71+
72+
[[object]]
73+
name = "Gdk.Monitor"
74+
status = "manual"
75+
final_type = false
76+
[[object.function]]
77+
name = "get_scale_factor"
78+
ignore = true # docs only, otherwise it gets picked as ExtManual
79+
80+
[[object]]
81+
name = "Gdk.Surface"
82+
status = "manual"
83+
final_type = false
84+
85+
[[object]]
86+
name = "GdkWin32.Win32HCursor"
87+
status = "generate"
88+
# until win32 types are handled
89+
#generate_builder = true
90+
[[object.function]]
91+
name = "new"
92+
ignore = true
93+
[[object.property]]
94+
name = "handle"
95+
ignore = true
96+
97+
[[object]]
98+
name = "GdkWin32.Win32Surface"
99+
status = "generate"
100+
# until win32 types are handled
101+
[[object.function]]
102+
name = "lookup_for_display"
103+
ignore = true
104+
[[object.function]]
105+
name = "get_handle"
106+
ignore = true
107+
[[object.function]]
108+
name = "get_impl_hwnd"
109+
ignore = true

gdk4-win32/LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../LICENSE

gdk4-win32/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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.57.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+
### Features
34+
35+
| Feature | Description |
36+
| --- | ----------- |
37+
| `v4_4` | Enable the new APIs part of GTK 4.4 |
38+
39+
### See Also
40+
41+
- [glib](https://crates.io/crates/glib)
42+
- [gio](https://crates.io/crates/gio)
43+
- [gsk4](https://crates.io/crates/gsk4)
44+
- [gdk4](https://crates.io/crates/gdk4)
45+
- [gtk4](https://crates.io/crates/gtk4)
46+
47+
## License
48+
49+
The Rust bindings of __gdk4-win32__ are available under the MIT License, please refer to it.

gdk4-win32/build.rs

Lines changed: 17 additions & 0 deletions
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

Lines changed: 57 additions & 0 deletions
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.git)
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

Lines changed: 30 additions & 0 deletions
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.git)
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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Generated by gir (https://github.com/gtk-rs/gir @ 54e116a11822)
2+
from gir-files (https://github.com/gtk-rs/gir-files.git @ c2287d4de121)

0 commit comments

Comments
 (0)