Skip to content

Commit 2b6d27d

Browse files
authored
Merge pull request storytold#1658 from SSchott/copy-the-fix
Fix Copying Images, Ctrl-C/Ctrl-V and within Deckcraft
2 parents 9998ee5 + 9e8aa81 commit 2b6d27d

14 files changed

Lines changed: 731 additions & 37 deletions

File tree

‎Cargo.lock‎

Lines changed: 97 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎ROADMAP.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
88
> **Last reviewed:** 2026-11-02 · **Last updated:** 2026-11-03 · **Change:** trivial (community PR wave 10: PPTX and native saves keep table cell centred anchoring, text overflow, compatible line spacing, normalised character height, Thai distributed alignment, RTL table direction, alternate run language and reflection transforms; imported effects placed by parent time-node delays; Reuse Slides fits the destination size and brings custom table styles; deleted slides leave custom shows; merged shapes drop their animations; Compress Pictures measures grouped pictures at displayed size; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
99
> **Last reviewed:** 2026-11-02 · **Last updated:** 2026-11-02 · **Change:** trivial (File › About replaces Account; product links, credits and appearance retained; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
10+
> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-11-01 · **Change:** trivial (progress log: fix for a workflow-breaking regression: Ctrl+C/X/V use the system clipboard again, broken for all text and objects from 0.11.1 to 0.15.0; pasted and duplicated placeholders keep their look; stage and scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
1011
> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-11-01 · **Change:** trivial (locked No Fill and no-outline click-through regression coverage added; No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
1112
> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-30 · **Change:** trivial (progress log: read-only `slide.actions` lists shape and table text actions; parity scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
1213
> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-27 · **Change:** trivial (progress log: Set Up Slide Show ▸ Keep mouse cursor visible, #1445; stage and scores unchanged) · **Target:** Microsoft PowerPoint for Mac 16.113 (Microsoft 365)
@@ -164,6 +165,9 @@ app's JSON control channel (`deckcraft --control PORT`).
164165
| 2026-11-02 | PPTX reflection effects keep their authored start position, affine scale/skew, direction and fade, alignment, and rotation flag through native and PPTX saves |
165166
| 2026-11-03 | Reuse Slides brings along referenced custom table styles, including grouped tables, and remaps conflicting style ids without changing destination tables |
166167
| 2026-11-02 | Tiled picture fills in groups: a tile (`a:blipFill` with `a:tile`) keeps its size, offset and anchor in slide points whatever the group's child-coordinate scale, uniform or stretched unevenly, nested or flipped (also a group's own tile fill passed to its members, and a picture shape's own tile, with its shadow and reflection), and tiles with `rotWithShape="0"` keep their size in points at any zoom, as PowerPoint draws them (measured on its own PNG export of a synthetic probe deck: every grouped case within ~3/255 of the ungrouped control's own difference from PowerPoint, which is ~13/255 from resampling). Before, a group whose child space was ~1800 times smaller than its box showed one flat texel of the texture (a Venn diagram with paper-textured circles and a hatched intersection) |
168+
| 2026-11-01 | Ctrl+V of a picture copied in a browser (Copy Image) pastes the picture, not a text box with its link and alt text; the link still pastes as text when no picture came with it |
169+
| 2026-11-01 | Copy, Cut, Paste, Duplicate and Alt+drag of a title, body or other placeholder on a slide keep its look: the copy is a regular shape that takes the size, font, bullets, indents, autofit and box its layout and master gave it, instead of 18 pt unbulleted text |
170+
| 2026-11-01 | Clipboard: Ctrl+C, Ctrl+X and Ctrl+V use the system clipboard again, so text and pictures paste from other apps and in-app copies paste back. Since the egui 0.37 migration (#1350) the desktop build had a clipboard that only worked inside the app. On native Wayland, text goes through egui's Wayland clipboard; HTML stays on X11, macOS and Windows |
167171
| 2026-10-31 | No Fill shape interiors allow selection and editing of underlying objects, even when a quick style remains; hit-testing uses the renderer’s fill resolution. Outlines, rotation, text targets and actual fills keep their hit behaviour (#1621) |
168172
| 2026-10-30 | Print-preview tests use the URL emitted by egui and its exact file path; previews are explicitly removed before the macOS process exits |
169173
| 2026-10-30 | `slide.actions` lists shape click and hover actions and text-run hyperlinks (including table cells and grouped shapes) for audit; listing never runs an action. The UI pane is a follow-up |
@@ -341,6 +345,7 @@ app's JSON control channel (`deckcraft --control PORT`).
341345
| 2026-11-03 | trivial | Progress log: web `?host=parent` bridge to a framing page; scores unchanged |
342346
| 2026-11-02 | trivial | File › About replaces Account; product links, credits and appearance retained |
343347
| 2026-11-02 | trivial | Progress log: tiled picture fills keep their size in scaled groups. Scores and milestone names unchanged |
348+
| 2026-11-01 | trivial | Workflow-breaking regression fixed: the desktop build uses the system clipboard again (eframe `clipboard` feature) |
344349
| 2026-10-31 | trivial | No Fill hit-testing follows resolved fill instead of the presence of a style (#1621); scores unchanged |
345350
| 2026-10-30 | trivial | Progress log: read-only slide action inspection; parity scores unchanged |
346351
| 2026-10-29 | trivial | Progress log: going back in the slide show reverses the left slide's transition (#1531). Scores and milestone names unchanged |

‎apps/deckcraft/Cargo.toml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ workspace = true
1414
deckcraft-engine = { workspace = true }
1515
deckcraft-ui-egui = { workspace = true }
1616
deckcraft-media = { workspace = true }
17-
eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit", "links", "wayland", "x11"] }
17+
# `clipboard` is the OS clipboard (Ctrl+C/X/V with other apps). Without it egui simulates one inside
18+
# the app; the egui 0.37 migration (#1350) dropped it from this list.
19+
eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit", "clipboard", "links", "wayland", "x11"] }
1820
egui = { workspace = true }
1921
serde_json = { workspace = true }
2022
log = { workspace = true }

‎apps/deckcraft/src/main.rs‎

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,13 @@ fn save_prefs(app: &SlideApp) {
103103
}
104104
}
105105

106-
fn services() -> Services {
106+
/// The desktop services. `native_wayland`: the window is a Wayland client (not Xwayland).
107+
fn services(native_wayland: bool) -> Services {
108+
// On native Wayland, egui-winit owns the clipboard through winit's data device, which carries
109+
// text and PNG but no HTML. `pasteboard` (arboard, built for X11 only) would put a copy on the
110+
// Xwayland selection instead and skip egui's Wayland claim, so Ctrl+V would read something
111+
// else. There, text goes through egui and pictures arrive as `PasteImage` events.
112+
let pasteboard = !native_wayland;
107113
Services {
108114
pick_open: Some(Box::new(|purpose: &str| {
109115
let d = rfd::FileDialog::new();
@@ -126,9 +132,9 @@ fn services() -> Services {
126132
pick_save: Some(Box::new(|name: &str| rfd::FileDialog::new().set_file_name(name).save_file().map(|p| p.to_string_lossy().to_string()))),
127133
read: Some(Box::new(|p: &str| std::fs::read(p).map_err(|e| e.to_string()))),
128134
write: Some(Box::new(|p: &str, b: &[u8]| std::fs::write(p, b).map_err(|e| e.to_string()))),
129-
clipboard_image: Some(Box::new(pasteboard::image_png)),
130-
clipboard_html: Some(Box::new(pasteboard::html)),
131-
clipboard_set_html: Some(Box::new(pasteboard::set_html)),
135+
clipboard_image: pasteboard.then(|| Box::new(pasteboard::image_png) as Box<dyn FnMut() -> Option<Vec<u8>>>),
136+
clipboard_html: pasteboard.then(|| Box::new(pasteboard::html) as Box<dyn FnMut() -> Option<String>>),
137+
clipboard_set_html: pasteboard.then(|| Box::new(pasteboard::set_html) as Box<dyn FnMut(&str, &str) -> bool>),
132138
// Media is mixed and clocked by the output device; `DECKCRAFT_NO_AUDIO` plays silently.
133139
audio_out: std::env::var_os("DECKCRAFT_NO_AUDIO")
134140
.is_none()
@@ -247,6 +253,11 @@ fn main() -> eframe::Result {
247253
false
248254
}
249255
};
256+
// `Default` lets winit choose, and winit takes Wayland whenever `WAYLAND_DISPLAY` is set.
257+
#[cfg(all(unix, not(target_os = "macos")))]
258+
let native_wayland = !x11 && std::env::var_os("WAYLAND_DISPLAY").is_some_and(|w| !w.is_empty());
259+
#[cfg(not(all(unix, not(target_os = "macos"))))]
260+
let native_wayland = false;
250261
#[cfg(all(unix, not(target_os = "macos")))]
251262
if x11 {
252263
options.event_loop_builder = Some(Box::new(|b| {
@@ -268,7 +279,7 @@ fn main() -> eframe::Result {
268279
options,
269280
Box::new(move |cc| {
270281
deckcraft_ui_egui::install_ime_pass_hooks(&cc.egui_ctx);
271-
let mut app = SlideApp::new(Session::new(), services());
282+
let mut app = SlideApp::new(Session::new(), services(native_wayland));
272283
load_prefs(&mut app);
273284
app.enable_update_checks();
274285
// AutoRecover: reopen what a previous run left unsaved, then keep it current.
@@ -335,6 +346,26 @@ mod tests {
335346
assert_eq!(stdout.contains("on_exit returned"), !cfg!(target_os = "macos"), "{stdout}");
336347
}
337348

349+
/// The egui 0.37 migration (#1350) left `clipboard` out of eframe's features. egui then
350+
/// simulated a clipboard inside the app: nothing pasted from other apps, and Ctrl+C/Ctrl+V
351+
/// lost text that went out as HTML. Keep the OS clipboard on.
352+
#[test]
353+
fn eframe_uses_the_os_clipboard() {
354+
let manifest = include_str!("../Cargo.toml");
355+
let eframe = manifest.lines().find(|l| l.starts_with("eframe = ")).unwrap_or_default();
356+
assert!(eframe.contains("\"clipboard\""), "eframe must enable the OS clipboard: {eframe}");
357+
}
358+
359+
/// On native Wayland, the X11-only pasteboard would bypass egui's Wayland clipboard; elsewhere
360+
/// it carries HTML and pictures beside egui's text.
361+
#[test]
362+
fn the_pasteboard_stays_off_native_wayland() {
363+
let s = services(true);
364+
assert!(s.clipboard_html.is_none() && s.clipboard_set_html.is_none() && s.clipboard_image.is_none());
365+
let s = services(false);
366+
assert!(s.clipboard_html.is_some() && s.clipboard_set_html.is_some() && s.clipboard_image.is_some());
367+
}
368+
338369
#[test]
339370
fn help_exits_instead_of_opening_a_file() {
340371
assert!(matches!(startup(None, ["--help".to_string()]), Startup::Help));

0 commit comments

Comments
 (0)