1
0
Fork 0
forked from wry/wry

autocommit 2022-04-07 17:31:31 CEST

This commit is contained in:
Julian Orth 2022-04-07 17:31:31 +02:00
parent 1d33088dba
commit be32036824
200 changed files with 3267 additions and 2479 deletions

View file

@ -1,11 +1,13 @@
use crate::cursor::Cursor;
use crate::ifs::wl_seat::WlSeatGlobal;
use crate::ifs::wl_surface::WlSurface;
use crate::leaks::Tracker;
use crate::rect::Rect;
use crate::render::Renderer;
use std::cell::Cell;
use std::rc::Rc;
use {
crate::{
cursor::Cursor,
ifs::{wl_seat::WlSeatGlobal, wl_surface::WlSurface},
leaks::Tracker,
rect::Rect,
render::Renderer,
},
std::{cell::Cell, rc::Rc},
};
pub struct CursorSurface {
seat: Rc<WlSeatGlobal>,

View file

@ -1,21 +1,27 @@
use crate::client::ClientError;
use crate::ifs::wl_surface::{
CommitAction, CommitContext, StackElement, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
WlSurfaceId,
use {
crate::{
client::ClientError,
ifs::wl_surface::{
CommitAction, CommitContext, StackElement, SurfaceExt, SurfaceRole, WlSurface,
WlSurfaceError, WlSurfaceId,
},
leaks::Tracker,
object::Object,
rect::Rect,
utils::{
buffd::{MsgParser, MsgParserError},
linkedlist::LinkedNode,
numcell::NumCell,
},
wire::{wl_subsurface::*, WlSubsurfaceId},
},
std::{
cell::{Cell, RefCell},
ops::Deref,
rc::Rc,
},
thiserror::Error,
};
use crate::leaks::Tracker;
use crate::object::Object;
use crate::rect::Rect;
use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError;
use crate::utils::linkedlist::LinkedNode;
use crate::utils::numcell::NumCell;
use crate::wire::wl_subsurface::*;
use crate::wire::WlSubsurfaceId;
use std::cell::{Cell, RefCell};
use std::ops::Deref;
use std::rc::Rc;
use thiserror::Error;
#[allow(dead_code)]
const BAD_SURFACE: u32 = 0;

View file

@ -1,29 +1,35 @@
pub mod xdg_popup;
pub mod xdg_toplevel;
use crate::client::ClientError;
use crate::ifs::wl_seat::NodeSeatState;
use crate::ifs::wl_surface::xdg_surface::xdg_popup::{XdgPopup, XdgPopupError};
use crate::ifs::wl_surface::xdg_surface::xdg_toplevel::XdgToplevel;
use crate::ifs::wl_surface::{
CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
use {
crate::{
client::ClientError,
ifs::{
wl_seat::NodeSeatState,
wl_surface::{
xdg_surface::{
xdg_popup::{XdgPopup, XdgPopupError},
xdg_toplevel::XdgToplevel,
},
CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
},
xdg_wm_base::XdgWmBase,
},
leaks::Tracker,
object::Object,
rect::Rect,
tree::{FindTreeResult, FoundNode, Node, WorkspaceNode},
utils::{
buffd::{MsgParser, MsgParserError},
clonecell::CloneCell,
copyhashmap::CopyHashMap,
numcell::NumCell,
},
wire::{xdg_surface::*, WlSurfaceId, XdgPopupId, XdgSurfaceId},
},
std::{cell::Cell, fmt::Debug, rc::Rc},
thiserror::Error,
};
use crate::ifs::xdg_wm_base::XdgWmBase;
use crate::leaks::Tracker;
use crate::object::Object;
use crate::rect::Rect;
use crate::tree::{FindTreeResult, FoundNode, Node, WorkspaceNode};
use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError;
use crate::utils::clonecell::CloneCell;
use crate::utils::copyhashmap::CopyHashMap;
use crate::utils::numcell::NumCell;
use crate::wire::xdg_surface::*;
use crate::wire::{WlSurfaceId, XdgPopupId, XdgSurfaceId};
use std::cell::Cell;
use std::fmt::Debug;
use std::rc::Rc;
use thiserror::Error;
#[allow(dead_code)]
const NOT_CONSTRUCTED: u32 = 1;
@ -284,13 +290,7 @@ impl XdgSurface {
x = xt;
y = yt;
}
match self.surface.find_surface_at(x, y) {
Some((node, x, y)) => {
tree.push(FoundNode { node, x, y });
FindTreeResult::AcceptsInput
}
_ => FindTreeResult::Other,
}
self.surface.find_tree_at_(x, y, tree)
}
fn update_popup_positions(&self) {

View file

@ -1,25 +1,32 @@
use crate::client::{Client, ClientError};
use crate::cursor::KnownCursor;
use crate::fixed::Fixed;
use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal};
use crate::ifs::wl_surface::xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceExt};
use crate::ifs::xdg_positioner::{XdgPositioned, XdgPositioner, CA};
use crate::leaks::Tracker;
use crate::object::Object;
use crate::rect::Rect;
use crate::render::Renderer;
use crate::tree::walker::NodeVisitor;
use crate::tree::{FindTreeResult, FoundNode, Node, NodeId, WorkspaceNode};
use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError;
use crate::utils::clonecell::CloneCell;
use crate::utils::linkedlist::LinkedNode;
use crate::wire::xdg_popup::*;
use crate::wire::XdgPopupId;
use std::cell::{Cell, RefCell};
use std::fmt::{Debug, Formatter};
use std::rc::Rc;
use thiserror::Error;
use {
crate::{
client::{Client, ClientError},
cursor::KnownCursor,
fixed::Fixed,
ifs::{
wl_seat::{NodeSeatState, WlSeatGlobal},
wl_surface::xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceExt},
xdg_positioner::{XdgPositioned, XdgPositioner, CA},
},
leaks::Tracker,
object::Object,
rect::Rect,
render::Renderer,
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, WorkspaceNode},
utils::{
buffd::{MsgParser, MsgParserError},
clonecell::CloneCell,
linkedlist::LinkedNode,
},
wire::{xdg_popup::*, XdgPopupId},
},
std::{
cell::{Cell, RefCell},
fmt::{Debug, Formatter},
rc::Rc,
},
thiserror::Error,
};
#[allow(dead_code)]
const INVALID_GRAB: u32 = 1;

