1
0
Fork 0
forked from wry/wry

autocommit 2022-02-14 21:13:42 CET

This commit is contained in:
Julian Orth 2022-02-14 21:13:42 +01:00
parent 9b8e1ac29f
commit da6b29f138
44 changed files with 5903 additions and 364 deletions

View file

@ -1,9 +1,8 @@
pub mod xdg_popup;
pub mod xdg_toplevel;
use crate::backend::SeatId;
use crate::client::ClientError;
use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal};
use crate::ifs::wl_seat::{NodeSeatState, SeatId, WlSeatGlobal};
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::{
@ -26,6 +25,7 @@ use std::cell::Cell;
use std::fmt::Debug;
use std::rc::Rc;
use thiserror::Error;
use i4config::Direction;
#[allow(dead_code)]
const NOT_CONSTRUCTED: u32 = 1;
@ -75,6 +75,11 @@ struct PendingXdgSurfaceData {
}
pub trait XdgSurfaceExt: Debug {
fn move_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
let _ = seat;
let _ = direction;
}
fn initial_configure(self: Rc<Self>) -> Result<(), XdgSurfaceError> {
Ok(())
}
@ -137,6 +142,14 @@ impl XdgSurface {
}
}
pub fn move_focus(&self, seat: &Rc<WlSeatGlobal>, direction: Direction) {
let ext = match self.ext.get() {
None => return,
Some(e) => e,
};
ext.move_focus(seat, direction);
}
pub fn role(&self) -> XdgSurfaceRole {
self.role.get()
}

View file

@ -1,9 +1,8 @@
use crate::backend::SeatId;
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_seat::{NodeSeatState, SeatId, WlSeatGlobal};
use crate::ifs::wl_surface::xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceExt};
use crate::leaks::Tracker;
use crate::object::Object;
@ -27,6 +26,7 @@ use std::mem;
use std::ops::Deref;
use std::rc::Rc;
use thiserror::Error;
use i4config::Direction;
#[derive(Copy, Clone, Debug, FromPrimitive)]
pub enum ResizeEdge {
@ -438,6 +438,10 @@ impl Node for XdgToplevel {
self.xdg.seat_state.destroy_node(self)
}
fn do_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, _direction: Direction) {
seat.focus_toplevel(&self);
}
fn absolute_position(&self) -> Rect {
self.xdg.absolute_desired_extents.get()
}
@ -480,6 +484,14 @@ impl Node for XdgToplevel {
}
impl XdgSurfaceExt for XdgToplevel {
fn move_focus(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, direction: Direction) {
let pn = match self.parent_node.get() {
Some(pn) => pn,
_ => return,
};
pn.move_focus_from_child(seat, &*self, direction);
}
fn initial_configure(self: Rc<Self>) -> Result<(), XdgSurfaceError> {
self.send_configure(0, 0);
Ok(())