Skip to content

Backport gdk4-win32 to 0.5 #1170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- "examples/**"
- "gdk4/**"
- "gdk4-wayland/**"
- "gdk4-win32/**"
- "gdk4-x11/**"
- "gsk4/**"
- "gtk4/**"
Expand All @@ -17,6 +18,7 @@ on:
- "examples/**"
- "gdk4/**"
- "gdk4-wayland/**"
- "gdk4-win32/**"
- "gdk4-x11/**"
- "gsk4/**"
- "gtk4/**"
Expand Down Expand Up @@ -148,6 +150,7 @@ jobs:
- { name: "gsk4", is_macros_crate: false }
- { name: "gdk4-x11", is_macros_crate: false }
- { name: "gdk4-wayland", is_macros_crate: false }
- { name: "gdk4-win32", is_macros_crate: false }
- { name: "gtk4-macros", is_macros_crate: true }
steps:
- uses: actions/checkout@v2
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- ".github/workflows/docs.yml"
- "gdk4/**"
- "gdk4-wayland/**"
- "gdk4-win32/**"
- "gdk4-x11/**"
- "gsk4/**"
- "gtk4/**"
Expand All @@ -17,6 +18,7 @@ on:
- ".github/workflows/docs.yml"
- "gdk4/**"
- "gdk4-wayland/**"
- "gdk4-win32/**"
- "gdk4-x11/**"
- "gsk4/**"
- "gtk4/**"
Expand Down Expand Up @@ -63,10 +65,19 @@ jobs:
--extern-html-root-url=x11=https://docs.rs/x11/latest/
--extern-html-root-url=khronos_egl=https://docs.rs/khronos-egl/latest/
--extern-html-root-url=xkb=https://docs.rs/xkb/latest/
--extern-html-root-url=windows=https://microsoft.github.io/windows-docs-rs/doc/
- uses: actions-rs/cargo@v1
with:
command: doc
args: -p gdk4 -p gdk4-sys -p gdk4-wayland -p gdk4-wayland-sys -p gdk4-x11 -p gdk4-x11-sys -p gsk4 -p gsk4-sys -p gtk4 -p gtk4-sys -p gtk4-macros --features "dox" --no-deps
args: >
-p gdk4 -p gdk4-sys
-p gdk4-wayland -p gdk4-wayland-sys
-p gdk4-win32 -p gdk4-win32-sys
-p gdk4-x11 -p gdk4-x11-sys
-p gsk4 -p gsk4-sys
-p gtk4 -p gtk4-sys
-p gtk4-macros
--features "dox" --no-deps

- name: Fix broken URLs
run: |
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/windows-msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ on:
paths:
- ".github/workflows/windows-msvc.yml"
- "gdk4/**"
- "gdk4-win32/**"
- "gsk4/**"
- "gtk4/**"
- "gtk4-macros/**"
pull_request:
paths:
- ".github/workflows/windows-msvc.yml"
- "gdk4/**"
- "gdk4-win32/**"
- "gsk4/**"
- "gtk4/**"
- "gtk4-macros/**"
Expand Down Expand Up @@ -80,7 +82,7 @@ jobs:
working-directory: /gtk
if: steps.cache.outputs.cache-hit != 'true'
run: |
meson setup builddir --prefix=C:/gnome -Ddemos=false -Dbuild-tests=false -Dmedia-gstreamer=disabled -Dbuild-examples=false -Dglib:tests=false -Dharfbuzz:tests=disabled -Dharfbuzz:docs=disabled -Dgraphene:tests=false -Dgdk-pixbuf:tests=false -Dcairo:tests=disabled
meson setup builddir --prefix=C:/gnome -Dbackend_max_links=1 -Ddemos=false -Dbuild-tests=false -Dmedia-gstreamer=disabled -Dbuild-examples=false -Dglib:tests=false -Dharfbuzz:tests=disabled -Dharfbuzz:docs=disabled -Dgraphene:tests=false -Dgdk-pixbuf:tests=false -Dcairo:tests=disabled

- name: Build and install GTK
working-directory: /gtk
Expand All @@ -103,3 +105,19 @@ jobs:
with:
command: test
args: --features v4_10,xml_validation

- name: Build gdk-win32
uses: actions-rs/cargo@v1
with:
command: build
args: --features egl,win32 --manifest-path ./gdk4-win32/Cargo.toml
- name: Clippy gdk-win32
uses: actions-rs/cargo@v1
with:
command: clippy
args: --features egl,win32 --manifest-path ./gdk4-win32/Cargo.toml
- name: Tests gdk-win32
uses: actions-rs/cargo@v1
with:
command: test
args: --features egl,win32 --manifest-path ./gdk4-win32/Cargo.toml
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ members = [
"gdk4-x11/sys",
"gdk4-wayland",
"gdk4-wayland/sys",
"gdk4-win32",
"gdk4-win32/sys",
"gsk4",
"gsk4/sys",
"gtk4",
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ A group of crates that aims to provide complete [GTK](https://gtk.org/) 4 bindin
- [GTK](./gtk4)
- [GDK](./gdk4): An intermediate layer which isolates GTK from the details of the windowing system.
- [GDK Wayland](./gdk4-wayland): Wayland backend specific functions.
- [GDK Win32](./gdk4-win32): Windows backend specific functions.
- [GDK X11](./gdk4-x11): X backend specific functions.
- [GSK](./gsk4): An intermediate layer which isolates GTK from the details of the OpenGL or Vulkan implementation.

Expand Down
1 change: 1 addition & 0 deletions gdk4-win32/COPYRIGHT
47 changes: 47 additions & 0 deletions gdk4-win32/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[package]
authors = ["The gtk-rs Project Developers"]
description = "Rust bindings of the GDK4 Win32 library"
documentation = "https://gtk-rs.org/gtk4-rs/stable/latest/docs/gdk4_win32/"
edition = "2021"
homepage = "https://gtk-rs.org/"
keywords = ["gdk4", "gdk4-win32", "gtk-rs", "gnome", "GUI"]
license = "MIT"
name = "gdk4-win32"
readme = "README.md"
repository = "https://github.com/gtk-rs/gtk4-rs"
version = "0.5.0"
rust-version = "1.63"
build = "build.rs"

[package.metadata.docs.rs]
features = ["dox"]

[package.metadata.system-deps.gtk4_win32]
name = "gtk4-win32"
version = "4"

[features]
v4_4 = ["ffi/v4_4"]
dox = ["ffi/dox", "gdk/dox", "gio/dox", "glib/dox", "egl", "win32"]
egl = ["khronos-egl"]
win32 = ["windows"]

[dependencies]
ffi = {path = "./sys", package = "gdk4-win32-sys", version = "0.5.0"}
gdk = {path = "../gdk4", package = "gdk4", version = "0.5.0"}
gio = {git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16", features = ["v2_66"]}
glib = {git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16", features = ["v2_66"]}
libc = "0.2"
khronos-egl = {version = "4.1.0", optional = true}
windows = { version = "0.41.0", features = [
"Win32_Foundation",
"Win32_UI_WindowsAndMessaging",
], optional = true }

[dev-dependencies]
gir-format-check = "^0.1"
shell-words = "1.0.0"
tempfile = "3"

[build-dependencies]
system-deps = "6"
123 changes: 123 additions & 0 deletions gdk4-win32/Gir.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
[options]
girs_directories = ["../gir-files"]
library = "GdkWin32"
version = "4.0"
min_cfg_version = "4.0.0"
target_path = "."
work_mode = "normal"
use_gi_docgen = true
single_version_file = true
generate_safety_asserts = true
deprecate_by_min_version = true
trust_return_value_nullability = true

generate = [
"GdkWin32.Win32DisplayManager",
"GdkWin32.Win32Drag",
"GdkWin32.Win32GLContext",
"GdkWin32.Win32MessageFilterReturn",
"GdkWin32.Win32Monitor",
"GdkWin32.Win32Screen",
]

manual = [
"Gdk.Cursor",
"Gdk.DisplayManager",
"Gdk.DrawContext",
"Gdk.Rectangle",
"GdkPixbuf.Pixbuf",
"win32.HCURSOR",
"win32.HICON",
"win32.HWND",
]

[[object]]
name = "Gdk.Device"
status = "manual"
final_type = false
[[object.function]]
name = "get_vendor_id"
ignore = true # docs only, otherwise it gets picked as ExtManual
[[object.function]]
name = "get_product_id"
ignore = true # docs only, otherwise it gets picked as ExtManual

[[object]]
name = "Gdk.Display"
status = "manual"
final_type = false
[[object.function]]
name = "notify_startup_complete"
ignore = true # docs only, otherwise it gets picked as ExtManual
[[object.function]]
name = "get_product_id"
ignore = true # docs only, otherwise it gets picked as ExtManual

[[object]]
name = "Gdk.Drag"
status = "manual"
final_type = false

[[object]]
name = "Gdk.Event" # docs only
status = "manual"
final_type = false

[[object]]
name = "Gdk.GLContext"
status = "manual"
final_type = false

[[object]]
name = "Gdk.Monitor"
status = "manual"
final_type = false
[[object.function]]
name = "get_scale_factor"
ignore = true # docs only, otherwise it gets picked as ExtManual

[[object]]
name = "Gdk.Surface"
status = "manual"
final_type = false

[[object]]
name = "GdkWin32.*"
status = "generate"

[[object.function]]
name = "win32_handle_table_lookup"
ignore = true # to be deprecated upstream, and not clean to bind

[[object]]
name = "GdkWin32.Win32Display"
status = "generate"
[[object.function]]
name = "get_egl_display"
manual = true

[[object]]
name = "GdkWin32.Win32HCursor"
status = "generate"
# doesn't work with HANDLE
# generate_builder = true
[[object.function]]
name = "new"
manual = true
[[object.property]]
name = "handle"
manual = true

[[object]]
name = "GdkWin32.Win32Surface"
status = "generate"
# doesn't work with HANDLE
[[object.function]]
name = "lookup_for_display"
manual = true
[[object.function]]
name = "get_handle"
manual = true
[[object.function]]
name = "get_impl_hwnd"
manual = true
1 change: 1 addition & 0 deletions gdk4-win32/LICENSE
60 changes: 60 additions & 0 deletions gdk4-win32/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Rust GDK 4 Win32 bindings

The project website is [here](https://gtk-rs.org/).

Rust bindings of [GDK 4's Win32 backend](https://docs.gtk.org/gdk4-win32/),
part of [gtk4-rs](https://github.com/gtk-rs/gtk4-rs/).

GDK is an intermediate layer that isolates GTK from the details of the windowing system.
GDK Win32 contains functions specific to the Win32 backend.

## Minimum supported Rust version

Currently, the minimum supported Rust version is `1.63.0`.

## Documentation

- 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/)
- [The C API](https://docs.gtk.org/gdk4-win32/)
- [GTK Installation instructions](https://www.gtk.org/docs/installations/)

## Using

We recommend using [crates from crates.io](https://crates.io/keywords/gtk-rs),
as [demonstrated here](https://gtk-rs.org/gtk4-rs/stable/latest/docs/gtk4/index.html#library-versions).

If you want to track the bleeding edge, use the git dependency instead:

```toml
[dependencies]
gdk-win32= { git = "https://github.com/gtk-rs/gtk4-rs.git", package = "gdk4-win32" }
```

Avoid mixing versioned and git crates like this:

```toml
# This will not compile
[dependencies]
gdk-x11 = {version = "0.1", package = "gdk4-x11"}
gdk-win32 = { git = "https://github.com/gtk-rs/gtk4-rs.git", package = "gdk4-win32" }
```

### Features

| Feature | Description |
| --- | ----------- |
| `v4_4` | Enable the new APIs part of GTK 4.4 |
| `egl` | Integration with the [khronos-egl](https://crates.io/crates/khronos-egl) crate |
| `win32` | Integration with the [windows](https://crates.io/crates/windows) crate |

### See Also

- [glib](https://crates.io/crates/glib)
- [gio](https://crates.io/crates/gio)
- [gsk4](https://crates.io/crates/gsk4)
- [gdk4](https://crates.io/crates/gdk4)
- [gtk4](https://crates.io/crates/gtk4)

## License

The Rust bindings of __gdk4-win32__ are available under the MIT License, please refer to it.
17 changes: 17 additions & 0 deletions gdk4-win32/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from ../gir-files
// DO NOT EDIT

#[cfg(not(feature = "dox"))]
use std::process;

#[cfg(feature = "dox")]
fn main() {} // prevent linking libraries to avoid documentation failure

#[cfg(not(feature = "dox"))]
fn main() {
if let Err(s) = system_deps::Config::new().probe() {
println!("cargo:warning={}", s);
process::exit(1);
}
}
Loading