Support globals with higher advertised versions than supported
Fixes launching on Gnome.
This commit is contained in:
parent
5e7f2df05e
commit
017b683af9
3 changed files with 57 additions and 5 deletions
|
|
@ -389,7 +389,8 @@ fn handle_globals<'a, C: XConnection>(
|
||||||
match global.interface {
|
match global.interface {
|
||||||
$(
|
$(
|
||||||
ref x if x == <$global>::interface().name => {
|
ref x if x == <$global>::interface().name => {
|
||||||
dh.create_global::<ServerState<C>, $global, Global>(global.version, global.clone());
|
let version = u32::min(global.version, <$global>::interface().version);
|
||||||
|
dh.create_global::<ServerState<C>, $global, Global>(version, global.clone());
|
||||||
}
|
}
|
||||||
)+
|
)+
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ impl Fixture {
|
||||||
ready = our_data.display.lock().unwrap().is_some();
|
ready = our_data.display.lock().unwrap().is_some();
|
||||||
}
|
}
|
||||||
|
|
||||||
assert!(ready, "connecting to xwayland");
|
assert!(ready, "connecting to xwayland failed");
|
||||||
|
|
||||||
let display = our_data.display.lock().unwrap().take().unwrap();
|
let display = our_data.display.lock().unwrap().take().unwrap();
|
||||||
Self {
|
Self {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use std::io::Read;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::os::fd::{AsFd, BorrowedFd, OwnedFd};
|
use std::os::fd::{AsFd, BorrowedFd, OwnedFd};
|
||||||
use std::os::unix::net::UnixStream;
|
use std::os::unix::net::UnixStream;
|
||||||
use std::sync::Mutex;
|
use std::sync::{Arc, Mutex, OnceLock};
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
use wayland_protocols::{
|
use wayland_protocols::{
|
||||||
wp::{
|
wp::{
|
||||||
|
|
@ -24,7 +24,10 @@ use wayland_protocols::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use wayland_server::{
|
use wayland_server::{
|
||||||
backend::protocol::ProtocolError,
|
backend::{
|
||||||
|
protocol::{Interface, ProtocolError},
|
||||||
|
GlobalHandler, ObjectData,
|
||||||
|
},
|
||||||
protocol::{
|
protocol::{
|
||||||
self as proto,
|
self as proto,
|
||||||
wl_buffer::WlBuffer,
|
wl_buffer::WlBuffer,
|
||||||
|
|
@ -288,9 +291,57 @@ impl Server {
|
||||||
global_noop!(ZwpRelativePointerManagerV1);
|
global_noop!(ZwpRelativePointerManagerV1);
|
||||||
global_noop!(ZxdgOutputManagerV1);
|
global_noop!(ZxdgOutputManagerV1);
|
||||||
global_noop!(WpViewporter);
|
global_noop!(WpViewporter);
|
||||||
global_noop!(WlDrm);
|
|
||||||
global_noop!(ZwpPointerConstraintsV1);
|
global_noop!(ZwpPointerConstraintsV1);
|
||||||
|
|
||||||
|
struct HandlerData;
|
||||||
|
impl ObjectData<State> for HandlerData {
|
||||||
|
fn request(
|
||||||
|
self: Arc<Self>,
|
||||||
|
_: &wayland_server::backend::Handle,
|
||||||
|
_: &mut State,
|
||||||
|
_: wayland_server::backend::ClientId,
|
||||||
|
_: wayland_server::backend::protocol::Message<
|
||||||
|
wayland_server::backend::ObjectId,
|
||||||
|
OwnedFd,
|
||||||
|
>,
|
||||||
|
) -> Option<Arc<dyn ObjectData<State>>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
fn destroyed(
|
||||||
|
self: Arc<Self>,
|
||||||
|
_: &wayland_server::backend::Handle,
|
||||||
|
_: &mut State,
|
||||||
|
_: wayland_server::backend::ClientId,
|
||||||
|
_: wayland_server::backend::ObjectId,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
struct Handler;
|
||||||
|
impl GlobalHandler<State> for Handler {
|
||||||
|
fn bind(
|
||||||
|
self: Arc<Self>,
|
||||||
|
_: &wayland_server::backend::Handle,
|
||||||
|
_: &mut State,
|
||||||
|
_: wayland_server::backend::ClientId,
|
||||||
|
_: wayland_server::backend::GlobalId,
|
||||||
|
_: wayland_server::backend::ObjectId,
|
||||||
|
) -> Arc<dyn wayland_server::backend::ObjectData<State>> {
|
||||||
|
Arc::new(HandlerData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simulate interface with higher interface than supported client side
|
||||||
|
static IF: OnceLock<Interface> = OnceLock::new();
|
||||||
|
let interface = IF.get_or_init(|| Interface {
|
||||||
|
version: WlDrm::interface().version + 1,
|
||||||
|
..*WlDrm::interface()
|
||||||
|
});
|
||||||
|
|
||||||
|
if noops {
|
||||||
|
dh.backend_handle()
|
||||||
|
.create_global(&interface, interface.version, Arc::new(Handler));
|
||||||
|
}
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
display,
|
display,
|
||||||
dh,
|
dh,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue