Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions crates/ark/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,16 @@ impl RMain {
startup::source_user_r_profile();
}

// Initialise graphics device so `grDevices::dev.interactive()` returns `TRUE`.
// See https://github.com/posit-dev/positron/issues/7681.
// Needs to happen _after_ sourcing R profiles so users can override the
// graphics device in Rprofile.
unsafe {
if let Err(err) = graphics_device::ps_graphics_device_impl() {
log::warn!("Can't initialize graphics device: {err:?}");
}
}

// Start the REPL. Does not return!
crate::sys::interface::run_r();
}
Expand Down
2 changes: 1 addition & 1 deletion crates/ark/src/plots/graphics_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ unsafe extern "C-unwind" fn callback_new_page(dd: pGEcontext, dev: pDevDesc) {
});
}

unsafe fn ps_graphics_device_impl() -> anyhow::Result<SEXP> {
pub(crate) unsafe fn ps_graphics_device_impl() -> anyhow::Result<SEXP> {
// TODO: Don't allow creation of more than one graphics device.

// Create the graphics device.
Expand Down
Loading