1
0
Fork 0
forked from wry/wry

cli: print content type in tree query

This commit is contained in:
Julian Orth 2025-07-21 23:45:10 +02:00
parent 045485e4bc
commit cc785da980
5 changed files with 35 additions and 7 deletions

View file

@ -79,7 +79,7 @@ impl Global for JayCompositorGlobal {
}
fn version(&self) -> u32 {
19
20
}
fn required_caps(&self) -> ClientCaps {

View file

@ -2,11 +2,14 @@ use {
crate::{
client::{Client, ClientError},
globals::GlobalBase,
ifs::wl_surface::{
ext_session_lock_surface_v1::ExtSessionLockSurfaceV1,
x_surface::xwindow::Xwindow,
xdg_surface::{xdg_popup::XdgPopup, xdg_toplevel::XdgToplevel},
zwlr_layer_surface_v1::ZwlrLayerSurfaceV1,
ifs::{
wl_surface::{
ext_session_lock_surface_v1::ExtSessionLockSurfaceV1,
x_surface::xwindow::Xwindow,
xdg_surface::{xdg_popup::XdgPopup, xdg_toplevel::XdgToplevel},
zwlr_layer_surface_v1::ZwlrLayerSurfaceV1,
},
wp_content_type_v1,
},
leaks::Tracker,
object::{Object, Version},
@ -40,6 +43,8 @@ pub const TREE_TY_XDG_POPUP: u32 = 9;
pub const TREE_TY_LAYER_SURFACE: u32 = 10;
pub const TREE_TY_LOCK_SURFACE: u32 = 11;
const CONTENT_TYPE_SINCE: Version = Version(20);
pub struct JayTreeQuery {
pub id: JayTreeQueryId,
pub client: Rc<Client>,
@ -225,6 +230,19 @@ impl JayTreeQuery {
name: &ws.name,
});
}
if self.version >= CONTENT_TYPE_SINCE
&& let Some(ct) = data.content_type.get()
{
use wp_content_type_v1::ContentType::*;
self.client.event(ContentType {
self_id: self.id,
ty: match ct {
Photo => "photo",
Video => "video",
Game => "game",
},
});
}
}
}