- Add chandra-camera-isp.c (C/OpenMP) for Quad-Bayer unpack, CCM, and tone mapping, with a NumPy fallback when it is not built - Add non-blocking contrast-detection VCM autofocus, with lens subdev discovery on the sensor's I2C bus - Tune Quad-Bayer AE: a video-mode vblank cap, damped steps, and full analog gain before extending blanking - Record variable-frame-rate video through a streaming Matroska muxer, and count dropped frames - Ship libcamera IPA tuning files for imx376, imx519, and uncalibrated sensors - Map camera buffers by fd and sync them with dma-buf ioctls
This commit is contained in:
1 parent
851c39d827
commit
52b42890d6
34 files changed
+2851
-364
No files matched your search
+74
-17
@@ -42,9 +42,6 @@ fn nat(s : String, dflt : Int) -> Int {
|
||||
///| Space kept free around the grid, in pixels.
|
||||
let margin : Int = 20
|
||||
|
||||
///| A drag starts once the pointer has moved this far from the press.
|
||||
let drag_threshold : Int = 5
|
||||
|
||||
///| What the module asks of the host after an event.
|
||||
#derive(Eq, Debug)
|
||||
pub(all) enum Action {
|
||||
@@ -58,6 +55,9 @@ pub(all) struct Desk {
|
||||
mut size : String
|
||||
/// Where icons were put: app id -> (column, row).
|
||||
places : Map[String, (Int, Int)]
|
||||
/// First-seen order of shown app ids, so recents reordering never shuffles unplaced icons.
|
||||
seen : Map[String, Int]
|
||||
mut next_seen : Int
|
||||
mut w : Int
|
||||
mut h : Int
|
||||
/// Kept free at the bottom (the panel).
|
||||
@@ -82,6 +82,8 @@ pub fn Desk::new() -> Desk {
|
||||
count: "12",
|
||||
size: "Medium",
|
||||
places: {},
|
||||
seen: {},
|
||||
next_seen: 0,
|
||||
w: 0,
|
||||
h: 0,
|
||||
bottom: 40,
|
||||
@@ -106,6 +108,13 @@ pub fn Desk::cell(self : Desk) -> (Int, Int, Int) {
|
||||
}
|
||||
}
|
||||
|
||||
///| A drag starts once the pointer has moved this far from the press.
|
||||
fn Desk::drag_threshold(self : Desk) -> Int {
|
||||
let (cw, _, _) = self.cell()
|
||||
let t = cw / 3
|
||||
if t < 24 { 24 } else { t }
|
||||
}
|
||||
|
||||
///| Columns and rows that fit on the desktop (at least one of each).
|
||||
pub fn Desk::grid(self : Desk) -> (Int, Int) {
|
||||
let (cw, ch, _) = self.cell()
|
||||
@@ -129,9 +138,15 @@ pub fn Desk::shown(self : Desk, apps : Array[@types.AppEntry]) -> Array[@types.A
|
||||
}
|
||||
|
||||
///| Each shown app's cell, in `shown` order: its saved place when that is on the grid and free,
|
||||
/// else the first free cell, a column at a time. (-1, -1) when the grid is full.
|
||||
/// else the first free cell, a column at a time, in first-seen order. (-1, -1) when full.
|
||||
pub fn Desk::layout(self : Desk, apps : Array[@types.AppEntry]) -> Array[(Int, Int)] {
|
||||
let shown = self.shown(apps)
|
||||
for a in shown {
|
||||
if !self.seen.contains(a.id) {
|
||||
self.seen.set(a.id, self.next_seen)
|
||||
self.next_seen = self.next_seen + 1
|
||||
}
|
||||
}
|
||||
let (cols, rows) = self.grid()
|
||||
let taken : Map[(Int, Int), Bool] = {}
|
||||
let out : Array[(Int, Int)] = Array::make(shown.length(), (-1, -1))
|
||||
@@ -144,11 +159,19 @@ pub fn Desk::layout(self : Desk, apps : Array[@types.AppEntry]) -> Array[(Int, I
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
let mut next = 0
|
||||
let unplaced : Array[Int] = []
|
||||
for i = 0; i < shown.length(); i = i + 1 {
|
||||
if out[i] != (-1, -1) {
|
||||
continue
|
||||
if out[i] == (-1, -1) {
|
||||
unplaced.push(i)
|
||||
}
|
||||
}
|
||||
unplaced.sort_by(fn(a, b) {
|
||||
let sa = self.seen.get(shown[a].id).unwrap_or(a)
|
||||
let sb = self.seen.get(shown[b].id).unwrap_or(b)
|
||||
if sa != sb { sa - sb } else { a - b }
|
||||
})
|
||||
let mut next = 0
|
||||
for i in unplaced {
|
||||
while next < cols * rows && taken.contains((next / rows, next % rows)) {
|
||||
next = next + 1
|
||||
}
|
||||
@@ -192,6 +215,20 @@ pub fn Desk::app_at(self : Desk, apps : Array[@types.AppEntry], x : Int, y : Int
|
||||
""
|
||||
}
|
||||
|
||||
///| Pin every unplaced shown icon at its current grid cell without overwriting existing places.
|
||||
fn Desk::pin_unplaced(self : Desk, apps : Array[@types.AppEntry]) -> Unit {
|
||||
if self.w <= 0 || self.h <= 0 {
|
||||
return
|
||||
}
|
||||
let shown = self.shown(apps)
|
||||
let cells = self.layout(apps)
|
||||
for i, a in shown {
|
||||
if cells[i] != (-1, -1) && !self.places.contains(a.id) {
|
||||
self.places.set(a.id, cells[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///| Remember every shown icon where it is now, then put `id` at `to`, swapping with the icon
|
||||
/// there (which takes `id`'s old cell).
|
||||
fn Desk::move_to(self : Desk, apps : Array[@types.AppEntry], id : String, to : (Int, Int)) -> Unit {
|
||||
@@ -199,13 +236,18 @@ fn Desk::move_to(self : Desk, apps : Array[@types.AppEntry], id : String, to : (
|
||||
let cells = self.layout(apps)
|
||||
let mut from = (-1, -1)
|
||||
for i, a in shown {
|
||||
if cells[i] != (-1, -1) {
|
||||
self.places.set(a.id, cells[i])
|
||||
}
|
||||
if a.id == id {
|
||||
from = cells[i]
|
||||
}
|
||||
}
|
||||
if from == (-1, -1) || from == to {
|
||||
return
|
||||
}
|
||||
for i, a in shown {
|
||||
if cells[i] != (-1, -1) {
|
||||
self.places.set(a.id, cells[i])
|
||||
}
|
||||
}
|
||||
for i, a in shown {
|
||||
if a.id != id && cells[i] == to {
|
||||
self.places.set(a.id, from)
|
||||
@@ -315,9 +357,13 @@ pub fn Desk::handle(self : Desk, apps : Array[@types.AppEntry], ev : @types.Inpu
|
||||
PointerMove(p) => {
|
||||
self.ptr_x = p.x
|
||||
self.ptr_y = p.y
|
||||
if self.press_id != "" && !self.dragging &&
|
||||
((p.x - self.press_x).abs() > drag_threshold || (p.y - self.press_y).abs() > drag_threshold) {
|
||||
self.dragging = true
|
||||
if self.press_id != "" && !self.dragging {
|
||||
let dx = p.x - self.press_x
|
||||
let dy = p.y - self.press_y
|
||||
let t = self.drag_threshold()
|
||||
if dx * dx + dy * dy > t * t {
|
||||
self.dragging = true
|
||||
}
|
||||
}
|
||||
if self.dragging {
|
||||
return (true, NoAction)
|
||||
@@ -355,10 +401,16 @@ pub fn Desk::handle(self : Desk, apps : Array[@types.AppEntry], ev : @types.Inpu
|
||||
self.move_to(apps, id, self.cell_at(p.x, p.y))
|
||||
self.hover = self.app_at(apps, p.x, p.y)
|
||||
(true, NoAction)
|
||||
} else if self.app_at(apps, p.x, p.y) == id {
|
||||
(true, Launch(id))
|
||||
} else {
|
||||
(true, NoAction)
|
||||
let dx = p.x - self.press_x
|
||||
let dy = p.y - self.press_y
|
||||
let t = self.drag_threshold()
|
||||
if self.app_at(apps, p.x, p.y) == id || dx * dx + dy * dy <= t * t {
|
||||
self.pin_unplaced(apps)
|
||||
(true, Launch(id))
|
||||
} else {
|
||||
(true, NoAction)
|
||||
}
|
||||
}
|
||||
}
|
||||
FocusLost => {
|
||||
@@ -375,7 +427,12 @@ pub fn Desk::handle(self : Desk, apps : Array[@types.AppEntry], ev : @types.Inpu
|
||||
"ArrowUp" | "Up" => self.step_selection(apps, 0, -1)
|
||||
"ArrowDown" | "Down" => self.step_selection(apps, 0, 1)
|
||||
"Enter" | " " =>
|
||||
return (false, if self.selected != "" { Launch(self.selected) } else { NoAction })
|
||||
if self.selected != "" {
|
||||
self.pin_unplaced(apps)
|
||||
return (false, Launch(self.selected))
|
||||
} else {
|
||||
return (false, NoAction)
|
||||
}
|
||||
"Escape" => self.selected = ""
|
||||
_ => if k.length() == 1 { ignore(self.jump_to(apps, k)) } else { return (false, NoAction) }
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user