View file

@ -1,33 +1,43 @@
use crate::bugs;
use crate::bugs::Bugs;
use crate::client::{Client, ClientError};
use crate::cursor::KnownCursor;
use crate::fixed::Fixed;
use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal};
use crate::ifs::wl_surface::xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceExt};
use crate::ifs::wl_surface::WlSurface;
use crate::leaks::Tracker;
use crate::object::Object;
use crate::rect::Rect;
use crate::render::Renderer;
use crate::tree::toplevel::{ToplevelData, ToplevelNode};
use crate::tree::walker::NodeVisitor;
use crate::tree::FindTreeResult;
use crate::tree::{FoundNode, Node, NodeId, ToplevelNodeId, WorkspaceNode};
use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError;
use crate::utils::clonecell::CloneCell;
use crate::wire::xdg_toplevel::*;
use crate::wire::XdgToplevelId;
use ahash::{AHashMap, AHashSet};
use jay_config::Direction;
use num_derive::FromPrimitive;
use std::cell::{Cell, RefCell};
use std::fmt::{Debug, Formatter};
use std::mem;
use std::ops::Deref;
use std::rc::Rc;
use thiserror::Error;
use {
crate::{
bugs,
bugs::Bugs,
client::{Client, ClientError},
cursor::KnownCursor,
fixed::Fixed,
ifs::{
wl_seat::{NodeSeatState, WlSeatGlobal},
wl_surface::{
xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceExt},
WlSurface,
},
},
leaks::Tracker,
object::Object,
rect::Rect,
render::Renderer,
tree::{
FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, ToplevelData, ToplevelNode,
ToplevelNodeId, WorkspaceNode,
},
utils::{
buffd::{MsgParser, MsgParserError},
clonecell::CloneCell,
},
wire::{xdg_toplevel::*, XdgToplevelId},
},
ahash::{AHashMap, AHashSet},
jay_config::Direction,
num_derive::FromPrimitive,
std::{
cell::{Cell, RefCell},
fmt::{Debug, Formatter},
mem,
ops::Deref,
rc::Rc,
},
thiserror::Error,
};
#[derive(Copy, Clone, Debug, FromPrimitive)]
pub enum ResizeEdge {

View file

@ -1,28 +1,36 @@
use crate::client::Client;
use crate::cursor::KnownCursor;
use crate::fixed::Fixed;
use crate::ifs::wl_seat::{NodeSeatState, SeatId, WlSeatGlobal};
use crate::ifs::wl_surface::{SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError};
use crate::rect::Rect;
use crate::render::Renderer;
use crate::state::State;
use crate::tree::toplevel::{ToplevelData, ToplevelNode};
use crate::tree::walker::NodeVisitor;
use crate::tree::{FindTreeResult, FoundNode, Node, NodeId, WorkspaceNode};
use crate::utils::clonecell::CloneCell;
use crate::utils::copyhashmap::CopyHashMap;
use crate::utils::linkedlist::LinkedNode;
use crate::utils::queue::AsyncQueue;
use crate::utils::smallmap::SmallMap;
use crate::wire::WlSurfaceId;
use crate::wire_xcon::CreateNotify;
use crate::xwayland::XWaylandEvent;
use bstr::BString;
use jay_config::Direction;
use std::cell::{Cell, RefCell};
use std::ops::{Deref, Not};
use std::rc::Rc;
use thiserror::Error;
use {
crate::{
client::Client,
cursor::KnownCursor,
fixed::Fixed,
ifs::{
wl_seat::{NodeSeatState, SeatId, WlSeatGlobal},
wl_surface::{SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError},
},
rect::Rect,
render::Renderer,
state::State,
tree::{
FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, ToplevelData, ToplevelNode,
WorkspaceNode,
},
utils::{
clonecell::CloneCell, copyhashmap::CopyHashMap, linkedlist::LinkedNode,
queue::AsyncQueue, smallmap::SmallMap,
},
wire::WlSurfaceId,
wire_xcon::CreateNotify,
xwayland::XWaylandEvent,
},
bstr::BString,
jay_config::Direction,
std::{
cell::{Cell, RefCell},
ops::{Deref, Not},
rc::Rc,
},
thiserror::Error,
};
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum XInputModel {
@ -275,20 +283,16 @@ impl Xwindow {
self.data.state.tree_changed();
}
Change::Map if self.data.info.wants_floating.get() => {
let ws = self
.data
.state
.root
.outputs
.lock()
.iter()
.next()
.unwrap()
.1
.workspace
.get()
.unwrap();
// todo
let ws = match self.data.state.root.outputs.lock().values().cloned().next() {
Some(output) => output.ensure_workspace(),
_ => self
.data
.state
.dummy_output
.get()
.unwrap()
.ensure_workspace(),
};
let ext = self.data.info.extents.get();
self.data
.state

View file

@ -1,26 +1,29 @@
use crate::client::{Client, ClientError};
use crate::ifs::wl_seat::NodeSeatState;
use crate::ifs::wl_surface::{
CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
use {
crate::{
client::{Client, ClientError},
ifs::{
wl_seat::NodeSeatState,
wl_surface::{
CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
},
zwlr_layer_shell_v1::{ZwlrLayerShellV1, OVERLAY},
},
leaks::Tracker,
object::Object,
rect::Rect,
render::Renderer,
tree::{FindTreeResult, FoundNode, Node, NodeId, NodeVisitor, OutputNode},
utils::{
bitflags::BitflagsExt,
buffd::{MsgParser, MsgParserError},
linkedlist::LinkedNode,
numcell::NumCell,
},
wire::{zwlr_layer_surface_v1::*, WlSurfaceId, ZwlrLayerSurfaceV1Id},
},
std::{cell::Cell, ops::Deref, rc::Rc},
thiserror::Error,
};
use crate::ifs::zwlr_layer_shell_v1::{ZwlrLayerShellV1, OVERLAY};
use crate::leaks::Tracker;
use crate::object::Object;
use crate::rect::Rect;
use crate::render::Renderer;
use crate::tree::walker::NodeVisitor;
use crate::tree::{FindTreeResult, FoundNode, Node, NodeId, OutputNode};
use crate::utils::bitflags::BitflagsExt;
use crate::utils::buffd::MsgParser;
use crate::utils::buffd::MsgParserError;
use crate::utils::linkedlist::LinkedNode;
use crate::utils::numcell::NumCell;
use crate::wire::zwlr_layer_surface_v1::*;
use crate::wire::{WlSurfaceId, ZwlrLayerSurfaceV1Id};
use std::cell::Cell;
use std::ops::Deref;
use std::rc::Rc;
use thiserror::Error;
const KI_NONE: u32 = 0;
#[allow(dead_code)]
@ -65,6 +68,7 @@ struct Pending {
margin: Cell<Option<(i32, i32, i32, i32)>>,
keyboard_interactivity: Cell<Option<u32>>,
layer: Cell<Option<u32>>,
any: Cell<bool>,
}
impl ZwlrLayerSurfaceV1 {
@ -132,6 +136,7 @@ impl ZwlrLayerSurfaceV1 {
self.pending
.size
.set(Some((req.width as _, req.height as _)));
self.pending.any.set(true);
Ok(())
}
@ -141,12 +146,14 @@ impl ZwlrLayerSurfaceV1 {
return Err(SetAnchorError::UnknownAnchor(req.anchor));
}
self.pending.anchor.set(Some(req.anchor));
self.pending.any.set(true);
Ok(())
}
fn set_exclusive_zone(&self, parser: MsgParser<'_, '_>) -> Result<(), SetExclusiveZoneError> {
let req: SetExclusiveZone = self.client.parse(self, parser)?;
self.pending.exclusive_zone.set(Some(req.zone));
self.pending.any.set(true);
Ok(())
}
@ -155,6 +162,7 @@ impl ZwlrLayerSurfaceV1 {
self.pending
.margin
.set(Some((req.top, req.right, req.bottom, req.left)));
self.pending.any.set(true);
Ok(())
}
@ -171,6 +179,7 @@ impl ZwlrLayerSurfaceV1 {
self.pending
.keyboard_interactivity
.set(Some(req.keyboard_interactivity));
self.pending.any.set(true);
Ok(())
}
@ -199,11 +208,12 @@ impl ZwlrLayerSurfaceV1 {
return Err(SetLayerError::UnknownLayer(req.layer));
}
self.pending.layer.set(Some(req.layer));
self.pending.any.set(true);
Ok(())
}
fn pre_commit(&self) -> Result<(), ZwlrLayerSurfaceV1Error> {
let mut send_configure = false;
let mut send_configure = self.pending.any.replace(false);
if let Some(size) = self.pending.size.take() {
self.size.set(size);
}
@ -370,7 +380,7 @@ impl Node for ZwlrLayerSurfaceV1 {
x,
y,
});
self.surface.find_tree_at(x, y, tree)
self.surface.find_tree_at_(x, y, tree)
}
fn render(&self, renderer: &mut Renderer, x: i32, y: i32) {