chore: dependency update (#274)

Update dependencies of gtk and gdkx11 to 0.14
This commit is contained in:
Florian Proksch 2021-09-11 18:02:35 +02:00 committed by GitHub
parent 80b89dd391
commit e1558965ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 344 additions and 192 deletions

393
Cargo.lock generated
View file

@ -57,28 +57,26 @@ dependencies = [
[[package]] [[package]]
name = "atk" name = "atk"
version = "0.9.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "812b4911e210bd51b24596244523c856ca749e6223c50a7fbbba3f89ee37c426" checksum = "a83b21d2aa75e464db56225e1bda2dd5993311ba1095acaa8fa03d1ae67026ba"
dependencies = [ dependencies = [
"atk-sys", "atk-sys",
"bitflags", "bitflags",
"glib", "glib 0.14.4",
"glib-sys",
"gobject-sys",
"libc", "libc",
] ]
[[package]] [[package]]
name = "atk-sys" name = "atk-sys"
version = "0.10.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f530e4af131d94cc4fa15c5c9d0348f0ef28bac64ba660b6b2a1cf2605dedfce" checksum = "badcf670157c84bb8b1cf6b5f70b650fed78da2033c9eed84c4e49b11cbe83ea"
dependencies = [ dependencies = [
"glib-sys", "glib-sys 0.14.0",
"gobject-sys", "gobject-sys 0.14.0",
"libc", "libc",
"system-deps", "system-deps 3.2.0",
] ]
[[package]] [[package]]
@ -148,28 +146,26 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
[[package]] [[package]]
name = "cairo-rs" name = "cairo-rs"
version = "0.9.1" version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5c0f2e047e8ca53d0ff249c54ae047931d7a6ebe05d00af73e0ffeb6e34bdb8" checksum = "f859ade407c19810ae920b4fafab92189ed312adad490d08fb16b5f49f1e2207"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cairo-sys-rs", "cairo-sys-rs",
"glib", "glib 0.14.4",
"glib-sys",
"gobject-sys",
"libc", "libc",
"thiserror", "thiserror",
] ]
[[package]] [[package]]
name = "cairo-sys-rs" name = "cairo-sys-rs"
version = "0.10.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ed2639b9ad5f1d6efa76de95558e11339e7318426d84ac4890b86c03e828ca7" checksum = "d7c9c3928781e8a017ece15eace05230f04b647457d170d2d9641c94a444ff80"
dependencies = [ dependencies = [
"glib-sys", "glib-sys 0.14.0",
"libc", "libc",
"system-deps", "system-deps 3.2.0",
] ]
[[package]] [[package]]
@ -178,6 +174,15 @@ version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0" checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0"
[[package]]
name = "cfg-expr"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b412e83326147c2bb881f8b40edfbf9905b9b8abaebd0e47ca190ba62fda8f0e"
dependencies = [
"smallvec",
]
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "1.0.0" version = "1.0.0"
@ -419,10 +424,10 @@ dependencies = [
"futures-core", "futures-core",
"futures-util", "futures-util",
"gdk", "gdk",
"gdk-pixbuf", "gdk-pixbuf 0.9.0",
"gdkx11", "gdkx11",
"gio", "gio 0.9.1",
"glib", "glib 0.10.3",
"grass", "grass",
"gtk", "gtk",
"gtk-layer-shell", "gtk-layer-shell",
@ -472,6 +477,16 @@ dependencies = [
"syn 1.0.76", "syn 1.0.76",
] ]
[[package]]
name = "field-offset"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e1c54951450cbd39f3dbcf1005ac413b49487dabf18a720ad2383eccfeffb92"
dependencies = [
"memoffset",
"rustc_version",
]
[[package]] [[package]]
name = "filetime" name = "filetime"
version = "0.2.15" version = "0.2.15"
@ -595,20 +610,16 @@ dependencies = [
[[package]] [[package]]
name = "gdk" name = "gdk"
version = "0.13.2" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db00839b2a68a7a10af3fa28dfb3febaba3a20c3a9ac2425a33b7df1f84a6b7d" checksum = "679e22651cd15888e7acd01767950edca2ee9fcd6421fbf5b3c3b420d4e88bb0"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cairo-rs", "cairo-rs",
"cairo-sys-rs", "gdk-pixbuf 0.14.0",
"gdk-pixbuf",
"gdk-sys", "gdk-sys",
"gio", "gio 0.14.3",
"gio-sys", "glib 0.14.4",
"glib",
"glib-sys",
"gobject-sys",
"libc", "libc",
"pango", "pango",
] ]
@ -619,12 +630,24 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f6dae3cb99dd49b758b88f0132f8d401108e63ae8edd45f432d42cdff99998a" checksum = "8f6dae3cb99dd49b758b88f0132f8d401108e63ae8edd45f432d42cdff99998a"
dependencies = [ dependencies = [
"gdk-pixbuf-sys", "gdk-pixbuf-sys 0.10.0",
"gio", "gio 0.9.1",
"gio-sys", "gio-sys 0.10.1",
"glib", "glib 0.10.3",
"glib-sys", "glib-sys 0.10.1",
"gobject-sys", "gobject-sys 0.10.0",
"libc",
]
[[package]]
name = "gdk-pixbuf"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "534192cb8f01daeb8fab2c8d4baa8f9aae5b7a39130525779f5c2608e235b10f"
dependencies = [
"gdk-pixbuf-sys 0.14.0",
"gio 0.14.3",
"glib 0.14.4",
"libc", "libc",
] ]
@ -634,66 +657,67 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bfe468a7f43e97b8d193a762b6c5cf67a7d36cacbc0b9291dbcae24bfea1e8f" checksum = "3bfe468a7f43e97b8d193a762b6c5cf67a7d36cacbc0b9291dbcae24bfea1e8f"
dependencies = [ dependencies = [
"gio-sys", "gio-sys 0.10.1",
"glib-sys", "glib-sys 0.10.1",
"gobject-sys", "gobject-sys 0.10.0",
"libc", "libc",
"system-deps", "system-deps 1.3.2",
]
[[package]]
name = "gdk-pixbuf-sys"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f097c0704201fbc8f69c1762dc58c6947c8bb188b8ed0bc7e65259f1894fe590"
dependencies = [
"gio-sys 0.14.0",
"glib-sys 0.14.0",
"gobject-sys 0.14.0",
"libc",
"system-deps 3.2.0",
] ]
[[package]] [[package]]
name = "gdk-sys" name = "gdk-sys"
version = "0.10.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a9653cfc500fd268015b1ac055ddbc3df7a5c9ea3f4ccef147b3957bd140d69" checksum = "0e091b3d3d6696949ac3b3fb3c62090e5bfd7bd6850bef5c3c5ea701de1b1f1e"
dependencies = [ dependencies = [
"cairo-sys-rs", "cairo-sys-rs",
"gdk-pixbuf-sys", "gdk-pixbuf-sys 0.14.0",
"gio-sys", "gio-sys 0.14.0",
"glib-sys", "glib-sys 0.14.0",
"gobject-sys", "gobject-sys 0.14.0",
"libc", "libc",
"pango-sys", "pango-sys",
"pkg-config", "pkg-config",
"system-deps", "system-deps 3.2.0",
] ]
[[package]] [[package]]
name = "gdkx11" name = "gdkx11"
version = "0.9.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b89606baa221f9b8d8aa81924fd448c6b107d20de949f0fbf9a4ec203bb54b63" checksum = "ddf04101c33123fa9ba0e0f8b966573348097451462a6845d8a2bd85251ec64c"
dependencies = [ dependencies = [
"bitflags",
"gdk", "gdk",
"gdk-pixbuf",
"gdk-pixbuf-sys",
"gdk-sys",
"gdkx11-sys", "gdkx11-sys",
"gio", "gio 0.14.3",
"gio-sys", "glib 0.14.4",
"glib",
"glib-sys",
"gobject-sys",
"libc", "libc",
"pango",
"x11", "x11",
] ]
[[package]] [[package]]
name = "gdkx11-sys" name = "gdkx11-sys"
version = "0.10.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6710388d530f3178ccbeb65cbafdf497a5772c4409eaf574ee9fa461af0a3d09" checksum = "38cefbc8ac7be19c9b51f54fbd7cef48b70495a4cb23a812e2137e75b484b29d"
dependencies = [ dependencies = [
"gdk-pixbuf-sys",
"gdk-sys", "gdk-sys",
"gio-sys", "glib-sys 0.14.0",
"glib-sys",
"gobject-sys",
"libc", "libc",
"pango-sys", "system-deps 3.2.0",
"system-deps",
"x11", "x11",
] ]
@ -730,10 +754,27 @@ dependencies = [
"futures-core", "futures-core",
"futures-io", "futures-io",
"futures-util", "futures-util",
"gio-sys", "gio-sys 0.10.1",
"glib", "glib 0.10.3",
"glib-sys", "glib-sys 0.10.1",
"gobject-sys", "gobject-sys 0.10.0",
"libc",
"once_cell",
"thiserror",
]
[[package]]
name = "gio"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "402a7057cd21d64bfa7ac027b344a7f50f677fb3308693df0e8c70fb55d29f0d"
dependencies = [
"bitflags",
"futures-channel",
"futures-core",
"futures-io",
"gio-sys 0.14.0",
"glib 0.14.4",
"libc", "libc",
"once_cell", "once_cell",
"thiserror", "thiserror",
@ -745,10 +786,23 @@ version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e24fb752f8f5d2cf6bbc2c606fd2bc989c81c5e2fe321ab974d54f8b6344eac" checksum = "5e24fb752f8f5d2cf6bbc2c606fd2bc989c81c5e2fe321ab974d54f8b6344eac"
dependencies = [ dependencies = [
"glib-sys", "glib-sys 0.10.1",
"gobject-sys", "gobject-sys 0.10.0",
"libc", "libc",
"system-deps", "system-deps 1.3.2",
"winapi",
]
[[package]]
name = "gio-sys"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0a41df66e57fcc287c4bcf74fc26b884f31901ea9792ec75607289b456f48fa"
dependencies = [
"glib-sys 0.14.0",
"gobject-sys 0.14.0",
"libc",
"system-deps 3.2.0",
"winapi", "winapi",
] ]
@ -764,13 +818,32 @@ dependencies = [
"futures-executor", "futures-executor",
"futures-task", "futures-task",
"futures-util", "futures-util",
"glib-macros", "glib-macros 0.10.1",
"glib-sys", "glib-sys 0.10.1",
"gobject-sys", "gobject-sys 0.10.0",
"libc", "libc",
"once_cell", "once_cell",
] ]
[[package]]
name = "glib"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8fb802e3798d75b415bea8f016eed88d50106ce82f1274e80f31d80cfd4b056"
dependencies = [
"bitflags",
"futures-channel",
"futures-core",
"futures-executor",
"futures-task",
"glib-macros 0.14.1",
"glib-sys 0.14.0",
"gobject-sys 0.14.0",
"libc",
"once_cell",
"smallvec",
]
[[package]] [[package]]
name = "glib-macros" name = "glib-macros"
version = "0.10.1" version = "0.10.1"
@ -780,7 +853,22 @@ dependencies = [
"anyhow", "anyhow",
"heck", "heck",
"itertools 0.9.0", "itertools 0.9.0",
"proc-macro-crate", "proc-macro-crate 0.1.5",
"proc-macro-error",
"proc-macro2",
"quote 1.0.9",
"syn 1.0.76",
]
[[package]]
name = "glib-macros"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2aad66361f66796bfc73f530c51ef123970eb895ffba991a234fcf7bea89e518"
dependencies = [
"anyhow",
"heck",
"proc-macro-crate 1.0.0",
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
"quote 1.0.9", "quote 1.0.9",
@ -794,7 +882,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7e9b997a66e9a23d073f2b1abb4dbfc3925e0b8952f67efd8d9b6e168e4cdc1" checksum = "c7e9b997a66e9a23d073f2b1abb4dbfc3925e0b8952f67efd8d9b6e168e4cdc1"
dependencies = [ dependencies = [
"libc", "libc",
"system-deps", "system-deps 1.3.2",
]
[[package]]
name = "glib-sys"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c1d60554a212445e2a858e42a0e48cece1bd57b311a19a9468f70376cf554ae"
dependencies = [
"libc",
"system-deps 3.2.0",
] ]
[[package]] [[package]]
@ -803,9 +901,20 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "952133b60c318a62bf82ee75b93acc7e84028a093e06b9e27981c2b6fe68218c" checksum = "952133b60c318a62bf82ee75b93acc7e84028a093e06b9e27981c2b6fe68218c"
dependencies = [ dependencies = [
"glib-sys", "glib-sys 0.10.1",
"libc", "libc",
"system-deps", "system-deps 1.3.2",
]
[[package]]
name = "gobject-sys"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa92cae29759dae34ab5921d73fff5ad54b3d794ab842c117e36cafc7994c3f5"
dependencies = [
"glib-sys 0.14.0",
"libc",
"system-deps 3.2.0",
] ]
[[package]] [[package]]
@ -829,42 +938,37 @@ dependencies = [
[[package]] [[package]]
name = "gtk" name = "gtk"
version = "0.9.2" version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f022f2054072b3af07666341984562c8e626a79daa8be27b955d12d06a5ad6a" checksum = "6603bb79ded6ac6f3bac203794383afa8b1d6a8656d34a93a88f0b22826cd46c"
dependencies = [ dependencies = [
"atk", "atk",
"bitflags", "bitflags",
"cairo-rs", "cairo-rs",
"cairo-sys-rs", "field-offset",
"cc", "futures-channel",
"gdk", "gdk",
"gdk-pixbuf", "gdk-pixbuf 0.14.0",
"gdk-pixbuf-sys", "gio 0.14.3",
"gdk-sys", "glib 0.14.4",
"gio",
"gio-sys",
"glib",
"glib-sys",
"gobject-sys",
"gtk-sys", "gtk-sys",
"gtk3-macros",
"libc", "libc",
"once_cell", "once_cell",
"pango", "pango",
"pango-sys",
"pkg-config", "pkg-config",
] ]
[[package]] [[package]]
name = "gtk-layer-shell" name = "gtk-layer-shell"
version = "0.2.0" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfb41868e4305f14a5b5bc0d5a3fcc0553d3a24f1f176f93c7e136290eaa3b77" checksum = "4a106f40f47bf7eb2d0d62313b82e8cb9829c4c6ab4a1087c72c95ae6ed03726"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"gdk", "gdk",
"glib", "glib 0.14.4",
"glib-sys", "glib-sys 0.14.0",
"gtk", "gtk",
"gtk-layer-shell-sys", "gtk-layer-shell-sys",
"libc", "libc",
@ -872,33 +976,48 @@ dependencies = [
[[package]] [[package]]
name = "gtk-layer-shell-sys" name = "gtk-layer-shell-sys"
version = "0.2.0" version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b3c2ad4c131bf8e6870686615eb9897ad8c02ca0d4354c575f0d74acb429a0b" checksum = "568daf8ab604d183e7fc703d65e3621241dc05b8960022fd94e260aef3ebbf4f"
dependencies = [ dependencies = [
"gdk-sys", "gdk-sys",
"glib-sys", "glib-sys 0.14.0",
"gtk-sys", "gtk-sys",
"libc", "libc",
"system-deps", "system-deps 3.2.0",
] ]
[[package]] [[package]]
name = "gtk-sys" name = "gtk-sys"
version = "0.10.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89acda6f084863307d948ba64a4b1ef674e8527dddab147ee4cdcc194c880457" checksum = "8c14c8d3da0545785a7c5a120345b3abb534010fb8ae0f2ef3f47c027fba303e"
dependencies = [ dependencies = [
"atk-sys", "atk-sys",
"cairo-sys-rs", "cairo-sys-rs",
"gdk-pixbuf-sys", "gdk-pixbuf-sys 0.14.0",
"gdk-sys", "gdk-sys",
"gio-sys", "gio-sys 0.14.0",
"glib-sys", "glib-sys 0.14.0",
"gobject-sys", "gobject-sys 0.14.0",
"libc", "libc",
"pango-sys", "pango-sys",
"system-deps", "system-deps 3.2.0",
]
[[package]]
name = "gtk3-macros"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21de1da96dc117443fb03c2e270b2d34b7de98d0a79a19bbb689476173745b79"
dependencies = [
"anyhow",
"heck",
"proc-macro-crate 1.0.0",
"proc-macro-error",
"proc-macro2",
"quote 1.0.9",
"syn 1.0.76",
] ]
[[package]] [[package]]
@ -1277,14 +1396,12 @@ dependencies = [
[[package]] [[package]]
name = "pango" name = "pango"
version = "0.9.1" version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9937068580bebd8ced19975938573803273ccbcbd598c58d4906efd4ac87c438" checksum = "e1fc88307d9797976ea62722ff2ec5de3fae279c6e20100ed3f49ca1a4bf3f96"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"glib", "glib 0.14.4",
"glib-sys",
"gobject-sys",
"libc", "libc",
"once_cell", "once_cell",
"pango-sys", "pango-sys",
@ -1292,14 +1409,14 @@ dependencies = [
[[package]] [[package]]
name = "pango-sys" name = "pango-sys"
version = "0.10.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d2650c8b62d116c020abd0cea26a4ed96526afda89b1c4ea567131fdefc890" checksum = "2367099ca5e761546ba1d501955079f097caa186bb53ce0f718dca99ac1942fe"
dependencies = [ dependencies = [
"glib-sys", "glib-sys 0.14.0",
"gobject-sys", "gobject-sys 0.14.0",
"libc", "libc",
"system-deps", "system-deps 3.2.0",
] ]
[[package]] [[package]]
@ -1466,6 +1583,16 @@ dependencies = [
"toml", "toml",
] ]
[[package]]
name = "proc-macro-crate"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41fdbd1df62156fbc5945f4762632564d7d038153091c3fcf1067f6aef7cff92"
dependencies = [
"thiserror",
"toml",
]
[[package]] [[package]]
name = "proc-macro-error" name = "proc-macro-error"
version = "1.0.4" version = "1.0.4"
@ -1959,7 +2086,25 @@ dependencies = [
"strum_macros 0.18.0", "strum_macros 0.18.0",
"thiserror", "thiserror",
"toml", "toml",
"version-compare", "version-compare 0.0.10",
]
[[package]]
name = "system-deps"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "480c269f870722b3b08d2f13053ce0c2ab722839f472863c3e2d61ff3a1c2fa6"
dependencies = [
"anyhow",
"cfg-expr",
"heck",
"itertools 0.10.1",
"pkg-config",
"strum 0.21.0",
"strum_macros 0.21.1",
"thiserror",
"toml",
"version-compare 0.0.11",
] ]
[[package]] [[package]]
@ -2144,6 +2289,12 @@ version = "0.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1" checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1"
[[package]]
name = "version-compare"
version = "0.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c18c859eead79d8b95d09e4678566e8d70105c4e7b251f707a03df32442661b"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.3" version = "0.9.3"

View file

@ -14,10 +14,10 @@ default = ["x11"]
x11 = ["gdkx11", "x11rb"] x11 = ["gdkx11", "x11rb"]
wayland = ["gtk-layer-shell", "gtk-layer-shell-sys"] wayland = ["gtk-layer-shell", "gtk-layer-shell-sys"]
[dependencies.cairo-sys-rs] [dependencies.cairo-sys-rs]
version = "0.10.0" version = "0.14.0"
[dependencies] [dependencies]
gtk = { version = "0.9", features = [ "v3_22" ] } gtk = { version = "0.14", features = [ "v3_22" ] }
gdk = { version = "*", features = ["v3_22"] } gdk = { version = "*", features = ["v3_22"] }
gio = { version = "*", features = ["v2_44"] } gio = { version = "*", features = ["v2_44"] }
glib = { version = "*", features = ["v2_44"] } glib = { version = "*", features = ["v2_44"] }
@ -26,7 +26,7 @@ gdk-pixbuf = "0.9"
gtk-layer-shell = { version="0.2.0", optional=true } gtk-layer-shell = { version="0.2.0", optional=true }
gtk-layer-shell-sys = { version="0.2.0", optional=true } gtk-layer-shell-sys = { version="0.2.0", optional=true }
gdkx11 = { version = "0.9", optional = true } gdkx11 = { version = "0.14", optional = true }
x11rb = { version = "0.8", features = ["randr"], optional = true } x11rb = { version = "0.8", features = ["randr"], optional = true }
regex = "1" regex = "1"

View file

@ -5,8 +5,7 @@ use crate::{
use anyhow::*; use anyhow::*;
use debug_stub_derive::*; use debug_stub_derive::*;
use eww_shared_util::VarName; use eww_shared_util::VarName;
use gdk::WindowExt; use crate::gtk::prelude::{GtkWindowExt, WidgetExt, ContainerExt, CssProviderExt, StyleContextExt};
use gtk::{ContainerExt, CssProviderExt, GtkWindowExt, StyleContextExt, WidgetExt};
use itertools::Itertools; use itertools::Itertools;
use simplexpr::dynval::DynVal; use simplexpr::dynval::DynVal;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
@ -256,7 +255,7 @@ impl App {
let root_widget = let root_widget =
window_def.widget.render(&mut self.eww_state, window_name, self.eww_config.get_widget_definitions())?; window_def.widget.render(&mut self.eww_state, window_name, self.eww_config.get_widget_definitions())?;
root_widget.get_style_context().add_class(&window_name.to_string()); root_widget.style_context().add_class(&window_name.to_string());
let monitor_geometry = get_monitor_geometry(monitor.or(window_def.monitor_number))?; let monitor_geometry = get_monitor_geometry(monitor.or(window_def.monitor_number))?;
@ -384,13 +383,14 @@ fn initialize_window(
fn apply_window_position( fn apply_window_position(
mut window_geometry: WindowGeometry, mut window_geometry: WindowGeometry,
monitor_geometry: gdk::Rectangle, monitor_geometry: gdk::Rectangle,
window: &gtk::Window, window: &gtk::Window
) -> Result<()> { ) -> Result<()> {
let gdk_window = window.get_window().context("Failed to get gdk window from gtk window")?;
window_geometry.size = Coords::from_pixels(window.get_size()); let gdk_window = window.window().context("Failed to get gdk window from gtk window")?;
window_geometry.size = Coords::from_pixels(window.size());
let actual_window_rect = get_window_rectangle(window_geometry, monitor_geometry); let actual_window_rect = get_window_rectangle(window_geometry, monitor_geometry);
let gdk_origin = gdk_window.get_origin(); let gdk_origin = gdk_window.origin();
if actual_window_rect.x != gdk_origin.1 || actual_window_rect.y != gdk_origin.2 { if actual_window_rect.x != gdk_origin.1 || actual_window_rect.y != gdk_origin.2 {
gdk_window.move_(actual_window_rect.x, actual_window_rect.y); gdk_window.move_(actual_window_rect.x, actual_window_rect.y);
@ -401,20 +401,20 @@ fn apply_window_position(
fn on_screen_changed(window: &gtk::Window, _old_screen: Option<&gdk::Screen>) { fn on_screen_changed(window: &gtk::Window, _old_screen: Option<&gdk::Screen>) {
let visual = window let visual = window
.get_screen() .screen()
.and_then(|screen| screen.get_rgba_visual().filter(|_| screen.is_composited()).or_else(|| screen.get_system_visual())); .and_then(|screen| screen.rgba_visual().filter(|_| screen.is_composited()).or_else(|| screen.system_visual()));
window.set_visual(visual.as_ref()); window.set_visual(visual.as_ref());
} }
/// Get the monitor geometry of a given monitor number, or the default if none is given /// Get the monitor geometry of a given monitor number, or the default if none is given
fn get_monitor_geometry(n: Option<i32>) -> Result<gdk::Rectangle> { fn get_monitor_geometry(n: Option<i32>) -> Result<gdk::Rectangle> {
#[allow(deprecated)] #[allow(deprecated)]
let display = gdk::Display::get_default().expect("could not get default display"); let display = gdk::Display::default().expect("could not get default display");
let monitor = match n { let monitor = match n {
Some(n) => display.get_monitor(n).with_context(|| format!("Failed to get monitor with index {}", n))?, Some(n) => display.monitor(n).with_context(|| format!("Failed to get monitor with index {}", n))?,
None => display.get_primary_monitor().context("Failed to get primary monitor from GTK")?, None => display.primary_monitor().context("Failed to get primary monitor from GTK")?,
}; };
Ok(monitor.get_geometry()) Ok(monitor.geometry())
} }
pub fn get_window_rectangle(geometry: WindowGeometry, screen_rect: gdk::Rectangle) -> gdk::Rectangle { pub fn get_window_rectangle(geometry: WindowGeometry, screen_rect: gdk::Rectangle) -> gdk::Rectangle {

View file

@ -24,7 +24,7 @@ mod platform {
// Sets the monitor where the surface is shown // Sets the monitor where the surface is shown
match window_def.monitor_number { match window_def.monitor_number {
Some(index) => { Some(index) => {
if let Some(monitor) = gdk::Display::get_default().expect("could not get default display").get_monitor(index) { if let Some(monitor) = gdk::Display::default().expect("could not get default display").monitor(index) {
gtk_layer_shell::set_monitor(&window, &monitor); gtk_layer_shell::set_monitor(&window, &monitor);
} else { } else {
return None; return None;
@ -152,13 +152,13 @@ mod platform {
monitor_rect: gdk::Rectangle, monitor_rect: gdk::Rectangle,
window_def: &EwwWindowDefinition, window_def: &EwwWindowDefinition,
) -> Result<()> { ) -> Result<()> {
let win_id = window let gdk_window = window
.get_window() .window()
.context("Couldn't get gdk window from gtk window")? .context("Couldn't get gdk window from gtk window")?;
.downcast::<gdkx11::X11Window>() let win_id = gdk_window
.ok() .downcast_ref::<gdkx11::X11Window>()
.context("Failed to get x11 window for gtk window")? .context("Failed to get x11 window for gtk window")?
.get_xid() as u32; .xid() as u32;
let strut_def = window_def.backend_options.struts; let strut_def = window_def.backend_options.struts;
let root_window_geometry = self.conn.get_geometry(self.root_window)?.reply()?; let root_window_geometry = self.conn.get_geometry(self.root_window)?.reply()?;

View file

@ -70,7 +70,7 @@ pub fn initialize_server(paths: EwwPaths, action: Option<DaemonCommand>) -> Resu
paths, paths,
}; };
if let Some(screen) = gdk::Screen::get_default() { if let Some(screen) = gdk::Screen::default() {
gtk::StyleContext::add_provider_for_screen(&screen, &app.css_provider, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION); gtk::StyleContext::add_provider_for_screen(&screen, &app.css_provider, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION);
} }

View file

@ -71,14 +71,14 @@ fn build_builtin_gtk_widget(
if let Some(gtk_widget) = gtk_widget.dynamic_cast_ref::<gtk::Container>() { if let Some(gtk_widget) = gtk_widget.dynamic_cast_ref::<gtk::Container>() {
resolve_container_attrs(&mut bargs, gtk_widget); resolve_container_attrs(&mut bargs, gtk_widget);
if gtk_widget.get_children().is_empty() { if gtk_widget.children().is_empty() {
for child in &widget.children { for child in &widget.children {
let child_widget = child.render(bargs.eww_state, window_name, widget_definitions).with_context(|| { let child_widget = child.render(bargs.eww_state, window_name, widget_definitions).with_context(|| {
format!( format!(
"{}error while building child '{:#?}' of '{}'", "{}error while building child '{:#?}' of '{}'",
format!("{} | ", widget.span), format!("{} | ", widget.span),
&child, &child,
&gtk_widget.get_widget_name() &gtk_widget.widget_name()
) )
})?; })?;
gtk_widget.add(&child_widget); gtk_widget.add(&child_widget);

View file

@ -4,9 +4,8 @@ use crate::{
enum_parse, error::DiagError, error_handling_ctx, eww_state, resolve_block, util::list_difference, widgets::widget_node, enum_parse, error::DiagError, error_handling_ctx, eww_state, resolve_block, util::list_difference, widgets::widget_node,
}; };
use anyhow::*; use anyhow::*;
use gdk::WindowExt;
use glib; use glib;
use gtk::{self, prelude::*, ImageExt}; use gtk::{self, prelude::*};
use itertools::Itertools; use itertools::Itertools;
use std::{cell::RefCell, cmp::Ordering, collections::HashMap, rc::Rc, time::Duration}; use std::{cell::RefCell, cmp::Ordering, collections::HashMap, rc::Rc, time::Duration};
use yuck::{ use yuck::{
@ -16,6 +15,8 @@ use yuck::{
parser::from_ast::FromAst, parser::from_ast::FromAst,
}; };
type EventHandlerId = Rc<RefCell<Option<gtk::glib::SignalHandlerId>>>;
// TODO figure out how to // TODO figure out how to
// TODO https://developer.gnome.org/gtk3/stable/GtkFixed.html // TODO https://developer.gnome.org/gtk3/stable/GtkFixed.html
@ -69,23 +70,23 @@ pub(super) fn resolve_widget_attrs(bargs: &mut BuilderArgs, gtk_widget: &gtk::Wi
}) })
} }
let on_scroll_handler_id: Rc<RefCell<Option<glib::SignalHandlerId>>> = Rc::new(RefCell::new(None)); let on_scroll_handler_id: EventHandlerId = Rc::new(RefCell::new(None));
let on_hover_handler_id: Rc<RefCell<Option<glib::SignalHandlerId>>> = Rc::new(RefCell::new(None)); let on_hover_handler_id: EventHandlerId = Rc::new(RefCell::new(None));
let cursor_hover_enter_handler_id: Rc<RefCell<Option<glib::SignalHandlerId>>> = Rc::new(RefCell::new(None)); let cursor_hover_enter_handler_id: EventHandlerId = Rc::new(RefCell::new(None));
let cursor_hover_leave_handler_id: Rc<RefCell<Option<glib::SignalHandlerId>>> = Rc::new(RefCell::new(None)); let cursor_hover_leave_handler_id: EventHandlerId = Rc::new(RefCell::new(None));
resolve_block!(bargs, gtk_widget, { resolve_block!(bargs, gtk_widget, {
// @prop class - css class name // @prop class - css class name
prop(class: as_string) { prop(class: as_string) {
let old_classes = gtk_widget.get_style_context().list_classes(); let old_classes = gtk_widget.style_context().list_classes();
let old_classes = old_classes.iter().map(|x| x.as_str()).collect::<Vec<&str>>(); let old_classes = old_classes.iter().map(|x| x.as_str()).collect::<Vec<&str>>();
let new_classes = class.split(' ').collect::<Vec<_>>(); let new_classes = class.split(' ').collect::<Vec<_>>();
let (missing, new) = list_difference(&old_classes, &new_classes); let (missing, new) = list_difference(&old_classes, &new_classes);
for class in missing { for class in missing {
gtk_widget.get_style_context().remove_class(class); gtk_widget.style_context().remove_class(class);
} }
for class in new { for class in new {
gtk_widget.get_style_context().add_class(class); gtk_widget.style_context().add_class(class);
} }
}, },
// @prop valign - how to align this vertically. possible values: $alignment // @prop valign - how to align this vertically. possible values: $alignment
@ -97,9 +98,9 @@ pub(super) fn resolve_widget_attrs(bargs: &mut BuilderArgs, gtk_widget: &gtk::Wi
// @prop hexpand - should this widget expand horizontally. Default: false. // @prop hexpand - should this widget expand horizontally. Default: false.
prop(hexpand: as_bool = false) { gtk_widget.set_hexpand(hexpand) }, prop(hexpand: as_bool = false) { gtk_widget.set_hexpand(hexpand) },
// @prop width - width of this element. note that this can not restrict the size if the contents stretch it // @prop width - width of this element. note that this can not restrict the size if the contents stretch it
prop(width: as_f64) { gtk_widget.set_size_request(width as i32, gtk_widget.get_allocated_height()) }, prop(width: as_f64) { gtk_widget.set_size_request(width as i32, gtk_widget.allocated_height()) },
// @prop height - height of this element. note that this can not restrict the size if the contents stretch it // @prop height - height of this element. note that this can not restrict the size if the contents stretch it
prop(height: as_f64) { gtk_widget.set_size_request(gtk_widget.get_allocated_width(), height as i32) }, prop(height: as_f64) { gtk_widget.set_size_request(gtk_widget.allocated_width(), height as i32) },
// @prop active - If this widget can be interacted with // @prop active - If this widget can be interacted with
prop(active: as_bool = true) { gtk_widget.set_sensitive(active) }, prop(active: as_bool = true) { gtk_widget.set_sensitive(active) },
// @prop tooltip - tooltip text (on hover) // @prop tooltip - tooltip text (on hover)
@ -115,7 +116,7 @@ pub(super) fn resolve_widget_attrs(bargs: &mut BuilderArgs, gtk_widget: &gtk::Wi
prop(style: as_string) { prop(style: as_string) {
gtk_widget.reset_style(); gtk_widget.reset_style();
css_provider.load_from_data(format!("* {{ {} }}", style).as_bytes())?; css_provider.load_from_data(format!("* {{ {} }}", style).as_bytes())?;
gtk_widget.get_style_context().add_provider(&css_provider, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION) gtk_widget.style_context().add_provider(&css_provider, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION)
}, },
// @prop timeout - timeout of the command // @prop timeout - timeout of the command
// @prop onscroll - event to execute when the user scrolls with the mouse over the widget. The placeholder `{}` used in the command will be replaced with either `up` or `down`. // @prop onscroll - event to execute when the user scrolls with the mouse over the widget. The placeholder `{}` used in the command will be replaced with either `up` or `down`.
@ -124,7 +125,7 @@ pub(super) fn resolve_widget_attrs(bargs: &mut BuilderArgs, gtk_widget: &gtk::Wi
gtk_widget.add_events(gdk::EventMask::SMOOTH_SCROLL_MASK); gtk_widget.add_events(gdk::EventMask::SMOOTH_SCROLL_MASK);
let old_id = on_scroll_handler_id.replace(Some( let old_id = on_scroll_handler_id.replace(Some(
gtk_widget.connect_scroll_event(move |_, evt| { gtk_widget.connect_scroll_event(move |_, evt| {
run_command(timeout, &onscroll, if evt.get_delta().1 < 0f64 { "up" } else { "down" }); run_command(timeout, &onscroll, if evt.delta().1 < 0f64 { "up" } else { "down" });
gtk::Inhibit(false) gtk::Inhibit(false)
}) })
)); ));
@ -136,7 +137,7 @@ pub(super) fn resolve_widget_attrs(bargs: &mut BuilderArgs, gtk_widget: &gtk::Wi
gtk_widget.add_events(gdk::EventMask::ENTER_NOTIFY_MASK); gtk_widget.add_events(gdk::EventMask::ENTER_NOTIFY_MASK);
let old_id = on_hover_handler_id.replace(Some( let old_id = on_hover_handler_id.replace(Some(
gtk_widget.connect_enter_notify_event(move |_, evt| { gtk_widget.connect_enter_notify_event(move |_, evt| {
run_command(timeout, &onhover, format!("{} {}", evt.get_position().0, evt.get_position().1)); run_command(timeout, &onhover, format!("{} {}", evt.position().0, evt.position().1));
gtk::Inhibit(false) gtk::Inhibit(false)
}) })
)); ));
@ -148,8 +149,8 @@ pub(super) fn resolve_widget_attrs(bargs: &mut BuilderArgs, gtk_widget: &gtk::Wi
gtk_widget.add_events(gdk::EventMask::ENTER_NOTIFY_MASK); gtk_widget.add_events(gdk::EventMask::ENTER_NOTIFY_MASK);
cursor_hover_enter_handler_id.replace(Some( cursor_hover_enter_handler_id.replace(Some(
gtk_widget.connect_enter_notify_event(move |widget, _evt| { gtk_widget.connect_enter_notify_event(move |widget, _evt| {
let display = gdk::Display::get_default(); let display = gdk::Display::default();
let gdk_window = widget.get_window(); let gdk_window = widget.window();
if let (Some(display), Some(gdk_window)) = (display, gdk_window) { if let (Some(display), Some(gdk_window)) = (display, gdk_window) {
gdk_window.set_cursor(gdk::Cursor::from_name(&display, &cursor).as_ref()); gdk_window.set_cursor(gdk::Cursor::from_name(&display, &cursor).as_ref());
} }
@ -159,7 +160,7 @@ pub(super) fn resolve_widget_attrs(bargs: &mut BuilderArgs, gtk_widget: &gtk::Wi
cursor_hover_leave_handler_id.replace(Some( cursor_hover_leave_handler_id.replace(Some(
gtk_widget.connect_leave_notify_event(move |widget, _evt| { gtk_widget.connect_leave_notify_event(move |widget, _evt| {
let gdk_window = widget.get_window(); let gdk_window = widget.window();
if let Some(gdk_window) = gdk_window { if let Some(gdk_window) = gdk_window {
gdk_window.set_cursor(None); gdk_window.set_cursor(None);
} }
@ -177,7 +178,7 @@ pub(super) fn resolve_container_attrs(_bargs: &mut BuilderArgs, _gtk_widget: &gt
/// @widget !range /// @widget !range
pub(super) fn resolve_range_attrs(bargs: &mut BuilderArgs, gtk_widget: &gtk::Range) { pub(super) fn resolve_range_attrs(bargs: &mut BuilderArgs, gtk_widget: &gtk::Range) {
let on_change_handler_id: Rc<RefCell<Option<glib::SignalHandlerId>>> = Rc::new(RefCell::new(None)); let on_change_handler_id: EventHandlerId = Rc::new(RefCell::new(None));
gtk_widget.set_sensitive(false); gtk_widget.set_sensitive(false);
// only allow changing the value via the value property if the user isn't currently dragging // only allow changing the value via the value property if the user isn't currently dragging
@ -199,9 +200,9 @@ pub(super) fn resolve_range_attrs(bargs: &mut BuilderArgs, gtk_widget: &gtk::Ran
} }
}, },
// @prop min - the minimum value // @prop min - the minimum value
prop(min: as_f64) { gtk_widget.get_adjustment().set_lower(min)}, prop(min: as_f64) { gtk_widget.adjustment().set_lower(min)},
// @prop max - the maximum value // @prop max - the maximum value
prop(max: as_f64) { gtk_widget.get_adjustment().set_upper(max)}, prop(max: as_f64) { gtk_widget.adjustment().set_upper(max)},
// @prop timeout - timeout of the command // @prop timeout - timeout of the command
// @prop onchange - command executed once the value is changes. The placeholder `{}`, used in the command will be replaced by the new value. // @prop onchange - command executed once the value is changes. The placeholder `{}`, used in the command will be replaced by the new value.
prop(timeout: as_duration = Duration::from_millis(200), onchange: as_string) { prop(timeout: as_duration = Duration::from_millis(200), onchange: as_string) {
@ -209,7 +210,7 @@ pub(super) fn resolve_range_attrs(bargs: &mut BuilderArgs, gtk_widget: &gtk::Ran
gtk_widget.add_events(gdk::EventMask::ENTER_NOTIFY_MASK); gtk_widget.add_events(gdk::EventMask::ENTER_NOTIFY_MASK);
let old_id = on_change_handler_id.replace(Some( let old_id = on_change_handler_id.replace(Some(
gtk_widget.connect_value_changed(move |gtk_widget| { gtk_widget.connect_value_changed(move |gtk_widget| {
run_command(timeout, &onchange, gtk_widget.get_value()); run_command(timeout, &onchange, gtk_widget.value());
}) })
)); ));
old_id.map(|id| gtk_widget.disconnect(id)); old_id.map(|id| gtk_widget.disconnect(id));
@ -240,7 +241,7 @@ fn build_if_else(bargs: &mut BuilderArgs) -> Result<gtk::Box> {
resolve_block!(bargs, gtk_widget, { resolve_block!(bargs, gtk_widget, {
prop(cond: as_bool) { prop(cond: as_bool) {
gtk_widget.get_children().iter().for_each(|w| gtk_widget.remove(w)); gtk_widget.children().iter().for_each(|w| gtk_widget.remove(w));
if cond { if cond {
gtk_widget.add(&yes_widget) gtk_widget.add(&yes_widget)
} else { } else {
@ -255,7 +256,7 @@ fn build_if_else(bargs: &mut BuilderArgs) -> Result<gtk::Box> {
/// @desc A combo box allowing the user to choose between several items. /// @desc A combo box allowing the user to choose between several items.
fn build_gtk_combo_box_text(bargs: &mut BuilderArgs) -> Result<gtk::ComboBoxText> { fn build_gtk_combo_box_text(bargs: &mut BuilderArgs) -> Result<gtk::ComboBoxText> {
let gtk_widget = gtk::ComboBoxText::new(); let gtk_widget = gtk::ComboBoxText::new();
let on_change_handler_id: Rc<RefCell<Option<glib::SignalHandlerId>>> = Rc::new(RefCell::new(None)); let on_change_handler_id: EventHandlerId = Rc::new(RefCell::new(None));
resolve_block!(bargs, gtk_widget, { resolve_block!(bargs, gtk_widget, {
// @prop items - Items that should be displayed in the combo box // @prop items - Items that should be displayed in the combo box
prop(items: as_vec) { prop(items: as_vec) {
@ -269,7 +270,7 @@ fn build_gtk_combo_box_text(bargs: &mut BuilderArgs) -> Result<gtk::ComboBoxText
prop(timeout: as_duration = Duration::from_millis(200), onchange: as_string) { prop(timeout: as_duration = Duration::from_millis(200), onchange: as_string) {
let old_id = on_change_handler_id.replace(Some( let old_id = on_change_handler_id.replace(Some(
gtk_widget.connect_changed(move |gtk_widget| { gtk_widget.connect_changed(move |gtk_widget| {
run_command(timeout, &onchange, gtk_widget.get_active_text().unwrap_or_else(|| "".into())); run_command(timeout, &onchange, gtk_widget.active_text().unwrap_or_else(|| "".into()));
}) })
)); ));
old_id.map(|id| gtk_widget.disconnect(id)); old_id.map(|id| gtk_widget.disconnect(id));
@ -309,7 +310,7 @@ fn build_gtk_revealer(bargs: &mut BuilderArgs) -> Result<gtk::Revealer> {
/// @desc A checkbox that can trigger events on checked / unchecked. /// @desc A checkbox that can trigger events on checked / unchecked.
fn build_gtk_checkbox(bargs: &mut BuilderArgs) -> Result<gtk::CheckButton> { fn build_gtk_checkbox(bargs: &mut BuilderArgs) -> Result<gtk::CheckButton> {
let gtk_widget = gtk::CheckButton::new(); let gtk_widget = gtk::CheckButton::new();
let on_change_handler_id: Rc<RefCell<Option<glib::SignalHandlerId>>> = Rc::new(RefCell::new(None)); let on_change_handler_id: EventHandlerId = Rc::new(RefCell::new(None));
resolve_block!(bargs, gtk_widget, { resolve_block!(bargs, gtk_widget, {
// @prop timeout - timeout of the command // @prop timeout - timeout of the command
// @prop onchecked - action (command) to be executed when checked by the user // @prop onchecked - action (command) to be executed when checked by the user
@ -317,7 +318,7 @@ fn build_gtk_checkbox(bargs: &mut BuilderArgs) -> Result<gtk::CheckButton> {
prop(timeout: as_duration = Duration::from_millis(200), onchecked: as_string = "", onunchecked: as_string = "") { prop(timeout: as_duration = Duration::from_millis(200), onchecked: as_string = "", onunchecked: as_string = "") {
let old_id = on_change_handler_id.replace(Some( let old_id = on_change_handler_id.replace(Some(
gtk_widget.connect_toggled(move |gtk_widget| { gtk_widget.connect_toggled(move |gtk_widget| {
run_command(timeout, if gtk_widget.get_active() { &onchecked } else { &onunchecked }, ""); run_command(timeout, if gtk_widget.is_active() { &onchecked } else { &onunchecked }, "");
}) })
)); ));
old_id.map(|id| gtk_widget.disconnect(id)); old_id.map(|id| gtk_widget.disconnect(id));
@ -331,7 +332,7 @@ fn build_gtk_checkbox(bargs: &mut BuilderArgs) -> Result<gtk::CheckButton> {
/// @desc A button opening a color chooser window /// @desc A button opening a color chooser window
fn build_gtk_color_button(bargs: &mut BuilderArgs) -> Result<gtk::ColorButton> { fn build_gtk_color_button(bargs: &mut BuilderArgs) -> Result<gtk::ColorButton> {
let gtk_widget = gtk::ColorButtonBuilder::new().build(); let gtk_widget = gtk::ColorButtonBuilder::new().build();
let on_change_handler_id: Rc<RefCell<Option<glib::SignalHandlerId>>> = Rc::new(RefCell::new(None)); let on_change_handler_id: EventHandlerId = Rc::new(RefCell::new(None));
resolve_block!(bargs, gtk_widget, { resolve_block!(bargs, gtk_widget, {
// @prop use-alpha - bool to whether or not use alpha // @prop use-alpha - bool to whether or not use alpha
prop(use_alpha: as_bool) {gtk_widget.set_use_alpha(use_alpha);}, prop(use_alpha: as_bool) {gtk_widget.set_use_alpha(use_alpha);},
@ -341,7 +342,7 @@ fn build_gtk_color_button(bargs: &mut BuilderArgs) -> Result<gtk::ColorButton> {
prop(timeout: as_duration = Duration::from_millis(200), onchange: as_string) { prop(timeout: as_duration = Duration::from_millis(200), onchange: as_string) {
let old_id = on_change_handler_id.replace(Some( let old_id = on_change_handler_id.replace(Some(
gtk_widget.connect_color_set(move |gtk_widget| { gtk_widget.connect_color_set(move |gtk_widget| {
run_command(timeout, &onchange, gtk_widget.get_rgba()); run_command(timeout, &onchange, gtk_widget.rgba());
}) })
)); ));
old_id.map(|id| gtk_widget.disconnect(id)); old_id.map(|id| gtk_widget.disconnect(id));
@ -355,7 +356,7 @@ fn build_gtk_color_button(bargs: &mut BuilderArgs) -> Result<gtk::ColorButton> {
/// @desc A color chooser widget /// @desc A color chooser widget
fn build_gtk_color_chooser(bargs: &mut BuilderArgs) -> Result<gtk::ColorChooserWidget> { fn build_gtk_color_chooser(bargs: &mut BuilderArgs) -> Result<gtk::ColorChooserWidget> {
let gtk_widget = gtk::ColorChooserWidget::new(); let gtk_widget = gtk::ColorChooserWidget::new();
let on_change_handler_id: Rc<RefCell<Option<glib::SignalHandlerId>>> = Rc::new(RefCell::new(None)); let on_change_handler_id: EventHandlerId = Rc::new(RefCell::new(None));
resolve_block!(bargs, gtk_widget, { resolve_block!(bargs, gtk_widget, {
// @prop use-alpha - bool to wether or not use alpha // @prop use-alpha - bool to wether or not use alpha
prop(use_alpha: as_bool) {gtk_widget.set_use_alpha(use_alpha);}, prop(use_alpha: as_bool) {gtk_widget.set_use_alpha(use_alpha);},
@ -410,7 +411,7 @@ fn build_gtk_progress(bargs: &mut BuilderArgs) -> Result<gtk::ProgressBar> {
/// @desc An input field. For this to be useful, set `focusable="true"` on the window. /// @desc An input field. For this to be useful, set `focusable="true"` on the window.
fn build_gtk_input(bargs: &mut BuilderArgs) -> Result<gtk::Entry> { fn build_gtk_input(bargs: &mut BuilderArgs) -> Result<gtk::Entry> {
let gtk_widget = gtk::Entry::new(); let gtk_widget = gtk::Entry::new();
let on_change_handler_id: Rc<RefCell<Option<glib::SignalHandlerId>>> = Rc::new(RefCell::new(None)); let on_change_handler_id: EventHandlerId = Rc::new(RefCell::new(None));
resolve_block!(bargs, gtk_widget, { resolve_block!(bargs, gtk_widget, {
// @prop value - the content of the text field // @prop value - the content of the text field
prop(value: as_string) { prop(value: as_string) {
@ -422,7 +423,7 @@ fn build_gtk_input(bargs: &mut BuilderArgs) -> Result<gtk::Entry> {
prop(timeout: as_duration = Duration::from_millis(200), onchange: as_string) { prop(timeout: as_duration = Duration::from_millis(200), onchange: as_string) {
let old_id = on_change_handler_id.replace(Some( let old_id = on_change_handler_id.replace(Some(
gtk_widget.connect_changed(move |gtk_widget| { gtk_widget.connect_changed(move |gtk_widget| {
run_command(timeout, &onchange, gtk_widget.get_text().to_string()); run_command(timeout, &onchange, gtk_widget.text().to_string());
}) })
)); ));
old_id.map(|id| gtk_widget.disconnect(id)); old_id.map(|id| gtk_widget.disconnect(id));
@ -435,7 +436,7 @@ fn build_gtk_input(bargs: &mut BuilderArgs) -> Result<gtk::Entry> {
/// @desc A button /// @desc A button
fn build_gtk_button(bargs: &mut BuilderArgs) -> Result<gtk::Button> { fn build_gtk_button(bargs: &mut BuilderArgs) -> Result<gtk::Button> {
let gtk_widget = gtk::Button::new(); let gtk_widget = gtk::Button::new();
let on_click_handler_id: Rc<RefCell<Option<glib::SignalHandlerId>>> = Rc::new(RefCell::new(None)); let on_click_handler_id: EventHandlerId = Rc::new(RefCell::new(None));
resolve_block!(bargs, gtk_widget, { resolve_block!(bargs, gtk_widget, {
// @prop onclick - a command that get's run when the button is clicked // @prop onclick - a command that get's run when the button is clicked
@ -451,7 +452,7 @@ fn build_gtk_button(bargs: &mut BuilderArgs) -> Result<gtk::Button> {
gtk_widget.add_events(gdk::EventMask::ENTER_NOTIFY_MASK); gtk_widget.add_events(gdk::EventMask::ENTER_NOTIFY_MASK);
let old_id = on_click_handler_id.replace(Some( let old_id = on_click_handler_id.replace(Some(
gtk_widget.connect_button_press_event(move |_, evt| { gtk_widget.connect_button_press_event(move |_, evt| {
match evt.get_button() { match evt.button() {
1 => run_command(timeout, &onclick, ""), 1 => run_command(timeout, &onclick, ""),
2 => run_command(timeout, &onmiddleclick, ""), 2 => run_command(timeout, &onmiddleclick, ""),
3 => run_command(timeout, &onrightclick, ""), 3 => run_command(timeout, &onrightclick, ""),
@ -477,10 +478,10 @@ fn build_gtk_image(bargs: &mut BuilderArgs) -> Result<gtk::Image> {
// @prop height - height of the image // @prop height - height of the image
prop(path: as_string, width: as_i32 = 10000, height: as_i32 = 10000) { prop(path: as_string, width: as_i32 = 10000, height: as_i32 = 10000) {
if path.ends_with(".gif") { if path.ends_with(".gif") {
let pixbuf_animation = gdk_pixbuf::PixbufAnimation::from_file(std::path::PathBuf::from(path))?; let pixbuf_animation = gtk::gdk_pixbuf::PixbufAnimation::from_file(std::path::PathBuf::from(path))?;
gtk_widget.set_from_animation(&pixbuf_animation); gtk_widget.set_from_animation(&pixbuf_animation);
} else { } else {
let pixbuf = gdk_pixbuf::Pixbuf::from_file_at_size(std::path::PathBuf::from(path), width, height)?; let pixbuf = gtk::gdk_pixbuf::Pixbuf::from_file_at_size(std::path::PathBuf::from(path), width, height)?;
gtk_widget.set_from_pixbuf(Some(&pixbuf)); gtk_widget.set_from_pixbuf(Some(&pixbuf));
} }
} }
@ -595,7 +596,7 @@ fn build_gtk_literal(bargs: &mut BuilderArgs) -> Result<gtk::Box> {
resolve_block!(bargs, gtk_widget, { resolve_block!(bargs, gtk_widget, {
// @prop content - inline yuck that will be rendered as a widget. // @prop content - inline yuck that will be rendered as a widget.
prop(content: as_string) { prop(content: as_string) {
gtk_widget.get_children().iter().for_each(|w| gtk_widget.remove(w)); gtk_widget.children().iter().for_each(|w| gtk_widget.remove(w));
if !content.is_empty() { if !content.is_empty() {
let widget_node_result: AstResult<_> = try { let widget_node_result: AstResult<_> = try {
let ast = { let ast = {
@ -630,22 +631,22 @@ fn build_gtk_literal(bargs: &mut BuilderArgs) -> Result<gtk::Box> {
/// @desc A widget that displays a calendar /// @desc A widget that displays a calendar
fn build_gtk_calendar(bargs: &mut BuilderArgs) -> Result<gtk::Calendar> { fn build_gtk_calendar(bargs: &mut BuilderArgs) -> Result<gtk::Calendar> {
let gtk_widget = gtk::Calendar::new(); let gtk_widget = gtk::Calendar::new();
let on_click_handler_id: Rc<RefCell<Option<glib::SignalHandlerId>>> = Rc::new(RefCell::new(None)); let on_click_handler_id: EventHandlerId = Rc::new(RefCell::new(None));
resolve_block!(bargs, gtk_widget, { resolve_block!(bargs, gtk_widget, {
// @prop day - the selected day // @prop day - the selected day
prop(day: as_f64) { gtk_widget.set_property_day(day as i32) }, prop(day: as_f64) { gtk_widget.set_day(day as i32) },
// @prop month - the selected month // @prop month - the selected month
prop(month: as_f64) { gtk_widget.set_property_day(month as i32) }, prop(month: as_f64) { gtk_widget.set_month(month as i32) },
// @prop year - the selected year // @prop year - the selected year
prop(year: as_f64) { gtk_widget.set_property_day(year as i32) }, prop(year: as_f64) { gtk_widget.set_year(year as i32) },
// @prop show-details - show details // @prop show-details - show details
prop(show_details: as_bool) { gtk_widget.set_property_show_details(show_details) }, prop(show_details: as_bool) { gtk_widget.set_show_details(show_details) },
// @prop show-heading - show heading line // @prop show-heading - show heading line
prop(show_heading: as_bool) { gtk_widget.set_property_show_heading(show_heading) }, prop(show_heading: as_bool) { gtk_widget.set_show_heading(show_heading) },
// @prop show-day-names - show names of days // @prop show-day-names - show names of days
prop(show_day_names: as_bool) { gtk_widget.set_property_show_day_names(show_day_names) }, prop(show_day_names: as_bool) { gtk_widget.set_show_day_names(show_day_names) },
// @prop show-week-numbers - show week numbers // @prop show-week-numbers - show week numbers
prop(show_week_numbers: as_bool) { gtk_widget.set_property_show_week_numbers(show_week_numbers) }, prop(show_week_numbers: as_bool) { gtk_widget.set_show_week_numbers(show_week_numbers) },
// @prop onclick - command to run when the user selects a date. The `{}` placeholder will be replaced by the selected date. // @prop onclick - command to run when the user selects a date. The `{}` placeholder will be replaced by the selected date.
// @prop timeout - timeout of the command // @prop timeout - timeout of the command
prop(timeout: as_duration = Duration::from_millis(200), onclick: as_string) { prop(timeout: as_duration = Duration::from_millis(200), onclick: as_string) {
@ -654,7 +655,7 @@ fn build_gtk_calendar(bargs: &mut BuilderArgs) -> Result<gtk::Calendar> {
run_command( run_command(
timeout, timeout,
&onclick, &onclick,
format!("{}.{}.{}", w.get_property_day(), w.get_property_month(), w.get_property_year()) format!("{}.{}.{}", w.day(), w.month(), w.year())
) )
}) })
)); ));