deps: update for new smithay version
This commit is contained in:
parent
1ab0196502
commit
25b44fde58
11 changed files with 230 additions and 237 deletions
161
Cargo.lock
generated
161
Cargo.lock
generated
|
|
@ -4,9 +4,9 @@ version = 3
|
|||
|
||||
[[package]]
|
||||
name = "ab_glyph"
|
||||
version = "0.2.13"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61caed9aec6daeee1ea38ccf5fb225e4f96c1eeead1b4a5c267324a63cf02326"
|
||||
checksum = "24606928a235e73cdef55a0c909719cadd72fce573e5713d58cb2952d8f5794c"
|
||||
dependencies = [
|
||||
"ab_glyph_rasterizer",
|
||||
"owned_ttf_parser",
|
||||
|
|
@ -46,9 +46,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.53"
|
||||
version = "1.0.55"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94a45b455c14666b85fc40a019e8ab9eb75e3a124e05494f5397122bc9eb06e0"
|
||||
checksum = "159bb86af3a200e19a068f4224eae4c8bb2d0fa054c7e5d1cacd5cef95e684cd"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
]
|
||||
|
|
@ -93,9 +93,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.0.1"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
|
|
@ -142,9 +142,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.72"
|
||||
version = "1.0.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
|
||||
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
|
|
@ -168,19 +168,6 @@ dependencies = [
|
|||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"time",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cocoa"
|
||||
version = "0.24.0"
|
||||
|
|
@ -190,7 +177,7 @@ dependencies = [
|
|||
"bitflags",
|
||||
"block",
|
||||
"cocoa-foundation",
|
||||
"core-foundation 0.9.2",
|
||||
"core-foundation 0.9.3",
|
||||
"core-graphics 0.22.3",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
|
|
@ -205,7 +192,7 @@ checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318"
|
|||
dependencies = [
|
||||
"bitflags",
|
||||
"block",
|
||||
"core-foundation 0.9.2",
|
||||
"core-foundation 0.9.3",
|
||||
"core-graphics-types",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
|
|
@ -224,9 +211,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.9.2"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3"
|
||||
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
|
||||
dependencies = [
|
||||
"core-foundation-sys 0.8.3",
|
||||
"libc",
|
||||
|
|
@ -263,7 +250,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"core-foundation 0.9.2",
|
||||
"core-foundation 0.9.3",
|
||||
"core-graphics-types",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
|
|
@ -276,7 +263,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"core-foundation 0.9.2",
|
||||
"core-foundation 0.9.3",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
]
|
||||
|
|
@ -327,9 +314,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.6"
|
||||
version = "0.8.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfcae03edb34f947e64acdb1c33ec169824e20657e9ecb61cef6c8c74dcb8120"
|
||||
checksum = "b5e5bed1f1c269533fa816a0a5492b3545209a205ca1a54842be180eb63a16a6"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"lazy_static",
|
||||
|
|
@ -576,9 +563,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.4"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c"
|
||||
checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
|
|
@ -701,9 +688,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.117"
|
||||
version = "0.2.119"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e74d72e0f9b65b5b4ca49a346af3976df0f9c61d550727f349ecd559f251a26c"
|
||||
checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
|
|
@ -846,15 +833,22 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "ndk-glue"
|
||||
version = "0.5.0"
|
||||
name = "ndk-context"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc291b8de2095cba8dab7cf381bf582ff4c17a09acf854c32e46545b08085d28"
|
||||
checksum = "4e3c5cc68637e21fe8f077f6a1c9e0b9ca495bb74895226b476310f613325884"
|
||||
|
||||
[[package]]
|
||||
name = "ndk-glue"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1c68f70683c5fc9a747a383744206cd371741b2f0b31781ab6770487ec572e2"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"log",
|
||||
"ndk",
|
||||
"ndk-context",
|
||||
"ndk-macro",
|
||||
"ndk-sys",
|
||||
]
|
||||
|
|
@ -910,23 +904,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ntapi"
|
||||
version = "0.3.6"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44"
|
||||
checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.14"
|
||||
|
|
@ -938,18 +922,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "num_enum"
|
||||
version = "0.5.6"
|
||||
version = "0.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "720d3ea1055e4e4574c0c0b0f8c3fd4f24c4cdaf465948206dea090b57b526ad"
|
||||
checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9"
|
||||
dependencies = [
|
||||
"num_enum_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_enum_derive"
|
||||
version = "0.5.6"
|
||||
version = "0.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0d992b768490d7fe0d8586d9b5745f6c49f557da6d81dc982b1d167ad4edbb21"
|
||||
checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
|
|
@ -957,6 +941,15 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_threads"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97ba99ba6393e2c3734791401b66902d981cb03bf190af674ca69949b6d5fb15"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc"
|
||||
version = "0.2.7"
|
||||
|
|
@ -977,15 +970,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.9.0"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
|
||||
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
|
||||
|
||||
[[package]]
|
||||
name = "owned_ttf_parser"
|
||||
version = "0.14.0"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ef05f2882a8b3e7acc10c153ade2631f7bfc8ce00d2bf3fb8f4e9d2ae6ea5c3"
|
||||
checksum = "4fb1e509cfe7a12db2a90bfa057dfcdbc55a347f5da677c506b53dd099cfec9d"
|
||||
dependencies = [
|
||||
"ttf-parser",
|
||||
]
|
||||
|
|
@ -1035,9 +1028,9 @@ checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "1.1.0"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ebace6889caf889b4d3f76becee12e90353f2b8c7d875534a71e5742f8f6f83"
|
||||
checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
"toml",
|
||||
|
|
@ -1063,14 +1056,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.4"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
|
||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
"rand_hc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1092,15 +1084,6 @@ dependencies = [
|
|||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
|
||||
dependencies = [
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
version = "0.4.2"
|
||||
|
|
@ -1112,9 +1095,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.10"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff"
|
||||
checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
|
@ -1182,9 +1165,9 @@ checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
|
|||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.78"
|
||||
version = "1.0.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d23c1ba4cf0efd44be32017709280b32d1cea5c3f1275c3b6d9e8bc54f758085"
|
||||
checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
|
|
@ -1233,15 +1216,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "slog-term"
|
||||
version = "2.8.0"
|
||||
version = "2.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95c1e7e5aab61ced6006149ea772770b84a0d16ce0f7885def313e4829946d76"
|
||||
checksum = "87d29185c55b7b258b4f120eab00f48557d4d9bc814f41713f449d35b0f8977c"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"chrono",
|
||||
"slog",
|
||||
"term",
|
||||
"thread_local",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1253,7 +1236,7 @@ checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
|
|||
[[package]]
|
||||
name = "smithay"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/Smithay/smithay.git?rev=5da3a629#5da3a629290fef745abca58272cf27044acc03e6"
|
||||
source = "git+https://github.com/Smithay/smithay.git?rev=1151eea4#1151eea4ff719e7a802d0aced914b5650173ff91"
|
||||
dependencies = [
|
||||
"appendlist",
|
||||
"bitflags",
|
||||
|
|
@ -1312,7 +1295,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "smithay-egui"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/Smithay/smithay-egui.git?rev=cdca17da#cdca17da3278751fa1fae9d3805c47012d7ca418"
|
||||
source = "git+https://github.com/Smithay/smithay-egui.git?rev=5cc416ce#5cc416ce2def8737816b3c69c170d9e01581f22c"
|
||||
dependencies = [
|
||||
"cgmath",
|
||||
"egui",
|
||||
|
|
@ -1402,14 +1385,22 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.1.43"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
|
||||
checksum = "004cbc98f30fa233c61a38bc77e96a9106e65c88f2d3bef182ae952027e5753d"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"libc",
|
||||
"winapi",
|
||||
"num_threads",
|
||||
"time-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25eb0ca3468fc0acc11828786797f6ef9aa1555e4a211a60d64cc8e4d1be47d6"
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.8"
|
||||
|
|
@ -1421,9 +1412,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ttf-parser"
|
||||
version = "0.14.0"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ccbe8381883510b6a2d8f1e32905bddd178c11caef8083086d0c0c9ab0ac281"
|
||||
checksum = "c74c96594835e10fa545e2a51e8709f30b173a092bfd6036ef2cec53376244f3"
|
||||
|
||||
[[package]]
|
||||
name = "udev"
|
||||
|
|
@ -1661,7 +1652,7 @@ checksum = "9b43cc931d58b99461188607efd7acb2a093e65fc621f54cad78517a6063e73a"
|
|||
dependencies = [
|
||||
"bitflags",
|
||||
"cocoa",
|
||||
"core-foundation 0.9.2",
|
||||
"core-foundation 0.9.3",
|
||||
"core-graphics 0.22.3",
|
||||
"core-video-sys",
|
||||
"dispatch",
|
||||
|
|
|
|||
|
|
@ -23,13 +23,13 @@ xcursor = "0.3.3"
|
|||
[dependencies.smithay]
|
||||
version = "0.3"
|
||||
git = "https://github.com/Smithay/smithay.git"
|
||||
rev = "5da3a629"
|
||||
rev = "1151eea4"
|
||||
default-features = false
|
||||
features = ["backend_drm", "backend_gbm", "backend_egl", "backend_libinput", "backend_session_libseat", "backend_udev", "backend_winit", "backend_x11", "desktop", "use_system_lib", "renderer_gl", "wayland_frontend", "slog-stdlog"]
|
||||
features = ["backend_drm", "backend_gbm", "backend_egl", "backend_libinput", "backend_session_libseat", "backend_udev", "backend_winit", "backend_x11", "desktop", "use_system_lib", "renderer_gl", "renderer_multi", "wayland_frontend", "slog-stdlog"]
|
||||
|
||||
[dependencies.smithay-egui]
|
||||
git = "https://github.com/Smithay/smithay-egui.git"
|
||||
rev = "cdca17da"
|
||||
rev = "5cc416ce"
|
||||
optional = true
|
||||
|
||||
[features]
|
||||
|
|
|
|||
|
|
@ -2,19 +2,22 @@
|
|||
|
||||
use crate::state::get_dnd_icon;
|
||||
use smithay::{
|
||||
backend::{
|
||||
renderer::{gles2, Frame, ImportAll, Renderer, Texture},
|
||||
SwapBuffersError,
|
||||
},
|
||||
desktop::space::{DynamicRenderElements, RenderElement, SpaceOutputTuple, SurfaceTree},
|
||||
backend::renderer::{Frame, ImportAll, ImportMem, Renderer, Texture},
|
||||
desktop::space::{RenderElement, SpaceOutputTuple, SurfaceTree},
|
||||
reexports::wayland_server::protocol::wl_surface,
|
||||
utils::{Buffer, Logical, Point, Rectangle, Size, Transform},
|
||||
utils::{Logical, Point, Rectangle, Size, Transform},
|
||||
wayland::{
|
||||
compositor::{get_role, with_states},
|
||||
seat::{CursorImageAttributes, CursorImageStatus, Seat},
|
||||
},
|
||||
};
|
||||
use std::{cell::RefCell, io::Read, rc::Rc, sync::Mutex};
|
||||
use std::{
|
||||
any::{Any, TypeId},
|
||||
cell::RefCell,
|
||||
collections::HashMap,
|
||||
io::Read,
|
||||
sync::Mutex,
|
||||
};
|
||||
use xcursor::{
|
||||
parser::{parse_xcursor, Image},
|
||||
CursorTheme,
|
||||
|
|
@ -115,15 +118,11 @@ fn load_icon(theme: &CursorTheme) -> Result<Vec<Image>, Error> {
|
|||
parse_xcursor(&cursor_data).ok_or(Error::Parse)
|
||||
}
|
||||
|
||||
pub fn draw_surface_cursor<R, F, E, T>(
|
||||
pub fn draw_surface_cursor(
|
||||
surface: wl_surface::WlSurface,
|
||||
location: impl Into<Point<i32, Logical>>,
|
||||
) -> impl RenderElement<R, F, E, T>
|
||||
) -> SurfaceTree
|
||||
where
|
||||
R: Renderer<Error = E, TextureId = T, Frame = F> + ImportAll + 'static,
|
||||
F: Frame<Error = E, TextureId = T> + 'static,
|
||||
E: std::error::Error + Into<SwapBuffersError> + 'static,
|
||||
T: Texture + 'static,
|
||||
{
|
||||
let mut position = location.into();
|
||||
let ret = with_states(&surface, |states| {
|
||||
|
|
@ -150,16 +149,10 @@ where
|
|||
SurfaceTree { surface, position }
|
||||
}
|
||||
|
||||
pub fn draw_dnd_icon<R, F, E, T>(
|
||||
pub fn draw_dnd_icon(
|
||||
surface: wl_surface::WlSurface,
|
||||
location: impl Into<Point<i32, Logical>>,
|
||||
) -> impl RenderElement<R, F, E, T>
|
||||
where
|
||||
R: Renderer<Error = E, TextureId = T, Frame = F> + ImportAll + 'static,
|
||||
F: Frame<Error = E, TextureId = T> + 'static,
|
||||
E: std::error::Error + Into<SwapBuffersError> + 'static,
|
||||
T: Texture + 'static,
|
||||
{
|
||||
) -> SurfaceTree {
|
||||
if get_role(&surface) != Some("dnd_icon") {
|
||||
slog_scope::warn!(
|
||||
"Trying to display as a dnd icon a surface that does not have the DndIcon role."
|
||||
|
|
@ -194,12 +187,10 @@ impl<T: Texture> PointerElement<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R, F, E, T> RenderElement<R, F, E, T> for PointerElement<T>
|
||||
impl<R> RenderElement<R> for PointerElement<<R as Renderer>::TextureId>
|
||||
where
|
||||
R: Renderer<Error = E, TextureId = T, Frame = F> + ImportAll + 'static,
|
||||
F: Frame<Error = E, TextureId = T> + 'static,
|
||||
E: std::error::Error + Into<SwapBuffersError> + 'static,
|
||||
T: Texture + 'static,
|
||||
R: Renderer + ImportAll,
|
||||
<R as Renderer>::TextureId: 'static,
|
||||
{
|
||||
fn id(&self) -> usize {
|
||||
0
|
||||
|
|
@ -223,12 +214,12 @@ where
|
|||
fn draw(
|
||||
&self,
|
||||
_renderer: &mut R,
|
||||
frame: &mut F,
|
||||
frame: &mut <R as Renderer>::Frame,
|
||||
scale: f64,
|
||||
position: Point<i32, Logical>,
|
||||
damage: &[Rectangle<i32, Logical>],
|
||||
_log: &slog::Logger,
|
||||
) -> Result<(), R::Error> {
|
||||
) -> Result<(), <R as Renderer>::Error> {
|
||||
frame.render_texture_at(
|
||||
&self.texture,
|
||||
position.to_f64().to_physical(scale as f64).to_i32_round(),
|
||||
|
|
@ -245,26 +236,39 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
struct CursorState {
|
||||
cursor: Cursor,
|
||||
current_image: RefCell<Option<Image>>,
|
||||
image_cache: RefCell<HashMap<(TypeId, usize), Vec<(Image, Box<dyn Any + 'static>)>>>,
|
||||
}
|
||||
|
||||
pub type Textures = Vec<(Image, gles2::Gles2Texture)>;
|
||||
impl Default for CursorState {
|
||||
fn default() -> CursorState {
|
||||
CursorState {
|
||||
cursor: Cursor::default(),
|
||||
current_image: RefCell::new(None),
|
||||
image_cache: RefCell::new(HashMap::new()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn draw_cursor(
|
||||
renderer: &mut gles2::Gles2Renderer,
|
||||
pub fn draw_cursor<R, I>(
|
||||
renderer: &mut R,
|
||||
seat: &Seat,
|
||||
location: Point<i32, Logical>,
|
||||
start_time: &std::time::Instant,
|
||||
draw_default: bool,
|
||||
) -> Option<DynamicRenderElements<gles2::Gles2Renderer>> {
|
||||
) -> Option<I>
|
||||
where
|
||||
I: From<SurfaceTree> + From<PointerElement<<R as Renderer>::TextureId>>,
|
||||
R: Renderer + ImportAll + ImportMem,
|
||||
<R as Renderer>::TextureId: Clone + 'static,
|
||||
{
|
||||
// draw the dnd icon if applicable
|
||||
{
|
||||
if let Some(wl_surface) = get_dnd_icon(seat) {
|
||||
if wl_surface.as_ref().is_alive() {
|
||||
return Some(Box::new(draw_dnd_icon(wl_surface, location)));
|
||||
return Some(draw_dnd_icon(wl_surface, location).into());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -287,10 +291,7 @@ pub fn draw_cursor(
|
|||
.unwrap_or(CursorImageStatus::Default);
|
||||
|
||||
if let CursorImageStatus::Image(wl_surface) = cursor_status {
|
||||
Some(Box::new(draw_surface_cursor(
|
||||
wl_surface.clone(),
|
||||
location,
|
||||
)))
|
||||
Some(draw_surface_cursor(wl_surface.clone(), location).into())
|
||||
} else if draw_default {
|
||||
let seat_userdata = seat.user_data();
|
||||
seat_userdata.insert_if_missing(CursorState::default);
|
||||
|
|
@ -300,75 +301,35 @@ pub fn draw_cursor(
|
|||
.get_image(1, start_time.elapsed().as_millis() as u32);
|
||||
let new_frame = state.current_image.borrow().as_ref() != Some(&frame);
|
||||
|
||||
let egl_userdata = renderer.egl_context().user_data();
|
||||
egl_userdata.insert_if_missing(|| Rc::new(RefCell::new(Textures::new())));
|
||||
let pointer_images = egl_userdata.get::<Rc<RefCell<Textures>>>().unwrap().clone();
|
||||
let pointer_images_ref = &mut *pointer_images.borrow_mut();
|
||||
let pointer_image = pointer_images_ref
|
||||
let mut cache = state.image_cache.borrow_mut();
|
||||
let pointer_images = cache
|
||||
.entry((TypeId::of::<<R as Renderer>::TextureId>(), renderer.id()))
|
||||
.or_default();
|
||||
let pointer_image = pointer_images
|
||||
.iter()
|
||||
.find_map(|(image, texture)| if image == &frame { Some(texture) } else { None })
|
||||
.cloned()
|
||||
.and_then(|texture| {
|
||||
texture
|
||||
.downcast_ref::<<R as Renderer>::TextureId>()
|
||||
.cloned()
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
let texture = import_bitmap(
|
||||
renderer,
|
||||
&frame.pixels_rgba,
|
||||
gles2::ffi::RGBA,
|
||||
(frame.width as i32, frame.height as i32),
|
||||
)
|
||||
.expect("Failed to import cursor bitmap");
|
||||
pointer_images_ref.push((frame.clone(), texture.clone()));
|
||||
let texture = renderer
|
||||
.import_memory(
|
||||
&frame.pixels_rgba,
|
||||
(frame.width as i32, frame.height as i32).into(),
|
||||
false,
|
||||
)
|
||||
.expect("Failed to import cursor bitmap");
|
||||
pointer_images.push((frame.clone(), Box::new(texture.clone())));
|
||||
texture
|
||||
});
|
||||
let hotspot = Point::<i32, Logical>::from((frame.xhot as i32, frame.yhot as i32));
|
||||
*state.current_image.borrow_mut() = Some(frame);
|
||||
|
||||
Some(Box::new(PointerElement::new(
|
||||
pointer_image.clone(),
|
||||
location - hotspot,
|
||||
new_frame,
|
||||
)))
|
||||
Some(PointerElement::new(pointer_image.clone(), location - hotspot, new_frame).into())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn import_bitmap(
|
||||
renderer: &mut gles2::Gles2Renderer,
|
||||
image: impl std::convert::AsRef<[u8]>,
|
||||
format: gles2::ffi::types::GLenum,
|
||||
size: impl Into<Size<i32, Buffer>>,
|
||||
) -> Result<gles2::Gles2Texture, gles2::Gles2Error> {
|
||||
use smithay::backend::renderer::gles2::ffi;
|
||||
|
||||
let size = size.into();
|
||||
renderer.with_context(|renderer, gl| unsafe {
|
||||
let mut tex = 0;
|
||||
gl.GenTextures(1, &mut tex);
|
||||
gl.BindTexture(ffi::TEXTURE_2D, tex);
|
||||
gl.TexParameteri(
|
||||
ffi::TEXTURE_2D,
|
||||
ffi::TEXTURE_WRAP_S,
|
||||
ffi::CLAMP_TO_EDGE as i32,
|
||||
);
|
||||
gl.TexParameteri(
|
||||
ffi::TEXTURE_2D,
|
||||
ffi::TEXTURE_WRAP_T,
|
||||
ffi::CLAMP_TO_EDGE as i32,
|
||||
);
|
||||
gl.TexImage2D(
|
||||
ffi::TEXTURE_2D,
|
||||
0,
|
||||
format as i32,
|
||||
size.w,
|
||||
size.h,
|
||||
0,
|
||||
format,
|
||||
ffi::UNSIGNED_BYTE as u32,
|
||||
image.as_ref().as_ptr() as *const _,
|
||||
);
|
||||
gl.BindTexture(ffi::TEXTURE_2D, 0);
|
||||
|
||||
gles2::Gles2Texture::from_raw(renderer, tex, size)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,52 +3,80 @@
|
|||
use crate::state::Common;
|
||||
#[cfg(feature = "debug")]
|
||||
use crate::{
|
||||
debug::{debug_ui, fps_ui, log_ui},
|
||||
debug::{debug_ui, fps_ui, log_ui, EguiFrame},
|
||||
state::Fps,
|
||||
};
|
||||
|
||||
use slog::Logger;
|
||||
use smithay::{
|
||||
backend::renderer::gles2::Gles2Renderer,
|
||||
desktop::space::{DynamicRenderElements, RenderError},
|
||||
utils::{Logical, Rectangle},
|
||||
backend::renderer::{
|
||||
gles2::{Gles2Renderbuffer, Gles2Renderer, Gles2Texture},
|
||||
ImportAll, Renderer,
|
||||
},
|
||||
desktop::space::{RenderElement, RenderError, SpaceOutputTuple, SurfaceTree},
|
||||
utils::{Logical, Point, Rectangle},
|
||||
wayland::output::Output,
|
||||
};
|
||||
|
||||
mod cursor;
|
||||
use self::cursor::PointerElement;
|
||||
|
||||
pub fn render_output(
|
||||
renderer: &mut Gles2Renderer,
|
||||
smithay::custom_elements! {
|
||||
pub CustomElem<=Gles2Renderer>;
|
||||
SurfaceTree=SurfaceTree,
|
||||
PointerElement=PointerElement::<Gles2Texture>,
|
||||
#[cfg(feature = "debug")]
|
||||
EguiFrame=EguiFrame,
|
||||
}
|
||||
|
||||
pub trait AsGles2Renderer {
|
||||
fn as_gles2(&mut self) -> &mut Gles2Renderer;
|
||||
}
|
||||
impl AsGles2Renderer for Gles2Renderer {
|
||||
fn as_gles2(&mut self) -> &mut Gles2Renderer {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render_output<R>(
|
||||
renderer: &mut R,
|
||||
age: u8,
|
||||
state: &mut Common,
|
||||
output: &Output,
|
||||
hardware_cursor: bool,
|
||||
#[cfg(feature = "debug")] fps: &mut Fps,
|
||||
) -> Result<Option<Vec<Rectangle<i32, Logical>>>, RenderError<Gles2Renderer>> {
|
||||
) -> Result<Option<Vec<Rectangle<i32, Logical>>>, RenderError<R>>
|
||||
where
|
||||
R: Renderer + ImportAll + AsGles2Renderer,
|
||||
<R as Renderer>::TextureId: Clone + 'static,
|
||||
CustomElem: RenderElement<R>,
|
||||
{
|
||||
#[cfg(feature = "debug")]
|
||||
{
|
||||
fps.start();
|
||||
}
|
||||
|
||||
#[allow(unused_mut)]
|
||||
let mut custom_elements = Vec::<DynamicRenderElements<Gles2Renderer>>::new();
|
||||
let mut custom_elements = Vec::<CustomElem>::new();
|
||||
|
||||
#[cfg(feature = "debug")]
|
||||
{
|
||||
let space = state.spaces.active_space(output);
|
||||
let output_geo = space.output_geometry(output)
|
||||
let output_geo = space
|
||||
.output_geometry(output)
|
||||
.unwrap_or(Rectangle::from_loc_and_size((0, 0), (0, 0)));
|
||||
let scale = space.output_scale(output).unwrap();
|
||||
|
||||
let fps_overlay = fps_ui(state, fps, output_geo, scale);
|
||||
custom_elements.push(Box::new(fps_overlay));
|
||||
custom_elements.push(fps_overlay.into());
|
||||
|
||||
let mut area = state.spaces.global_space();
|
||||
area.loc = state.spaces.space_relative_output_geometry((0, 0), output);
|
||||
if let Some(log_ui) = log_ui(state, area, scale, output_geo.size.w as f32 * 0.6) {
|
||||
custom_elements.push(Box::new(log_ui));
|
||||
custom_elements.push(log_ui.into());
|
||||
}
|
||||
if let Some(debug_overlay) = debug_ui(state, area, scale) {
|
||||
custom_elements.push(Box::new(debug_overlay));
|
||||
custom_elements.push(debug_overlay.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -57,11 +85,17 @@ pub fn render_output(
|
|||
Some(ptr) => ptr,
|
||||
None => continue,
|
||||
};
|
||||
let location = state.spaces.space_relative_output_geometry(pointer.current_location().to_i32_round(), output);
|
||||
let location = state
|
||||
.spaces
|
||||
.space_relative_output_geometry(pointer.current_location().to_i32_round(), output);
|
||||
|
||||
if let Some(cursor) =
|
||||
cursor::draw_cursor(renderer, seat, location, &state.start_time, !hardware_cursor)
|
||||
{
|
||||
if let Some(cursor) = cursor::draw_cursor(
|
||||
renderer.as_gles2(),
|
||||
seat,
|
||||
location,
|
||||
&state.start_time,
|
||||
!hardware_cursor,
|
||||
) {
|
||||
custom_elements.push(cursor)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ fn init_egl_client_side(
|
|||
renderer
|
||||
.borrow_mut()
|
||||
.renderer()
|
||||
.import_dmabuf(buffer)
|
||||
.import_dmabuf(buffer, None)
|
||||
.is_ok()
|
||||
},
|
||||
None,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ use anyhow::{Context, Result};
|
|||
use smithay::{
|
||||
backend::{
|
||||
allocator::dmabuf::Dmabuf,
|
||||
drm::DrmNode,
|
||||
egl::{EGLContext, EGLDisplay},
|
||||
input::{Event, InputEvent},
|
||||
renderer::{gles2::Gles2Renderer, Bind, ImportDma, ImportEgl},
|
||||
|
|
@ -19,7 +18,7 @@ use smithay::{
|
|||
desktop::layer_map_for_output,
|
||||
reexports::{
|
||||
calloop::{ping, EventLoop, LoopHandle},
|
||||
gbm::Device as GbmDevice,
|
||||
gbm::{Device as GbmDevice, FdWrapper},
|
||||
wayland_server::{
|
||||
protocol::wl_output::{Subpixel, WlOutput},
|
||||
Display,
|
||||
|
|
@ -40,7 +39,7 @@ use std::{
|
|||
use crate::state::Fps;
|
||||
|
||||
pub struct X11State {
|
||||
allocator: Arc<Mutex<GbmDevice<DrmNode>>>,
|
||||
allocator: Arc<Mutex<GbmDevice<FdWrapper>>>,
|
||||
_egl: EGLDisplay,
|
||||
renderer: Rc<RefCell<Gles2Renderer>>,
|
||||
surfaces: Vec<Surface>,
|
||||
|
|
@ -196,12 +195,13 @@ pub fn init_backend(event_loop: &mut EventLoop<State>, state: &mut State) -> Res
|
|||
let handle = backend.handle();
|
||||
|
||||
// Obtain the DRM node the X server uses for direct rendering.
|
||||
let drm_node = handle
|
||||
let (_drm_node, fd) = handle
|
||||
.drm_node()
|
||||
.with_context(|| "Could not get DRM node used by X server")?;
|
||||
|
||||
// Create the gbm device for buffer allocation.
|
||||
let device = GbmDevice::new(drm_node).with_context(|| "Failed to create GBM device")?;
|
||||
let device =
|
||||
unsafe { GbmDevice::new_from_fd(fd) }.with_context(|| "Failed to create GBM device")?;
|
||||
// Initialize EGL using the GBM device.
|
||||
let egl = EGLDisplay::new(&device, None).with_context(|| "Failed to create EGL display")?;
|
||||
// Create the OpenGL context
|
||||
|
|
@ -276,7 +276,7 @@ pub fn init_backend(event_loop: &mut EventLoop<State>, state: &mut State) -> Res
|
|||
surface.render.ping();
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
X11Event::Refresh { window_id } | X11Event::PresentCompleted { window_id } => {
|
||||
if let Some(surface) = state
|
||||
.backend
|
||||
|
|
@ -291,7 +291,7 @@ pub fn init_backend(event_loop: &mut EventLoop<State>, state: &mut State) -> Res
|
|||
surface.pending = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
X11Event::Input(event) => state.process_x11_event(event),
|
||||
})
|
||||
.map_err(|_| anyhow::anyhow!("Failed to insert X11 Backend into event loop"))?;
|
||||
|
|
@ -312,7 +312,7 @@ fn init_egl_client_side(display: &mut Display, renderer: Rc<RefCell<Gles2Rendere
|
|||
init_dmabuf_global(
|
||||
display,
|
||||
dmabuf_formats,
|
||||
move |buffer, _| renderer.borrow_mut().import_dmabuf(buffer).is_ok(),
|
||||
move |buffer, _| renderer.borrow_mut().import_dmabuf(buffer, None).is_ok(),
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
15
src/debug.rs
15
src/debug.rs
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use crate::state::{Common, Fps};
|
||||
use smithay::utils::{Logical, Rectangle};
|
||||
use smithay_egui::EguiFrame;
|
||||
pub use smithay_egui::EguiFrame;
|
||||
|
||||
pub fn fps_ui(
|
||||
state: &Common,
|
||||
|
|
@ -167,10 +167,13 @@ pub fn debug_ui(
|
|||
ui.collapsing(format!("Windows"), |ui| {
|
||||
for window in space.windows() {
|
||||
ui.collapsing(format!("{:?}", window.toplevel()), |ui| {
|
||||
ui.label(format!(
|
||||
"Rect: {:?}",
|
||||
space.window_geometry(window)
|
||||
));
|
||||
ui.label(format!("Rect: {:?}", {
|
||||
let mut geo = window.geometry();
|
||||
geo.loc += space
|
||||
.window_location(window)
|
||||
.unwrap_or((0, 0).into());
|
||||
geo
|
||||
}));
|
||||
ui.label(format!(
|
||||
"Bounding box: {:?}",
|
||||
space.window_bbox(window)
|
||||
|
|
@ -246,8 +249,6 @@ pub fn log_ui(
|
|||
stroke: egui::Stroke::none(),
|
||||
})
|
||||
.default_width(default_width)
|
||||
.default_width(default_width)
|
||||
.default_width(default_width)
|
||||
.show(ctx, |ui| {
|
||||
egui::ScrollArea::vertical()
|
||||
.always_show_scroll(true)
|
||||
|
|
|
|||
|
|
@ -458,8 +458,7 @@ impl Common {
|
|||
.map(|(s, _)| s);
|
||||
}
|
||||
} else if let Some(window) = space.window_under(pos).cloned() {
|
||||
let window_loc =
|
||||
space.window_geometry(&window).unwrap().loc;
|
||||
let window_loc = space.window_location(&window).unwrap();
|
||||
under = window
|
||||
.surface_under(
|
||||
pos - window_loc.to_f64(),
|
||||
|
|
@ -614,7 +613,7 @@ impl Common {
|
|||
)
|
||||
.map(|(s, loc)| (s, loc + layer_loc))
|
||||
} else if let Some(window) = space.window_under(pos) {
|
||||
let window_loc = space.window_geometry(window).unwrap().loc;
|
||||
let window_loc = space.window_location(window).unwrap();
|
||||
window
|
||||
.surface_under(pos - window_loc.to_f64(), WindowSurfaceType::ALL)
|
||||
.map(|(s, loc)| (s, loc + window_loc))
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use smithay::{
|
|||
wayland_protocols::xdg_shell::server::xdg_toplevel,
|
||||
wayland_server::protocol::{wl_pointer::ButtonState, wl_surface},
|
||||
},
|
||||
utils::{Logical, Point, Rectangle, Size},
|
||||
utils::{Logical, Point, Size},
|
||||
wayland::{
|
||||
compositor::with_states,
|
||||
seat::{AxisFrame, PointerGrab, PointerGrabStartData, PointerInnerHandle},
|
||||
|
|
@ -306,10 +306,9 @@ impl ResizeSurfaceGrab {
|
|||
start_data: PointerGrabStartData,
|
||||
window: Window,
|
||||
edges: xdg_toplevel::ResizeEdge,
|
||||
initial_window_geometry: Rectangle<i32, Logical>,
|
||||
initial_window_location: Point<i32, Logical>,
|
||||
initial_window_size: Size<i32, Logical>,
|
||||
) -> ResizeSurfaceGrab {
|
||||
let (initial_window_location, initial_window_size) =
|
||||
(initial_window_geometry.loc, initial_window_geometry.size);
|
||||
let resize_state = ResizeState::Resizing(ResizeData {
|
||||
edges: edges.into(),
|
||||
initial_window_location,
|
||||
|
|
@ -393,7 +392,8 @@ impl ResizeSurfaceGrab {
|
|||
|
||||
pub fn apply_resize_state(
|
||||
window: &Window,
|
||||
geometry: Rectangle<i32, Logical>,
|
||||
mut location: Point<i32, Logical>,
|
||||
size: Size<i32, Logical>,
|
||||
) -> Option<Point<i32, Logical>> {
|
||||
let mut new_location = None;
|
||||
|
||||
|
|
@ -413,15 +413,13 @@ impl ResizeSurfaceGrab {
|
|||
} = resize_data;
|
||||
|
||||
if edges.intersects(ResizeEdge::TOP_LEFT) {
|
||||
let mut location = geometry.loc;
|
||||
|
||||
if edges.intersects(ResizeEdge::LEFT) {
|
||||
location.x = initial_window_location.x
|
||||
+ (initial_window_size.w - geometry.size.w);
|
||||
location.x =
|
||||
initial_window_location.x + (initial_window_size.w - size.w);
|
||||
}
|
||||
if edges.intersects(ResizeEdge::TOP) {
|
||||
location.y = initial_window_location.y
|
||||
+ (initial_window_size.h - geometry.size.h);
|
||||
location.y =
|
||||
initial_window_location.y + (initial_window_size.h - size.h);
|
||||
}
|
||||
|
||||
new_location = Some(location);
|
||||
|
|
|
|||
|
|
@ -110,8 +110,7 @@ pub fn init_shell(display: &mut Display) -> ShellStates {
|
|||
.window_for_surface(surface.get_surface().unwrap())
|
||||
.unwrap()
|
||||
.clone();
|
||||
let mut initial_window_location =
|
||||
space.window_geometry(&window).unwrap().loc;
|
||||
let mut initial_window_location = space.window_location(&window).unwrap();
|
||||
|
||||
// If surface is maximized then unmaximize it
|
||||
if let Some(current_state) = surface.current_state() {
|
||||
|
|
@ -172,10 +171,12 @@ pub fn init_shell(display: &mut Display) -> ShellStates {
|
|||
.window_for_surface(surface.get_surface().unwrap())
|
||||
.unwrap()
|
||||
.clone();
|
||||
let geometry = space.window_geometry(&window).unwrap();
|
||||
let location = space.window_location(&window).unwrap();
|
||||
let size = window.geometry().size;
|
||||
|
||||
let grab =
|
||||
grabs::ResizeSurfaceGrab::new(start_data, window, edges, geometry);
|
||||
let grab = grabs::ResizeSurfaceGrab::new(
|
||||
start_data, window, edges, location, size,
|
||||
);
|
||||
|
||||
pointer.set_grab(grab, serial, 0);
|
||||
}
|
||||
|
|
@ -415,7 +416,8 @@ fn commit(surface: &WlSurface, state: &mut State) {
|
|||
{
|
||||
let new_location = grabs::ResizeSurfaceGrab::apply_resize_state(
|
||||
&window,
|
||||
space.window_geometry(&window).unwrap(),
|
||||
space.window_location(&window).unwrap(),
|
||||
window.geometry().size,
|
||||
);
|
||||
if let Some(location) = new_location {
|
||||
space.map_window(&window, location, true);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use crate::{
|
|||
shell::{init_shell, workspaces::Workspaces, ShellStates},
|
||||
};
|
||||
use smithay::{
|
||||
backend::drm::DrmNode,
|
||||
reexports::{
|
||||
calloop::LoopHandle,
|
||||
wayland_server::{protocol::wl_surface::WlSurface, Display},
|
||||
|
|
@ -38,6 +39,7 @@ pub struct Common {
|
|||
pub display: Rc<RefCell<Display>>,
|
||||
pub socket: OsString,
|
||||
pub event_loop_handle: LoopHandle<'static, State>,
|
||||
pub primary_gpu: Option<DrmNode>,
|
||||
|
||||
pub spaces: Workspaces,
|
||||
pub shell: ShellStates,
|
||||
|
|
@ -166,11 +168,16 @@ impl State {
|
|||
#[cfg(feature = "debug")]
|
||||
let dirty_flag = log.dirty_flag.clone();
|
||||
|
||||
let primary_gpu = std::env::var("COSMIC_RENDER_DEVICE")
|
||||
.ok()
|
||||
.and_then(|device| DrmNode::from_path(device).ok());
|
||||
|
||||
State {
|
||||
common: Common {
|
||||
display: Rc::new(RefCell::new(display)),
|
||||
socket,
|
||||
event_loop_handle: handle,
|
||||
primary_gpu,
|
||||
|
||||
spaces: Workspaces::new(),
|
||||
shell: shell_handles,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue