1
0
Fork 0
forked from wry/wry

autocommit 2022-04-01 01:44:10 CEST

This commit is contained in:
Julian Orth 2022-04-01 01:44:10 +02:00
parent ab4ac883ee
commit 2dd433aa04
32 changed files with 626 additions and 139 deletions

View file

@ -59,7 +59,7 @@ pub struct WlOutputGlobal {
}
impl WlOutputGlobal {
pub fn new(name: GlobalName, output: &Rc<dyn Output>) -> Self {
pub fn new(name: GlobalName, output: Rc<dyn Output>) -> Self {
Self {
name,
output: output.clone(),

View file

@ -16,7 +16,6 @@ use crate::ifs::ipc::wl_data_source::WlDataSource;
use crate::ifs::ipc::zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1;
use crate::ifs::ipc::zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1;
use crate::ifs::ipc::IpcError;
use crate::ifs::wl_output::WlOutputGlobal;
use crate::ifs::wl_seat::kb_owner::KbOwnerHolder;
use crate::ifs::wl_seat::pointer_owner::PointerOwnerHolder;
use crate::ifs::wl_seat::wl_keyboard::{WlKeyboard, WlKeyboardError, REPEAT_INFO_SINCE};
@ -27,7 +26,7 @@ use crate::leaks::Tracker;
use crate::object::{Object, ObjectId};
use crate::state::State;
use crate::tree::toplevel::ToplevelNode;
use crate::tree::{ContainerSplit, FloatNode, FoundNode, Node};
use crate::tree::{ContainerSplit, FloatNode, FoundNode, Node, OutputNode};
use crate::utils::asyncevent::AsyncEvent;
use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError;
@ -49,7 +48,7 @@ use jay_config::Direction;
use std::cell::{Cell, RefCell};
use std::collections::hash_map::Entry;
use std::mem;
use std::ops::{Deref, DerefMut};
use std::ops::{DerefMut};
use std::rc::Rc;
use thiserror::Error;
use uapi::{c, Errno, OwnedFd};
@ -123,6 +122,7 @@ pub struct WlSeatGlobal {
shortcuts: CopyHashMap<(u32, u32), Modifiers>,
queue_link: Cell<Option<LinkedNode<Rc<Self>>>>,
tree_changed_handler: Cell<Option<SpawnedFuture<()>>>,
output: CloneCell<Rc<OutputNode>>,
}
impl WlSeatGlobal {
@ -158,6 +158,7 @@ impl WlSeatGlobal {
shortcuts: Default::default(),
queue_link: Cell::new(None),
tree_changed_handler: Cell::new(None),
output: CloneCell::new(state.dummy_output.get().unwrap()),
});
let seat = slf.clone();
let future = state.eng.spawn(async move {
@ -171,15 +172,8 @@ impl WlSeatGlobal {
slf
}
pub fn get_output(&self) -> Option<Rc<WlOutputGlobal>> {
let ps = self.pointer_stack.borrow_mut();
for node in ps.deref() {
if node.is_output() {
let on = node.clone().into_output().unwrap();
return Some(on.global.clone());
}
}
None
pub fn get_output(&self) -> Rc<OutputNode> {
self.output.get()
}
pub fn mark_last_active(self: &Rc<Self>) {

View file

@ -11,7 +11,7 @@ use crate::ifs::wl_surface::xdg_surface::xdg_popup::XdgPopup;
use crate::ifs::wl_surface::WlSurface;
use crate::object::ObjectId;
use crate::tree::toplevel::ToplevelNode;
use crate::tree::{FloatNode, Node};
use crate::tree::{FloatNode, Node, OutputNode};
use crate::utils::clonecell::CloneCell;
use crate::utils::smallmap::SmallMap;
use crate::wire::WlDataOfferId;
@ -413,6 +413,10 @@ impl WlSeatGlobal {
// self.focus_xdg_surface(&n.xdg);
}
pub fn enter_output(self: &Rc<Self>, output: &Rc<OutputNode>) {
self.output.set(output.clone());
}
pub fn enter_surface(&self, n: &WlSurface, x: Fixed, y: Fixed) {
let serial = self.serial.fetch_add(1);
self.surface_pointer_event(0, n, |p| p.send_enter(serial, n.id, x, y));
@ -427,6 +431,10 @@ impl WlSeatGlobal {
self.surface_pointer_event(0, n, |p| p.send_leave(serial, n.id));
self.surface_pointer_frame(n);
}
pub fn leave_output(&self) {
self.output.set(self.state.dummy_output.get().unwrap());
}
}
// Unfocus callbacks

View file

@ -70,8 +70,9 @@ impl ZwlrLayerShellV1 {
self.client.lookup(req.output)?.global.node.get().unwrap()
} else {
for seat in self.client.state.seat_queue.rev_iter() {
if let Some(output) = seat.get_output() {
break 'get_output output.node.get().unwrap();
let output = seat.get_output();
if !output.is_dummy {
break 'get_output output;
}
}
let outputs = self.client.state.outputs.lock();