Skip to content

Commit a87455c

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

Some content is hidden

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

51 files changed

+1696
-11
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-wayland/src/auto/versions.txt

+1-1
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 @ 5b9f2e969f6e)

gdk4-wayland/sys/versions.txt

+1-1
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 @ 5b9f2e969f6e)

gdk4-win32/COPYRIGHT

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

gdk4-win32/Cargo.toml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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 = ["egl"]
24+
egl = ["khronos-egl"]
25+
26+
[dependencies]
27+
libc = "0.2"
28+
khronos-egl = {version = "4.1.0", optional = true}
29+
30+
[dependencies.ffi]
31+
path = "./sys"
32+
package = "gdk4-win32-sys"
33+
version = "0.5.0"
34+
35+
[dependencies.gdk]
36+
path = "../gdk4"
37+
package = "gdk4"
38+
version = "0.5.0"
39+
40+
[dependencies.gio]
41+
git = "https://github.com/gtk-rs/gtk-rs-core"
42+
version = "0.16"
43+
features = ["v2_66"]
44+
45+
[dependencies.glib]
46+
git = "https://github.com/gtk-rs/gtk-rs-core"
47+
version = "0.16"
48+
features = ["v2_66"]
49+
50+
[dev-dependencies]
51+
gir-format-check = "^0.1"
52+
shell-words = "1.0.0"
53+
tempfile = "3"
54+
55+
[build-dependencies]
56+
system-deps = "6"

gdk4-win32/Gir.toml

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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]]
89+
name = "GdkWin32.Win32Display"
90+
status = "generate"
91+
[[object.function]]
92+
name = "get_egl_display"
93+
manual = true
94+
95+
[[object]]
96+
name = "GdkWin32.Win32HCursor"
97+
status = "generate"
98+
# until win32 types are handled
99+
#generate_builder = true
100+
[[object.function]]
101+
name = "new"
102+
ignore = true
103+
[[object.property]]
104+
name = "handle"
105+
ignore = true
106+
107+
[[object]]
108+
name = "GdkWin32.Win32Surface"
109+
status = "generate"
110+
# until win32 types are handled
111+
[[object.function]]
112+
name = "lookup_for_display"
113+
ignore = true
114+
[[object.function]]
115+
name = "get_handle"
116+
ignore = true
117+
[[object.function]]
118+
name = "get_impl_hwnd"
119+
ignore = true

gdk4-win32/LICENSE

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

gdk4-win32/README.md

+49
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

+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.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/functions.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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+
7+
//#[doc(alias = "gdk_win32_handle_table_lookup")]
8+
//pub fn win32_handle_table_lookup(handle: win32::HWND) -> /*Unimplemented*/Option<Basic: Pointer> {
9+
// unsafe { TODO: call ffi:gdk_win32_handle_table_lookup() }
10+
//}

gdk4-win32/src/auto/mod.rs

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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;
31+
32+
pub mod functions;

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 @ 54e116a11822)
2+
from gir-files (https://github.com/gtk-rs/gir-files.git @ 5b9f2e969f6e)

0 commit comments

Comments
 (0)