0.3.0 wip
This commit is contained in:
parent
6771cdf10e
commit
ea2d41ad1b
18 changed files with 303 additions and 790 deletions
3
.gdb_history
Normal file
3
.gdb_history
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
run
|
||||||
|
run -o shiet.png fullscreen
|
||||||
|
bt
|
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,3 +0,0 @@
|
||||||
[submodule "slop-sys/slop"]
|
|
||||||
path = slop-sys/slop
|
|
||||||
url = https://github.com/naelstrof/slop.git
|
|
342
Cargo.lock
generated
342
Cargo.lock
generated
|
@ -6,18 +6,6 @@ dependencies = [
|
||||||
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "atk-sys"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "atty"
|
name = "atty"
|
||||||
version = "0.2.10"
|
version = "0.2.10"
|
||||||
|
@ -54,33 +42,6 @@ name = "bitflags"
|
||||||
version = "1.0.3"
|
version = "1.0.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "c_vec"
|
|
||||||
version = "1.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cairo-rs"
|
|
||||||
version = "0.4.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"c_vec 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cairo-sys-rs 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cairo-sys-rs"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.15"
|
version = "1.0.15"
|
||||||
|
@ -105,14 +66,6 @@ dependencies = [
|
||||||
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cmake"
|
|
||||||
version = "0.1.33"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "failure"
|
name = "failure"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
|
@ -132,213 +85,37 @@ dependencies = [
|
||||||
"synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gdk"
|
|
||||||
version = "0.8.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cairo-rs 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cairo-sys-rs 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gdk-pixbuf 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gdk-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gio 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"pango 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gdk-pixbuf"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"gdk-pixbuf-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gio 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gio-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gdk-pixbuf-sys"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gio-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gdk-sys"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cairo-sys-rs 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gdk-pixbuf-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gio-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"pango-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gio"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gio-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gio-sys"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "glib"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "glib-sys"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gobject-sys"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gtk"
|
|
||||||
version = "0.4.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cairo-rs 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cairo-sys-rs 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gdk 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gdk-pixbuf 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gdk-pixbuf-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gdk-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gio 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gio-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gtk-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"pango 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gtk-sys"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"atk-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cairo-sys-rs 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gdk-pixbuf-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gdk-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gio-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"pango-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "lazy_static"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.40"
|
version = "0.2.40"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pango"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"pango-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pango-sys"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pkg-config"
|
name = "pkg-config"
|
||||||
version = "0.3.11"
|
version = "0.3.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "0.4.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "0.3.15"
|
version = "0.3.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "0.6.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.1.37"
|
version = "0.1.37"
|
||||||
|
@ -359,24 +136,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "screenshot"
|
name = "screenshot"
|
||||||
version = "0.2.3"
|
version = "0.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cairo-rs 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gdk 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gdk-pixbuf 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gio 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gtk 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"slop-sys 0.1.0",
|
|
||||||
"time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
"x11 2.18.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "slop-sys"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -384,6 +149,25 @@ name = "strsim"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "structopt"
|
||||||
|
version = "0.2.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"structopt-derive 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "structopt-derive"
|
||||||
|
version = "0.2.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "0.11.11"
|
version = "0.11.11"
|
||||||
|
@ -394,6 +178,16 @@ dependencies = [
|
||||||
"unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "0.14.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "synom"
|
name = "synom"
|
||||||
version = "0.11.3"
|
version = "0.11.3"
|
||||||
|
@ -449,6 +243,11 @@ name = "unicode-xid"
|
||||||
version = "0.0.4"
|
version = "0.0.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-xid"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vec_map"
|
name = "vec_map"
|
||||||
version = "0.8.1"
|
version = "0.8.1"
|
||||||
|
@ -473,44 +272,39 @@ name = "winapi-x86_64-pc-windows-gnu"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "x11"
|
||||||
|
version = "2.18.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||||
"checksum atk-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8dc233521f7bffd3042c31082ea71bd08820abf44bac938fb36591e20f76f39"
|
|
||||||
"checksum atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2fc4a1aa4c24c0718a250f0681885c1af91419d242f29eb8f2ab28502d80dbd1"
|
"checksum atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2fc4a1aa4c24c0718a250f0681885c1af91419d242f29eb8f2ab28502d80dbd1"
|
||||||
"checksum backtrace 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea58cd16fd6c9d120b5bcb01d63883ae4cc7ba2aed35c1841b862a3c7ef6639"
|
"checksum backtrace 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea58cd16fd6c9d120b5bcb01d63883ae4cc7ba2aed35c1841b862a3c7ef6639"
|
||||||
"checksum backtrace-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "44585761d6161b0f57afc49482ab6bd067e4edef48c12a152c237eb0203f7661"
|
"checksum backtrace-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "44585761d6161b0f57afc49482ab6bd067e4edef48c12a152c237eb0203f7661"
|
||||||
"checksum bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c54bb8f454c567f21197eefcdbf5679d0bd99f2ddbe52e84c77061952e6789"
|
"checksum bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c54bb8f454c567f21197eefcdbf5679d0bd99f2ddbe52e84c77061952e6789"
|
||||||
"checksum c_vec 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "11f56b93adbca81a4ed1bb654070013b496a9b0b259a296281f4be24af84debd"
|
|
||||||
"checksum cairo-rs 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a110f269c2fd382df5fe8bd46dfa5f1b83608aa717fecb6e7a28c08c202f0e13"
|
|
||||||
"checksum cairo-sys-rs 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0395175ecba60accac076a02c31d143b9dcd9d5eb5316d7163a3273803b765c7"
|
|
||||||
"checksum cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "0ebb87d1116151416c0cf66a0e3fb6430cccd120fd6300794b4dfaa050ac40ba"
|
"checksum cc 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "0ebb87d1116151416c0cf66a0e3fb6430cccd120fd6300794b4dfaa050ac40ba"
|
||||||
"checksum cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "405216fd8fe65f718daa7102ea808a946b6ce40c742998fbfd3463645552de18"
|
"checksum cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "405216fd8fe65f718daa7102ea808a946b6ce40c742998fbfd3463645552de18"
|
||||||
"checksum clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536"
|
"checksum clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536"
|
||||||
"checksum cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)" = "704fbf3bb5149daab0afb255dbea24a1f08d2f4099cedb9baab6d470d4c5eefb"
|
|
||||||
"checksum failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82"
|
"checksum failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82"
|
||||||
"checksum failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cdda555bb90c9bb67a3b670a0f42de8e73f5981524123ad8578aafec8ddb8b"
|
"checksum failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cdda555bb90c9bb67a3b670a0f42de8e73f5981524123ad8578aafec8ddb8b"
|
||||||
"checksum gdk 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd30051ff3d908ff2fc7e5776ffe1c699821e043809f294c3a61004f11d6c3a9"
|
|
||||||
"checksum gdk-pixbuf 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c2d2199eba47ebcb9977ce28179649bdd59305ef465c4e6f9b65aaa41c24e6b5"
|
|
||||||
"checksum gdk-pixbuf-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df6a3b73e04fafc07f5ebc083f1096a773412e627828e1103a55e921f81187d8"
|
|
||||||
"checksum gdk-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3162ff940526ddff71bf1f630facee6b5e05d282d125ba0c4c803842819b80c3"
|
|
||||||
"checksum gio 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "071fd4e5592b39fdc31318e32d2497842501f539bcedb60c75cd365946642adc"
|
|
||||||
"checksum gio-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a57872499171d279f8577ce83837da4cae62b08dd32892236ed67ab7ea61030"
|
|
||||||
"checksum glib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e0be1b1432e227bcd1a9b28db9dc1474a7e7fd4227e08e16f35304f32d09b61"
|
|
||||||
"checksum glib-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "615bef979b5838526aee99241afc80cfb2e34a8735d4bcb8ec6072598c18a408"
|
|
||||||
"checksum gobject-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70409d6405db8b1591602fcd0cbe8af52cd9976dd39194442b4c149ba343f86d"
|
|
||||||
"checksum gtk 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d695d6be4110618a97c19cd068e8a00e53e33b87e3c65cdc5397667498b1bc24"
|
|
||||||
"checksum gtk-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d9554cf5b3a85a13fb39258c65b04b262989c1d7a758f8f555b77a478621a91"
|
|
||||||
"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d"
|
|
||||||
"checksum libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)" = "6fd41f331ac7c5b8ac259b8bf82c75c0fb2e469bbf37d2becbba9a6a2221965b"
|
"checksum libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)" = "6fd41f331ac7c5b8ac259b8bf82c75c0fb2e469bbf37d2becbba9a6a2221965b"
|
||||||
"checksum pango 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45374801e224373c3c0393cd48073c81093494c8735721e81d1dbaa4096b2767"
|
|
||||||
"checksum pango-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94039b3921a4af4058a3e4335e5d15099101f298a92f5afc40bab3a3027594a1"
|
|
||||||
"checksum pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "110d5ee3593dbb73f56294327fe5668bcc997897097cbc76b51e7aed3f52452f"
|
"checksum pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "110d5ee3593dbb73f56294327fe5668bcc997897097cbc76b51e7aed3f52452f"
|
||||||
|
"checksum proc-macro2 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "ffe022fb8c8bd254524b0b3305906c1921fa37a84a644e29079a9e62200c3901"
|
||||||
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
|
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
|
||||||
|
"checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5"
|
||||||
"checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd"
|
"checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd"
|
||||||
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
||||||
"checksum rustc-demangle 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "76d7ba1feafada44f2d38eed812bd2489a03c0f5abb975799251518b68848649"
|
"checksum rustc-demangle 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "76d7ba1feafada44f2d38eed812bd2489a03c0f5abb975799251518b68848649"
|
||||||
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
|
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
|
||||||
|
"checksum structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d8e9ad6a11096cbecdcca0cc6aa403fdfdbaeda2fb3323a39c98e6a166a1e45a"
|
||||||
|
"checksum structopt-derive 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4cbce8ccdc62166bd594c14396a3242bf94c337a51dbfa9be1076dd74b3db2af"
|
||||||
"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
|
"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
|
||||||
|
"checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741"
|
||||||
"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
|
"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
|
||||||
"checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd"
|
"checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd"
|
||||||
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
||||||
|
@ -518,7 +312,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b"
|
"checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b"
|
||||||
"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
|
"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
|
||||||
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
|
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
|
||||||
|
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||||
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
||||||
"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3"
|
"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3"
|
||||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
"checksum x11 2.18.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39697e3123f715483d311b5826e254b6f3cfebdd83cf7ef3358f579c3d68e235"
|
||||||
|
|
20
Cargo.toml
20
Cargo.toml
|
@ -1,18 +1,14 @@
|
||||||
[package]
|
[package]
|
||||||
name = "screenshot"
|
name = "screenshot"
|
||||||
version = "0.2.4"
|
description = "Screenshot capture utility."
|
||||||
|
version = "0.3.0"
|
||||||
authors = ["Michael Zhang <failed.down@gmail.com>"]
|
authors = ["Michael Zhang <failed.down@gmail.com>"]
|
||||||
|
|
||||||
[workspace]
|
[lib]
|
||||||
members = [".", "slop-sys"]
|
crate-type = ["dylib", "rlib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = "2.31.2"
|
failure = "0.1"
|
||||||
cairo-rs = { version = "0.4.1", features = ["png"] }
|
structopt = "0.2"
|
||||||
failure = "0.1.1"
|
time = "0.1"
|
||||||
gdk = "0.8.0"
|
x11 = { version = "2.18", features = ["xlib"] }
|
||||||
gdk-pixbuf = "0.4.0"
|
|
||||||
gio = "0.4.0"
|
|
||||||
gtk = { version = "0.4.1", features = ["v3_16"] }
|
|
||||||
time = "0.1.40"
|
|
||||||
slop-sys = { path = "slop-sys" }
|
|
||||||
|
|
2
peda-session-screenshot.txt
Normal file
2
peda-session-screenshot.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
|
4
slop-sys/Cargo.lock
generated
4
slop-sys/Cargo.lock
generated
|
@ -1,4 +0,0 @@
|
||||||
[[package]]
|
|
||||||
name = "slop-sys"
|
|
||||||
version = "0.1.0"
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "slop-sys"
|
|
||||||
version = "0.1.0"
|
|
||||||
authors = ["Michael Zhang <failed.down@gmail.com>"]
|
|
||||||
build = "build.rs"
|
|
||||||
|
|
||||||
[lib]
|
|
||||||
path = "lib.rs"
|
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
cmake = "0.1"
|
|
||||||
|
|
||||||
[dependencies]
|
|
|
@ -1,12 +0,0 @@
|
||||||
extern crate cmake;
|
|
||||||
|
|
||||||
use cmake::Config;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let dst = Config::new("slop").define("CMAKE_SKIP_RPATH", "ON").build();
|
|
||||||
println!("cargo:rustc-link-search=native={}", dst.display());
|
|
||||||
println!("cargo:rustc-link-lib=slopy");
|
|
||||||
|
|
||||||
// println!("cargo:rustc-link-lib=slopy");
|
|
||||||
// println!("cargo:rustc-link-search=native=/usr/lib/usr/lib/x86_64-linux-gnu");
|
|
||||||
}
|
|
264
slop-sys/lib.rs
264
slop-sys/lib.rs
|
@ -1,264 +0,0 @@
|
||||||
/* automatically generated by rust-bindgen */
|
|
||||||
|
|
||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
#[repr(C)]
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
|
||||||
pub struct slop_options {
|
|
||||||
pub quiet: ::std::os::raw::c_int,
|
|
||||||
pub border: f32,
|
|
||||||
pub padding: f32,
|
|
||||||
pub tolerance: f32,
|
|
||||||
pub highlight: ::std::os::raw::c_int,
|
|
||||||
pub noopengl: ::std::os::raw::c_int,
|
|
||||||
pub nokeyboard: ::std::os::raw::c_int,
|
|
||||||
pub nodecorations: ::std::os::raw::c_int,
|
|
||||||
pub shaders: *mut ::std::os::raw::c_char,
|
|
||||||
pub r: f32,
|
|
||||||
pub g: f32,
|
|
||||||
pub b: f32,
|
|
||||||
pub a: f32,
|
|
||||||
pub xdisplay: *const ::std::os::raw::c_char,
|
|
||||||
}
|
|
||||||
#[test]
|
|
||||||
fn bindgen_test_layout_slop_options() {
|
|
||||||
assert_eq!(
|
|
||||||
::std::mem::size_of::<slop_options>(),
|
|
||||||
64usize,
|
|
||||||
concat!("Size of: ", stringify!(slop_options))
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
::std::mem::align_of::<slop_options>(),
|
|
||||||
8usize,
|
|
||||||
concat!("Alignment of ", stringify!(slop_options))
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_options>())).quiet as *const _ as usize },
|
|
||||||
0usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_options),
|
|
||||||
"::",
|
|
||||||
stringify!(quiet)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_options>())).border as *const _ as usize },
|
|
||||||
4usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_options),
|
|
||||||
"::",
|
|
||||||
stringify!(border)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_options>())).padding as *const _ as usize },
|
|
||||||
8usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_options),
|
|
||||||
"::",
|
|
||||||
stringify!(padding)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_options>())).tolerance as *const _ as usize },
|
|
||||||
12usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_options),
|
|
||||||
"::",
|
|
||||||
stringify!(tolerance)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_options>())).highlight as *const _ as usize },
|
|
||||||
16usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_options),
|
|
||||||
"::",
|
|
||||||
stringify!(highlight)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_options>())).noopengl as *const _ as usize },
|
|
||||||
20usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_options),
|
|
||||||
"::",
|
|
||||||
stringify!(noopengl)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_options>())).nokeyboard as *const _ as usize },
|
|
||||||
24usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_options),
|
|
||||||
"::",
|
|
||||||
stringify!(nokeyboard)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_options>())).nodecorations as *const _ as usize },
|
|
||||||
28usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_options),
|
|
||||||
"::",
|
|
||||||
stringify!(nodecorations)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_options>())).shaders as *const _ as usize },
|
|
||||||
32usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_options),
|
|
||||||
"::",
|
|
||||||
stringify!(shaders)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_options>())).r as *const _ as usize },
|
|
||||||
40usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_options),
|
|
||||||
"::",
|
|
||||||
stringify!(r)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_options>())).g as *const _ as usize },
|
|
||||||
44usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_options),
|
|
||||||
"::",
|
|
||||||
stringify!(g)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_options>())).b as *const _ as usize },
|
|
||||||
48usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_options),
|
|
||||||
"::",
|
|
||||||
stringify!(b)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_options>())).a as *const _ as usize },
|
|
||||||
52usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_options),
|
|
||||||
"::",
|
|
||||||
stringify!(a)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_options>())).xdisplay as *const _ as usize },
|
|
||||||
56usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_options),
|
|
||||||
"::",
|
|
||||||
stringify!(xdisplay)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
#[repr(C)]
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
|
||||||
pub struct slop_selection {
|
|
||||||
pub cancelled: ::std::os::raw::c_int,
|
|
||||||
pub x: f32,
|
|
||||||
pub y: f32,
|
|
||||||
pub w: f32,
|
|
||||||
pub h: f32,
|
|
||||||
pub id: ::std::os::raw::c_int,
|
|
||||||
}
|
|
||||||
#[test]
|
|
||||||
fn bindgen_test_layout_slop_selection() {
|
|
||||||
assert_eq!(
|
|
||||||
::std::mem::size_of::<slop_selection>(),
|
|
||||||
24usize,
|
|
||||||
concat!("Size of: ", stringify!(slop_selection))
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
::std::mem::align_of::<slop_selection>(),
|
|
||||||
4usize,
|
|
||||||
concat!("Alignment of ", stringify!(slop_selection))
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_selection>())).cancelled as *const _ as usize },
|
|
||||||
0usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_selection),
|
|
||||||
"::",
|
|
||||||
stringify!(cancelled)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_selection>())).x as *const _ as usize },
|
|
||||||
4usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_selection),
|
|
||||||
"::",
|
|
||||||
stringify!(x)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_selection>())).y as *const _ as usize },
|
|
||||||
8usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_selection),
|
|
||||||
"::",
|
|
||||||
stringify!(y)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_selection>())).w as *const _ as usize },
|
|
||||||
12usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_selection),
|
|
||||||
"::",
|
|
||||||
stringify!(w)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_selection>())).h as *const _ as usize },
|
|
||||||
16usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_selection),
|
|
||||||
"::",
|
|
||||||
stringify!(h)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
unsafe { &(*(::std::ptr::null::<slop_selection>())).id as *const _ as usize },
|
|
||||||
20usize,
|
|
||||||
concat!(
|
|
||||||
"Offset of field: ",
|
|
||||||
stringify!(slop_selection),
|
|
||||||
"::",
|
|
||||||
stringify!(id)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
extern "C" {
|
|
||||||
pub fn slop_options_default() -> slop_options;
|
|
||||||
}
|
|
||||||
extern "C" {
|
|
||||||
pub fn slop_select(options: *mut slop_options) -> slop_selection;
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 2196617d8e10bb4a4a1e4a1520af4cab890f1e00
|
|
157
src/capture.rs
157
src/capture.rs
|
@ -1,84 +1,99 @@
|
||||||
use std::fs::File;
|
|
||||||
|
|
||||||
use cairo::{Context, Format, ImageSurface};
|
|
||||||
use failure::Error;
|
|
||||||
use gdk::prelude::*;
|
|
||||||
use gdk::{ContextExt, Display, DisplayExt, Screen, ScreenExt, Window as GdkWindow, WindowExt};
|
|
||||||
use gdk_pixbuf::{Pixbuf, PixbufExt};
|
|
||||||
use gtk::{Clipboard, ClipboardExt};
|
|
||||||
use time;
|
|
||||||
|
|
||||||
use errors::ScreenshotError;
|
use errors::ScreenshotError;
|
||||||
|
|
||||||
|
use gui::GUI;
|
||||||
|
use image::Image;
|
||||||
use options::{Options, Region};
|
use options::{Options, Region};
|
||||||
use selection::select_area;
|
|
||||||
|
|
||||||
pub fn capture(options: Options) -> Result<(), Error> {
|
pub fn capture(opt: &Options) -> Result<Image, ScreenshotError> {
|
||||||
let display;
|
let gui = GUI::new();
|
||||||
let screen;
|
|
||||||
match (Display::get_default(), Screen::get_default()) {
|
|
||||||
(Some(d), Some(s)) => {
|
|
||||||
display = d;
|
|
||||||
screen = s;
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
bail!("Failed to open screen and display.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
display.sync();
|
let window_to_capture = match opt.region {
|
||||||
|
Region::Fullscreen | Region::Selection => gui.get_root_window(),
|
||||||
// first, choose the window
|
Region::ActiveWindow => gui.get_active_window(),
|
||||||
let window_opt = match options.region {
|
|
||||||
Region::Fullscreen | Region::Selection => screen.get_root_window(),
|
|
||||||
Region::ActiveWindow => screen.get_active_window(),
|
|
||||||
};
|
};
|
||||||
let window: GdkWindow;
|
println!("Got window_to_capture: {:?}", window_to_capture);
|
||||||
match window_opt {
|
|
||||||
Some(window_) => window = window_,
|
|
||||||
None => bail!("Failed to locate root window."),
|
|
||||||
}
|
|
||||||
window.process_updates(true);
|
|
||||||
|
|
||||||
// take a screenshot of it
|
let mut capture = gui.window_capture(window_to_capture)?;
|
||||||
let width: i32 = window.get_width();
|
println!("Captured the window.");
|
||||||
let height: i32 = window.get_height();
|
|
||||||
let pixbuf: Pixbuf = match window.get_pixbuf(0, 0, width, height) {
|
|
||||||
Some(pixbuf) => Ok(pixbuf),
|
|
||||||
None => Err(ScreenshotError),
|
|
||||||
}?;
|
|
||||||
|
|
||||||
// launch selection
|
// let final_capture = match opt.region {
|
||||||
let pixbuf = match options.region {
|
// Region::Fullscreen | Region::ActiveWindow => window_capture,
|
||||||
Region::Selection => select_area(pixbuf)?,
|
// Region::Selection => gui.interactive_select(&window_capture),
|
||||||
_ => pixbuf,
|
// };
|
||||||
|
|
||||||
|
if let Region::Selection = opt.region {
|
||||||
|
let region = gui.interactive_select(&capture)?;
|
||||||
|
capture.apply_region(®ion);
|
||||||
|
println!("Subimaged.");
|
||||||
};
|
};
|
||||||
let width = pixbuf.get_width();
|
|
||||||
let height = pixbuf.get_height();
|
|
||||||
|
|
||||||
// create and draw to the surface
|
Ok(capture)
|
||||||
let surface = match ImageSurface::create(Format::Rgb24, width, height) {
|
|
||||||
Ok(surface) => Ok(surface),
|
|
||||||
Err(_status) => Err(ScreenshotError),
|
|
||||||
}?;
|
|
||||||
let ctx = Context::new(&surface);
|
|
||||||
ctx.set_source_pixbuf(&pixbuf, 0.0, 0.0);
|
|
||||||
ctx.paint();
|
|
||||||
|
|
||||||
// write surface to file
|
// let display;
|
||||||
|
// let screen;
|
||||||
|
// match (Display::get_default(), Screen::get_default()) {
|
||||||
|
// (Some(d), Some(s)) => {
|
||||||
|
// display = d;
|
||||||
|
// screen = s;
|
||||||
|
// }
|
||||||
|
// _ => {
|
||||||
|
// bail!("Failed to open screen and display.");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
let now = time::now();
|
// display.sync();
|
||||||
let path = time::strftime(&options.outfile.as_os_str().to_str().unwrap(), &now)?;
|
|
||||||
let mut file = File::create(path)?;
|
|
||||||
surface.write_to_png(&mut file)?;
|
|
||||||
|
|
||||||
if options.clip {
|
// // first, choose the window
|
||||||
match Clipboard::get_default(&display) {
|
// let window_opt = match options.region {
|
||||||
Some(clipboard) => {
|
// Region::Fullscreen | Region::Selection => screen.get_root_window(),
|
||||||
clipboard.set_image(&pixbuf);
|
// Region::ActiveWindow => screen.get_active_window(),
|
||||||
clipboard.store();
|
// };
|
||||||
}
|
// let window: GdkWindow;
|
||||||
None => eprintln!("Failed to copy to the clipboard."),
|
// match window_opt {
|
||||||
}
|
// Some(window_) => window = window_,
|
||||||
}
|
// None => bail!("Failed to locate root window."),
|
||||||
Ok(())
|
// }
|
||||||
|
// window.process_updates(true);
|
||||||
|
|
||||||
|
// // take a screenshot of it
|
||||||
|
// let width: i32 = window.get_width();
|
||||||
|
// let height: i32 = window.get_height();
|
||||||
|
// let pixbuf: Pixbuf = match window.get_pixbuf(0, 0, width, height) {
|
||||||
|
// Some(pixbuf) => Ok(pixbuf),
|
||||||
|
// None => Err(ScreenshotError::InvalidPixbuf),
|
||||||
|
// }?;
|
||||||
|
|
||||||
|
// // launch selection
|
||||||
|
// let pixbuf = match options.region {
|
||||||
|
// Region::Selection => select_area(pixbuf)?,
|
||||||
|
// _ => pixbuf,
|
||||||
|
// };
|
||||||
|
// let width = pixbuf.get_width();
|
||||||
|
// let height = pixbuf.get_height();
|
||||||
|
|
||||||
|
// // create and draw to the surface
|
||||||
|
// let surface = match ImageSurface::create(Format::Rgb24, width, height) {
|
||||||
|
// Ok(surface) => Ok(surface),
|
||||||
|
// Err(_status) => Err(ScreenshotError::SurfaceCreateFail),
|
||||||
|
// }?;
|
||||||
|
// let ctx = Context::new(&surface);
|
||||||
|
// ctx.set_source_pixbuf(&pixbuf, 0.0, 0.0);
|
||||||
|
// ctx.paint();
|
||||||
|
|
||||||
|
// // write surface to file
|
||||||
|
|
||||||
|
// let now = time::now();
|
||||||
|
// let path = time::strftime(&options.outfile.as_os_str().to_str().unwrap(), &now)?;
|
||||||
|
// let mut file = File::create(path)?;
|
||||||
|
// surface.write_to_png(&mut file)?;
|
||||||
|
|
||||||
|
// if options.clipboard {
|
||||||
|
// match Clipboard::get_default(&display) {
|
||||||
|
// Some(clipboard) => {
|
||||||
|
// clipboard.set_image(&pixbuf);
|
||||||
|
// clipboard.store();
|
||||||
|
// }
|
||||||
|
// None => eprintln!("Failed to copy to the clipboard."),
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
use std::error::Error;
|
#[derive(Debug, Fail)]
|
||||||
use std::fmt;
|
pub enum ScreenshotError {
|
||||||
|
#[fail(display = "error")]
|
||||||
#[derive(Debug)]
|
Error,
|
||||||
pub struct ScreenshotError;
|
|
||||||
|
|
||||||
impl fmt::Display for ScreenshotError {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
write!(f, "error")
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl Error for ScreenshotError {}
|
|
||||||
|
|
71
src/gui.rs
Normal file
71
src/gui.rs
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
use std::ffi::CString;
|
||||||
|
|
||||||
|
use x11::xlib::{self, *};
|
||||||
|
|
||||||
|
use errors::ScreenshotError;
|
||||||
|
use image::Image;
|
||||||
|
use Rectangle;
|
||||||
|
|
||||||
|
pub struct GUI {
|
||||||
|
display: *mut Display,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl GUI {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let display_str = CString::new(":0").unwrap();
|
||||||
|
let display = unsafe { xlib::XOpenDisplay(display_str.as_ptr()) };
|
||||||
|
unsafe { XGrabServer(display) };
|
||||||
|
GUI { display }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_window_attributes(&self, window: *mut Window) -> *mut XWindowAttributes {
|
||||||
|
let attr: *mut XWindowAttributes = unsafe { ::std::mem::uninitialized() };
|
||||||
|
unsafe { XGetWindowAttributes(self.display, *window, attr) };
|
||||||
|
attr
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Captures the window and produces a DynamicImage.
|
||||||
|
pub fn window_capture(&self, window: *mut Window) -> Result<Image, ScreenshotError> {
|
||||||
|
println!("Getting window attributes.");
|
||||||
|
let attr = unsafe { *self.get_window_attributes(window) };
|
||||||
|
println!("Got window attributes.");
|
||||||
|
let image = unsafe {
|
||||||
|
xlib::XGetImage(
|
||||||
|
self.display,
|
||||||
|
*window,
|
||||||
|
attr.x,
|
||||||
|
attr.y,
|
||||||
|
attr.width as u32,
|
||||||
|
attr.height as u32,
|
||||||
|
0xffffffff,
|
||||||
|
ZPixmap,
|
||||||
|
)
|
||||||
|
};
|
||||||
|
Ok(Image::from(image))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get the full screen.
|
||||||
|
pub fn get_root_window(&self) -> *mut Window {
|
||||||
|
println!("Getting root window...");
|
||||||
|
unsafe { xlib::XRootWindow(self.display, 0) as *mut Window }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get the active window.
|
||||||
|
pub fn get_active_window(&self) -> *mut Window {
|
||||||
|
let window: *mut Window = unsafe { ::std::mem::uninitialized() };
|
||||||
|
let mut revert_to_return: i32 = unsafe { ::std::mem::uninitialized() };
|
||||||
|
unsafe { xlib::XGetInputFocus(self.display, window, &mut revert_to_return) };
|
||||||
|
window
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Brings up an interactive selection GUI.
|
||||||
|
pub fn interactive_select(&self, _capture: &Image) -> Result<Rectangle, ScreenshotError> {
|
||||||
|
Err(ScreenshotError::Error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for GUI {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
unsafe { XUngrabServer(self.display) };
|
||||||
|
}
|
||||||
|
}
|
15
src/image.rs
Normal file
15
src/image.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
use x11::xlib::XImage;
|
||||||
|
|
||||||
|
use Rectangle;
|
||||||
|
|
||||||
|
pub struct Image {
|
||||||
|
_inner: *mut XImage,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Image {
|
||||||
|
pub fn from(inner: *mut XImage) -> Self {
|
||||||
|
Image { _inner: inner }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn apply_region(&mut self, _region: &Rectangle) {}
|
||||||
|
}
|
30
src/lib.rs
Normal file
30
src/lib.rs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#[macro_use]
|
||||||
|
extern crate failure;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate structopt;
|
||||||
|
extern crate time;
|
||||||
|
extern crate x11;
|
||||||
|
|
||||||
|
mod capture;
|
||||||
|
mod errors;
|
||||||
|
mod gui;
|
||||||
|
mod image;
|
||||||
|
mod options;
|
||||||
|
|
||||||
|
use failure::Error;
|
||||||
|
use structopt::StructOpt;
|
||||||
|
|
||||||
|
use options::Options;
|
||||||
|
|
||||||
|
pub struct Rectangle {
|
||||||
|
pub x: u32,
|
||||||
|
pub y: u32,
|
||||||
|
pub width: u32,
|
||||||
|
pub height: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn run() -> Result<(), Error> {
|
||||||
|
let opt = Options::from_args();
|
||||||
|
capture::capture(&opt)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
68
src/main.rs
68
src/main.rs
|
@ -1,31 +1,9 @@
|
||||||
#![crate_name = "screenshot"]
|
extern crate screenshot;
|
||||||
#![crate_type = "bin"]
|
|
||||||
|
|
||||||
extern crate cairo;
|
|
||||||
extern crate clap;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate failure;
|
|
||||||
extern crate gdk;
|
|
||||||
extern crate gdk_pixbuf;
|
|
||||||
extern crate gio;
|
|
||||||
extern crate gtk;
|
|
||||||
extern crate slop_sys;
|
|
||||||
extern crate time;
|
|
||||||
|
|
||||||
mod capture;
|
|
||||||
mod errors;
|
|
||||||
mod options;
|
|
||||||
mod selection;
|
|
||||||
|
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
|
||||||
use clap::{App, Arg};
|
|
||||||
use failure::Error;
|
|
||||||
|
|
||||||
use options::{Options, Region};
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match run() {
|
match screenshot::run() {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
eprintln!("Error: {}", error);
|
eprintln!("Error: {}", error);
|
||||||
|
@ -33,45 +11,3 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run() -> Result<(), Error> {
|
|
||||||
let app = App::new("screenshot")
|
|
||||||
.version("0.1")
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("region")
|
|
||||||
.help("The region to be captured.")
|
|
||||||
.takes_value(false)
|
|
||||||
.required(true),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("output")
|
|
||||||
.alias("o")
|
|
||||||
.long("output")
|
|
||||||
.help("Specify the output file.")
|
|
||||||
.takes_value(true)
|
|
||||||
.required(true),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("clip")
|
|
||||||
.alias("c")
|
|
||||||
.long("clip")
|
|
||||||
.help("Copies the image to the clipboard if set."),
|
|
||||||
).get_matches();
|
|
||||||
let region = match app.value_of("region").unwrap() {
|
|
||||||
"fullscreen" => Region::Fullscreen,
|
|
||||||
"active" | "window" => Region::ActiveWindow,
|
|
||||||
"select" | "selection" => Region::Selection,
|
|
||||||
_ => bail!("Please choose a valid region [fullscreen|active|select]"),
|
|
||||||
};
|
|
||||||
let path = String::from(app.value_of("output").unwrap());
|
|
||||||
let clip = app.is_present("clip");
|
|
||||||
let options = Options::new(region, path, clip)?;
|
|
||||||
|
|
||||||
gdk::init();
|
|
||||||
gtk::init()?;
|
|
||||||
capture::capture(options)?;
|
|
||||||
// unsafe {
|
|
||||||
// libscreenshot_main(region, outfile_c.as_ptr());
|
|
||||||
// }
|
|
||||||
// let image = capture(options)?.convert()?;
|
|
||||||
// image.save("target/shiet.png")?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,28 +1,25 @@
|
||||||
use std::fs::{canonicalize, OpenOptions};
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use failure::Error;
|
#[derive(StructOpt)]
|
||||||
|
|
||||||
pub enum Region {
|
pub enum Region {
|
||||||
|
#[structopt(name = "fullscreen")]
|
||||||
Fullscreen,
|
Fullscreen,
|
||||||
|
|
||||||
|
#[structopt(name = "window")]
|
||||||
ActiveWindow,
|
ActiveWindow,
|
||||||
|
|
||||||
|
#[structopt(name = "select")]
|
||||||
Selection,
|
Selection,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(StructOpt)]
|
||||||
pub struct Options {
|
pub struct Options {
|
||||||
|
#[structopt(subcommand)]
|
||||||
pub region: Region,
|
pub region: Region,
|
||||||
pub outfile: PathBuf,
|
|
||||||
pub clip: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Options {
|
#[structopt(short = "o", long = "out", parse(from_os_str))]
|
||||||
pub fn new(region: Region, outfile: String, clip: bool) -> Result<Options, Error> {
|
pub outfile: PathBuf,
|
||||||
OpenOptions::new().create(true).write(true).open(&outfile)?;
|
|
||||||
let outfile = canonicalize(&outfile)?;
|
#[structopt(short = "c")]
|
||||||
Ok(Options {
|
pub clipboard: bool,
|
||||||
region,
|
|
||||||
outfile,
|
|
||||||
clip,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
use std::ffi::CString;
|
|
||||||
|
|
||||||
use failure::Error;
|
|
||||||
use gdk_pixbuf::{Pixbuf, PixbufExt};
|
|
||||||
|
|
||||||
use errors::ScreenshotError;
|
|
||||||
use slop_sys::{slop_options, slop_select};
|
|
||||||
|
|
||||||
pub fn select_area(pixbuf: Pixbuf) -> Result<Pixbuf, Error> {
|
|
||||||
let xdisplay = CString::new(":0")?.as_ptr();
|
|
||||||
|
|
||||||
let mut options = slop_options {
|
|
||||||
quiet: 0,
|
|
||||||
border: 1.0,
|
|
||||||
padding: 1.0,
|
|
||||||
tolerance: 1.0,
|
|
||||||
highlight: 0,
|
|
||||||
nokeyboard: 0,
|
|
||||||
noopengl: 1,
|
|
||||||
nodecorations: 1,
|
|
||||||
shaders: &mut 0,
|
|
||||||
r: 0.7,
|
|
||||||
g: 0.7,
|
|
||||||
b: 0.7,
|
|
||||||
a: 1.0,
|
|
||||||
xdisplay,
|
|
||||||
};
|
|
||||||
let selection = unsafe { slop_select(&mut options) };
|
|
||||||
println!("{:?}", selection);
|
|
||||||
|
|
||||||
if selection.cancelled == 1 {
|
|
||||||
bail!(ScreenshotError);
|
|
||||||
}
|
|
||||||
match pixbuf.new_subpixbuf(
|
|
||||||
selection.x.round() as i32,
|
|
||||||
selection.y.round() as i32,
|
|
||||||
selection.w.round() as i32,
|
|
||||||
selection.h.round() as i32,
|
|
||||||
) {
|
|
||||||
Some(pixbuf) => Ok(pixbuf),
|
|
||||||
None => bail!(ScreenshotError),
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue