Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Commit 4a4dba3

Browse files
committed
implement popups
1 parent b49074b commit 4a4dba3

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/types/shell/layer_shell.rs

+14-4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ use libc::{c_double, c_void};
2020
use wlroots_sys::{wlr_layer_surface_state, wlr_layer_surface,
2121
wlr_layer_surface_configure, wlr_layer_surface_close,
2222
wlr_layer_surface_for_each_surface, wlr_surface,
23-
wlr_layer_surface_surface_at, zwlr_layer_shell_v1_layer};
23+
wlr_layer_surface_surface_at, zwlr_layer_shell_v1_layer, wlr_xdg_popup};
2424

2525
use utils::c_to_rust_string;
2626
use errors::{HandleErr, HandleResult};
2727

28-
use {SurfaceHandle, OutputHandle};
28+
use {SurfaceHandle, OutputHandle, XdgShellSurfaceHandle};
2929

3030
#[derive(Debug)]
3131
pub struct LayerSurface {
@@ -150,8 +150,18 @@ impl LayerSurface {
150150
}
151151
}
152152

153-
// TODO Implement when xdg shell stable is implemented
154-
//pub fn popups(&self) -> Vec<>
153+
/// Get a list of all the popups for this layer surface.
154+
pub fn popups(&self) -> Vec<XdgShellSurfaceHandle> {
155+
unsafe {
156+
let mut result = vec![];
157+
wl_list_for_each!((*self.layer_surface).popups,
158+
link,
159+
(popup: wlr_xdg_popup) => {
160+
result.push(XdgShellSurfaceHandle::from_ptr((*popup).base))
161+
});
162+
result
163+
}
164+
}
155165

156166
/// Get the namespace this surface resides in.
157167
pub fn namespace(&self) -> Option<String> {

0 commit comments

Comments
 (0)