Skip to content

Commit f7e5511

Browse files
elmarcobilelmoussaoui
authored andcommitted
x11: manually bind display_get_egl_display
Signed-off-by: Marc-André Lureau <[email protected]>
1 parent e541f7d commit f7e5511

File tree

5 files changed

+26
-10
lines changed

5 files changed

+26
-10
lines changed

gdk4-wayland/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ pub use gio;
99
pub use glib;
1010
pub use wayland_client;
1111

12+
#[cfg(any(feature = "v4_4", feature = "dox"))]
13+
pub use khronos_egl;
14+
1215
#[cfg(any(feature = "v4_4", feature = "dox"))]
1316
pub use xkb;
1417

gdk4-x11/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ repository = "https://github.com/gtk-rs/gtk4-rs"
1212
version = "0.2.0"
1313

1414
[features]
15-
v4_4 = ["ffi/v4_4"]
16-
dox = ["ffi/dox"]
15+
v4_4 = ["ffi/v4_4", "khronos-egl"]
16+
dox = ["ffi/dox", "khronos-egl"]
1717

1818
[package.metadata.docs.rs]
1919
features = ["dox"]
@@ -25,6 +25,7 @@ gio = {git = "https://github.com/gtk-rs/gtk-rs-core", features = ["v2_66"]}
2525
glib = {git = "https://github.com/gtk-rs/gtk-rs-core", features = ["v2_66"]}
2626
libc = "0.2"
2727
x11 = "2.18"
28+
khronos-egl = {version = "4.1.0", optional = true}
2829

2930
[dev-dependencies]
3031
gir-format-check = "^0.1"

gdk4-x11/Gir.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ generate_builder = true
102102
[[object]]
103103
name = "GdkX11.X11Display"
104104
status = "generate"
105+
[[object.function]]
106+
name = "get_egl_display"
107+
manual = true
105108
[[object.function]]
106109
name = "get_xdisplay"
107110
manual = true

gdk4-x11/src/auto/x11_display.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,6 @@ impl X11Display {
5454
}
5555
}
5656

57-
//#[cfg(any(feature = "v4_4", feature = "dox"))]
58-
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v4_4")))]
59-
//#[doc(alias = "gdk_x11_display_get_egl_display")]
60-
//#[doc(alias = "get_egl_display")]
61-
//pub fn egl_display(&self) -> /*Unimplemented*/Option<Fundamental: Pointer> {
62-
// unsafe { TODO: call ffi:gdk_x11_display_get_egl_display() }
63-
//}
64-
6557
#[cfg(any(feature = "v4_4", feature = "dox"))]
6658
#[cfg_attr(feature = "dox", doc(cfg(feature = "v4_4")))]
6759
#[doc(alias = "gdk_x11_display_get_egl_version")]

gdk4-x11/src/x11_display.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,26 @@
22

33
use crate::X11Display;
44
use glib::translate::ToGlibPtr;
5+
#[cfg(any(feature = "v4_4", feature = "dox"))]
6+
use khronos_egl as egl;
57
use x11::xlib;
68

79
impl X11Display {
10+
#[cfg(any(feature = "v4_4", feature = "dox"))]
11+
#[cfg_attr(feature = "dox", doc(cfg(feature = "v4_4")))]
12+
#[doc(alias = "gdk_x11_display_get_egl_display")]
13+
#[doc(alias = "get_egl_display")]
14+
pub fn egl_display(&self) -> Option<egl::Display> {
15+
unsafe {
16+
let ptr = ffi::gdk_x11_display_get_egl_display(self.to_glib_none().0);
17+
if ptr.is_null() {
18+
None
19+
} else {
20+
Some(egl::Display::from_ptr(ptr))
21+
}
22+
}
23+
}
24+
825
#[doc(alias = "gdk_x11_display_get_xdisplay")]
926
#[doc(alias = "get_xdisplay")]
1027
pub unsafe fn xdisplay(&self) -> *mut xlib::Display {

0 commit comments

Comments
 (0)