style: apply nightly rustfmt import grouping across the workspace
rustfmt.toml sets group_imports, imports_granularity and imports_layout, which are nightly-only; agents formatted with stable rustfmt, which ignored them. This is a formatting-only pass with `cargo +nightly fmt`. Test Plan: - cargo clippy --workspace --all-targets -- -D warnings - cargo test --workspace
This commit is contained in:
1 parent
3fd4ea6ae9
commit
126da77a37
259 files changed
+2495
-1547
No files matched your search
@@ -18,32 +18,41 @@
|
||||
clippy::should_implement_trait
|
||||
)]
|
||||
|
||||
use std::cell::{Cell, OnceCell, Ref, RefCell, RefMut};
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use std::{
|
||||
cell::{Cell, OnceCell, Ref, RefCell, RefMut},
|
||||
rc::Rc,
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use ghostty_apprt::action::{self, Action, Target};
|
||||
use ghostty_apprt::structs::ColorScheme;
|
||||
use ghostty_config::cli_args::ConfigField;
|
||||
use ghostty_config::command::Command;
|
||||
use ghostty_config::config::Config as CoreConfig;
|
||||
use ghostty_config::types_b::{GtkSingleInstance, WindowTheme};
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use ghostty_apprt::{
|
||||
action::{self, Action, Target},
|
||||
runtime_api::{AppMessage, CoreApp, RtApp, SurfaceId},
|
||||
structs::ColorScheme,
|
||||
};
|
||||
use ghostty_config::{
|
||||
cli_args::ConfigField,
|
||||
command::Command,
|
||||
config::Config as CoreConfig,
|
||||
types_b::{GtkSingleInstance, WindowTheme},
|
||||
};
|
||||
use ghostty_input::binding::Action as BindingAction;
|
||||
use gtk::{gdk, gio, glib};
|
||||
|
||||
use crate::class::close_confirmation_dialog::{self, CloseConfirmationDialog};
|
||||
use crate::class::config::Config;
|
||||
use crate::class::config_errors_dialog::ConfigErrorsDialog;
|
||||
use crate::class::global_shortcuts::GlobalShortcuts;
|
||||
use crate::class::split_tree::SplitTree;
|
||||
use crate::class::surface::{Size, Surface};
|
||||
use crate::class::tab::Tab;
|
||||
use crate::class::window::{SelectTab, TabOverrides, Window};
|
||||
use crate::css::CssProviders;
|
||||
use crate::winproto;
|
||||
use ghostty_apprt::runtime_api::{AppMessage, CoreApp, RtApp, SurfaceId};
|
||||
use crate::{
|
||||
class::{
|
||||
close_confirmation_dialog::{self, CloseConfirmationDialog},
|
||||
config::Config,
|
||||
config_errors_dialog::ConfigErrorsDialog,
|
||||
global_shortcuts::GlobalShortcuts,
|
||||
split_tree::SplitTree,
|
||||
surface::{Size, Surface},
|
||||
tab::Tab,
|
||||
window::{SelectTab, TabOverrides, Window},
|
||||
},
|
||||
css::CssProviders,
|
||||
winproto,
|
||||
};
|
||||
|
||||
/// Errors from [`Application::run_loop`].
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
@@ -268,14 +277,26 @@ impl RtApp for AppRt {
|
||||
}
|
||||
|
||||
mod imp {
|
||||
use super::{
|
||||
AppMessage, Cell, Config, ConfigErrorsDialog, CoreApp, CssProviders, GlobalShortcuts,
|
||||
OnceCell, QuitTimer, Rc, RefCell, RtApp, glib, winproto,
|
||||
};
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use gtk::gio;
|
||||
|
||||
use super::{
|
||||
AppMessage,
|
||||
Cell,
|
||||
Config,
|
||||
ConfigErrorsDialog,
|
||||
CoreApp,
|
||||
CssProviders,
|
||||
GlobalShortcuts,
|
||||
OnceCell,
|
||||
QuitTimer,
|
||||
Rc,
|
||||
RefCell,
|
||||
RtApp,
|
||||
glib,
|
||||
winproto,
|
||||
};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Application {
|
||||
/// The libghostty App instance.
|
||||
@@ -826,7 +847,10 @@ impl Application {
|
||||
|
||||
fn sync_action_accelerators(&self) {
|
||||
use ghostty_input::binding::action::{
|
||||
CloseTabMode, CopyToClipboard, InspectorMode, SplitDirection,
|
||||
CloseTabMode,
|
||||
CopyToClipboard,
|
||||
InspectorMode,
|
||||
SplitDirection,
|
||||
};
|
||||
let a = |name: &str, action: BindingAction| self.sync_action_accelerator(name, &action);
|
||||
a("app.quit", BindingAction::Quit);
|
||||
|
||||
@@ -5,14 +5,15 @@
|
||||
//! `clipboard-contents` (GtkTextBuffer), `blur`. Signals `confirm(bool)` and
|
||||
//! `deny(bool)` (bool = "remember choice").
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use std::{
|
||||
cell::{Cell, RefCell},
|
||||
sync::OnceLock,
|
||||
};
|
||||
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use ghostty_apprt::structs::ClipboardRequest;
|
||||
use ghostty_os::i18n::tr;
|
||||
use gtk::glib;
|
||||
use gtk::glib::subclass::Signal;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::sync::OnceLock;
|
||||
use gtk::{glib, glib::subclass::Signal};
|
||||
|
||||
use super::dialog::{Dialog, DialogImpl};
|
||||
|
||||
@@ -22,13 +23,25 @@ use super::dialog::{Dialog, DialogImpl};
|
||||
pub struct ClipboardRequestBoxed(pub ClipboardRequest);
|
||||
|
||||
mod imp {
|
||||
use super::{
|
||||
AdwAlertDialogImpl, AdwDialogImpl, Cell, ClipboardRequest, ClipboardRequestBoxed, Dialog,
|
||||
DialogImpl, ObjectImpl, ObjectSubclass, OnceLock, RefCell, Signal, WidgetImpl, tr,
|
||||
};
|
||||
use adw::prelude::*;
|
||||
use gtk::glib;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{glib, subclass::prelude::*};
|
||||
|
||||
use super::{
|
||||
AdwAlertDialogImpl,
|
||||
AdwDialogImpl,
|
||||
Cell,
|
||||
ClipboardRequest,
|
||||
ClipboardRequestBoxed,
|
||||
Dialog,
|
||||
DialogImpl,
|
||||
ObjectImpl,
|
||||
ObjectSubclass,
|
||||
OnceLock,
|
||||
RefCell,
|
||||
Signal,
|
||||
WidgetImpl,
|
||||
tr,
|
||||
};
|
||||
|
||||
#[derive(Default, glib::Properties, gtk::CompositeTemplate)]
|
||||
#[properties(wrapper_type = super::ClipboardConfirmationDialog)]
|
||||
|
||||
@@ -2,13 +2,11 @@
|
||||
//! (`GhosttyCloseConfirmationDialog`). Property `target`; signals
|
||||
//! `close-request` and `cancel`.
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use std::{cell::Cell, sync::OnceLock};
|
||||
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use ghostty_os::i18n::tr;
|
||||
use gtk::glib;
|
||||
use gtk::glib::subclass::Signal;
|
||||
use std::cell::Cell;
|
||||
use std::sync::OnceLock;
|
||||
use gtk::{glib, glib::subclass::Signal};
|
||||
|
||||
use super::dialog::{Dialog, DialogImpl};
|
||||
|
||||
@@ -47,13 +45,21 @@ impl Target {
|
||||
}
|
||||
|
||||
mod imp {
|
||||
use gtk::{glib, glib::prelude::*, subclass::prelude::*};
|
||||
|
||||
use super::{
|
||||
AdwAlertDialogImpl, AdwDialogImpl, Cell, Dialog, DialogImpl, ObjectImpl, ObjectSubclass,
|
||||
OnceLock, Signal, Target, WidgetImpl,
|
||||
AdwAlertDialogImpl,
|
||||
AdwDialogImpl,
|
||||
Cell,
|
||||
Dialog,
|
||||
DialogImpl,
|
||||
ObjectImpl,
|
||||
ObjectSubclass,
|
||||
OnceLock,
|
||||
Signal,
|
||||
Target,
|
||||
WidgetImpl,
|
||||
};
|
||||
use gtk::glib;
|
||||
use gtk::glib::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
|
||||
#[derive(Default, glib::Properties, gtk::CompositeTemplate)]
|
||||
#[properties(wrapper_type = super::CloseConfirmationDialog)]
|
||||
|
||||
@@ -5,22 +5,13 @@
|
||||
//! keeps itself alive (a self-reference) from `new()` until its dialog is
|
||||
//! closed, like the Zig `refSink`/`unref` dance.
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::cmp::Ordering;
|
||||
use std::sync::OnceLock;
|
||||
use std::{cell::RefCell, cmp::Ordering, sync::OnceLock};
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use ghostty_input::binding::Action as BindingAction;
|
||||
use ghostty_input::command::Command as InputCommand;
|
||||
use gtk::glib;
|
||||
use gtk::glib::subclass::Signal;
|
||||
use gtk::{CompositeTemplate, TemplateChild, gio};
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use ghostty_input::{binding::Action as BindingAction, command::Command as InputCommand};
|
||||
use gtk::{CompositeTemplate, TemplateChild, gio, glib, glib::subclass::Signal};
|
||||
|
||||
use super::application::Application;
|
||||
use super::config::Config;
|
||||
use super::surface::Surface;
|
||||
use super::window::Window;
|
||||
use super::{application::Application, config::Config, surface::Surface, window::Window};
|
||||
|
||||
/// Boxed wrapper so a binding action can travel through the `trigger`
|
||||
/// signal (Zig passes `*const input.Binding.Action`).
|
||||
@@ -32,12 +23,19 @@ pub struct BoxedAction(pub BindingAction);
|
||||
// Command (list item)
|
||||
|
||||
mod command_imp {
|
||||
use super::{
|
||||
BindingAction, Config, InputCommand, RefCell, Surface, ghostty_command_title_for_jump, glib,
|
||||
};
|
||||
use adw::prelude::*;
|
||||
use gtk::glib::subclass::prelude::*;
|
||||
|
||||
use super::{
|
||||
BindingAction,
|
||||
Config,
|
||||
InputCommand,
|
||||
RefCell,
|
||||
Surface,
|
||||
ghostty_command_title_for_jump,
|
||||
glib,
|
||||
};
|
||||
|
||||
pub enum CommandData {
|
||||
Regular {
|
||||
command: InputCommand,
|
||||
@@ -276,14 +274,23 @@ fn is_action_supported_on_gtk(action: &BindingAction) -> bool {
|
||||
// CommandPalette
|
||||
|
||||
mod imp {
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use gtk::{gio, glib};
|
||||
|
||||
use super::{
|
||||
Application, BoxedAction, Command, CompositeTemplate, Config, OnceLock, Ordering, RefCell,
|
||||
Signal, TemplateChild, compare_commands, is_action_supported_on_gtk,
|
||||
Application,
|
||||
BoxedAction,
|
||||
Command,
|
||||
CompositeTemplate,
|
||||
Config,
|
||||
OnceLock,
|
||||
Ordering,
|
||||
RefCell,
|
||||
Signal,
|
||||
TemplateChild,
|
||||
compare_commands,
|
||||
is_action_supported_on_gtk,
|
||||
};
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use gtk::gio;
|
||||
use gtk::glib;
|
||||
|
||||
#[derive(Default, glib::Properties, CompositeTemplate)]
|
||||
#[properties(wrapper_type = super::CommandPalette)]
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
//! Wraps a core config in a GObject so it can be reference counted and bound
|
||||
//! from blueprints (`diagnostics-buffer`, `has-diagnostics`).
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::sync::Arc;
|
||||
use std::{cell::RefCell, sync::Arc};
|
||||
|
||||
use ghostty_config::config::Config as CoreConfig;
|
||||
use gtk::glib;
|
||||
use gtk::glib::subclass::prelude::*;
|
||||
use gtk::{glib, glib::subclass::prelude::*};
|
||||
|
||||
mod imp {
|
||||
use gtk::{
|
||||
glib,
|
||||
glib::{prelude::*, subclass::prelude::*},
|
||||
prelude::TextBufferExt,
|
||||
};
|
||||
|
||||
use super::{Arc, CoreConfig, RefCell};
|
||||
use gtk::glib;
|
||||
use gtk::glib::prelude::*;
|
||||
use gtk::glib::subclass::prelude::*;
|
||||
use gtk::prelude::TextBufferExt;
|
||||
|
||||
#[derive(glib::Properties)]
|
||||
#[properties(wrapper_type = super::Config)]
|
||||
|
||||
@@ -2,25 +2,33 @@
|
||||
//!
|
||||
//! Property `config` (GhosttyConfig); signal `reload-config`.
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::{cell::RefCell, sync::OnceLock};
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use gtk::glib;
|
||||
use gtk::glib::subclass::Signal;
|
||||
use std::sync::OnceLock;
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use gtk::{glib, glib::subclass::Signal};
|
||||
|
||||
use super::config::Config;
|
||||
use super::dialog::{Dialog, DialogImpl};
|
||||
use super::{
|
||||
config::Config,
|
||||
dialog::{Dialog, DialogImpl},
|
||||
};
|
||||
|
||||
mod imp {
|
||||
use gtk::{glib, glib::prelude::*, subclass::prelude::*};
|
||||
|
||||
use super::{
|
||||
AdwAlertDialogImpl, AdwDialogImpl, Config, Dialog, DialogImpl, ObjectImpl, ObjectSubclass,
|
||||
ObjectSubclassExt, OnceLock, RefCell, Signal, WidgetImpl,
|
||||
AdwAlertDialogImpl,
|
||||
AdwDialogImpl,
|
||||
Config,
|
||||
Dialog,
|
||||
DialogImpl,
|
||||
ObjectImpl,
|
||||
ObjectSubclass,
|
||||
ObjectSubclassExt,
|
||||
OnceLock,
|
||||
RefCell,
|
||||
Signal,
|
||||
WidgetImpl,
|
||||
};
|
||||
use gtk::glib;
|
||||
use gtk::glib::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
|
||||
#[derive(Default, glib::Properties, gtk::CompositeTemplate)]
|
||||
#[properties(wrapper_type = super::ConfigErrorsDialog)]
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
use gtk::glib;
|
||||
|
||||
mod imp {
|
||||
use gtk::glib;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{glib, subclass::prelude::*};
|
||||
|
||||
#[derive(Default, gtk::CompositeTemplate)]
|
||||
#[template(resource = "/com/mitchellh/ghostty/ui/1.3/debug-warning.ui")]
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
//! `adw::MessageDialog` fallback is not needed). Subclasses implement
|
||||
//! [`DialogImpl`] and may override `response` via `AlertDialogImpl`.
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use gtk::glib;
|
||||
|
||||
mod imp {
|
||||
|
||||
@@ -8,21 +8,28 @@
|
||||
|
||||
#![allow(deprecated)] // gio D-Bus signal_subscribe: replacement API is awkward for portal use
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::OnceLock;
|
||||
use std::{
|
||||
cell::{Cell, RefCell},
|
||||
collections::HashMap,
|
||||
sync::OnceLock,
|
||||
};
|
||||
|
||||
use ghostty_input::binding::Action as BindingAction;
|
||||
use ghostty_input::binding::set::Value as BindingValue;
|
||||
use gtk::gio::{self, prelude::*};
|
||||
use gtk::glib::{self, subclass::Signal, subclass::prelude::*, variant::ObjectPath};
|
||||
use ghostty_input::binding::{Action as BindingAction, set::Value as BindingValue};
|
||||
use gtk::{
|
||||
gio::{self, prelude::*},
|
||||
glib::{
|
||||
self,
|
||||
subclass::{Signal, prelude::*},
|
||||
variant::ObjectPath,
|
||||
},
|
||||
};
|
||||
|
||||
use crate::class::config::Config;
|
||||
|
||||
mod imp {
|
||||
use glib::{prelude::*, subclass::prelude::*};
|
||||
|
||||
use super::{BindingAction, Cell, Config, OnceLock, RefCell, Signal, gio, glib};
|
||||
use glib::prelude::*;
|
||||
use glib::subclass::prelude::*;
|
||||
|
||||
#[derive(glib::Properties, Default)]
|
||||
#[properties(wrapper_type = super::GlobalShortcuts)]
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
//! cheaply in gtk-rs without a lot of class struct boilerplate, so subclasses
|
||||
//! install the two hooks with [`ImguiWidget::set_hooks`] instead.
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::time::{Duration, Instant};
|
||||
use std::{
|
||||
cell::{Cell, RefCell},
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use dear_imgui_glow::GlowRenderer;
|
||||
use ghostty_inspector::imgui::{Context, MouseButton, Ui};
|
||||
use gtk::glib::translate::IntoGlib;
|
||||
use gtk::{gdk, glib};
|
||||
use gtk::{gdk, glib, glib::translate::IntoGlib};
|
||||
|
||||
use crate::key;
|
||||
|
||||
|
||||
@@ -4,16 +4,16 @@
|
||||
//! property activates the inspector on that surface's core surface and
|
||||
//! clearing it deactivates it again.
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use ghostty_apprt::runtime_api::CoreSurface;
|
||||
use gtk::glib;
|
||||
|
||||
use super::imgui_widget::{ImguiWidget, ImguiWidgetImpl};
|
||||
use super::surface::Surface;
|
||||
use super::{
|
||||
imgui_widget::{ImguiWidget, ImguiWidgetImpl},
|
||||
surface::Surface,
|
||||
};
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct InspectorWidget(ObjectSubclass<imp::InspectorWidget>)
|
||||
|
||||
@@ -2,13 +2,10 @@
|
||||
//!
|
||||
//! Window for displaying the Ghostty inspector.
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use gtk::glib;
|
||||
|
||||
use super::debug_warning::DebugWarning;
|
||||
use super::inspector_widget::InspectorWidget;
|
||||
use super::surface::Surface;
|
||||
use super::{debug_warning::DebugWarning, inspector_widget::InspectorWidget, surface::Surface};
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct InspectorWindow(ObjectSubclass<imp::InspectorWindow>)
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
//! Deviation: Zig's `ext.StringList` boxed type is replaced by `GStrv`
|
||||
//! (`Vec<String>`) for the `tables` and `sequence` properties.
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use gtk::glib;
|
||||
|
||||
glib::wrapper! {
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
//! 2. Set the label with `set_label`
|
||||
//! 3. Schedule to show it with `schedule`
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use gtk::glib;
|
||||
|
||||
glib::wrapper! {
|
||||
|
||||
@@ -5,10 +5,8 @@
|
||||
|
||||
use std::sync::OnceLock;
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use gtk::glib::subclass::Signal;
|
||||
use gtk::{gdk, glib};
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use gtk::{gdk, glib, glib::subclass::Signal};
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct SearchOverlay(ObjectSubclass<imp::SearchOverlay>)
|
||||
|
||||
@@ -10,19 +10,29 @@
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use ghostty_datastruct::split_tree::{
|
||||
Direction, Goto, Handle, Layout, Node, SplitError, SplitTree as DsSplitTree, SplitTreeView,
|
||||
Direction,
|
||||
Goto,
|
||||
Handle,
|
||||
Layout,
|
||||
Node,
|
||||
SplitError,
|
||||
SplitTree as DsSplitTree,
|
||||
SplitTreeView,
|
||||
};
|
||||
use gtk::{
|
||||
gio,
|
||||
glib::{self, clone, subclass::Signal},
|
||||
};
|
||||
use gtk::gio;
|
||||
use gtk::glib::{self, clone, subclass::Signal};
|
||||
use half::f16;
|
||||
|
||||
use super::application::Application;
|
||||
use super::close_confirmation_dialog::{CloseConfirmationDialog, Target as CloseTarget};
|
||||
use super::surface::{Surface, SurfaceOverrides};
|
||||
use super::surface_scrolled_window::SurfaceScrolledWindow;
|
||||
use super::{
|
||||
application::Application,
|
||||
close_confirmation_dialog::{CloseConfirmationDialog, Target as CloseTarget},
|
||||
surface::{Surface, SurfaceOverrides},
|
||||
surface_scrolled_window::SurfaceScrolledWindow,
|
||||
};
|
||||
|
||||
/// The split tree of surfaces (Zig: `Surface.Tree`).
|
||||
pub type Tree = DsSplitTree<Surface>;
|
||||
|
||||
@@ -8,47 +8,71 @@
|
||||
//! into) is [`RtSurfaceHandle`], which implements [`ghostty_apprt::runtime_api::RtSurface`]
|
||||
//! and holds only a weak reference to the widget.
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::HashMap;
|
||||
use std::io::Write as _;
|
||||
use std::rc::Rc;
|
||||
use std::sync::OnceLock;
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use ghostty_apprt::action::{CommandFinished, Inspector, KeySequence, KeyTable, Readonly};
|
||||
use ghostty_apprt::structs::{
|
||||
Clipboard, ClipboardRequest, ContentScale, CursorPos, ImePos, SurfaceSize,
|
||||
use std::{
|
||||
cell::{Cell, RefCell},
|
||||
collections::HashMap,
|
||||
io::Write as _,
|
||||
rc::Rc,
|
||||
sync::OnceLock,
|
||||
};
|
||||
use ghostty_apprt::surface::{ChildExited, NewSurfaceContext, Scrollbar};
|
||||
use ghostty_config::command::Command;
|
||||
use ghostty_config::config::Config as CoreConfig;
|
||||
use ghostty_config::path::Path as ConfigPath;
|
||||
use ghostty_config::types_a::WorkingDirectory;
|
||||
use ghostty_config::types_b::{
|
||||
BellFeatures, NotifyOnCommandFinish, ResizeOverlay as ResizeOverlayMode, ResizeOverlayPosition,
|
||||
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use ghostty_apprt::{
|
||||
action::{CommandFinished, Inspector, KeySequence, KeyTable, Readonly},
|
||||
runtime_api::{
|
||||
ClipboardError,
|
||||
CoreSurface,
|
||||
DesiredFontSize,
|
||||
InputEffect,
|
||||
MIN_WINDOW_HEIGHT_CELLS,
|
||||
MIN_WINDOW_WIDTH_CELLS,
|
||||
RtSurface,
|
||||
SurfaceId,
|
||||
},
|
||||
structs::{Clipboard, ClipboardRequest, ContentScale, CursorPos, ImePos, SurfaceSize},
|
||||
surface::{ChildExited, NewSurfaceContext, Scrollbar},
|
||||
};
|
||||
use ghostty_config::{
|
||||
command::Command,
|
||||
config::Config as CoreConfig,
|
||||
path::Path as ConfigPath,
|
||||
types_a::WorkingDirectory,
|
||||
types_b::{
|
||||
BellFeatures,
|
||||
NotifyOnCommandFinish,
|
||||
ResizeOverlay as ResizeOverlayMode,
|
||||
ResizeOverlayPosition,
|
||||
},
|
||||
};
|
||||
use ghostty_input::{Action as KeyAction, Key, KeyEvent, Mods, MouseButton, MouseButtonState};
|
||||
use ghostty_vt::mouse_shape::MouseShape;
|
||||
use ghostty_vt::osc::{ProgressReport, ProgressState};
|
||||
use gtk::glib::subclass::Signal;
|
||||
use gtk::glib::translate::{FromGlib, IntoGlib};
|
||||
use gtk::{gdk, gio, glib};
|
||||
use ghostty_vt::{
|
||||
mouse_shape::MouseShape,
|
||||
osc::{ProgressReport, ProgressState},
|
||||
};
|
||||
use gtk::{
|
||||
gdk,
|
||||
gio,
|
||||
glib,
|
||||
glib::{
|
||||
subclass::Signal,
|
||||
translate::{FromGlib, IntoGlib},
|
||||
},
|
||||
};
|
||||
|
||||
use crate::class::application::Application;
|
||||
use crate::class::clipboard_confirmation_dialog::ClipboardConfirmationDialog;
|
||||
use crate::class::config::Config;
|
||||
use crate::class::inspector_window::InspectorWindow;
|
||||
use crate::class::key_state_overlay::KeyStateOverlay;
|
||||
use crate::class::resize_overlay::ResizeOverlay;
|
||||
use crate::class::search_overlay::SearchOverlay;
|
||||
use crate::class::surface_child_exited::SurfaceChildExited;
|
||||
use crate::class::title_dialog::{self, TitleDialog};
|
||||
use crate::class::window::Window;
|
||||
use crate::key as gtk_key;
|
||||
use ghostty_apprt::runtime_api::{
|
||||
ClipboardError, CoreSurface, DesiredFontSize, InputEffect, MIN_WINDOW_HEIGHT_CELLS,
|
||||
MIN_WINDOW_WIDTH_CELLS, RtSurface, SurfaceId,
|
||||
use crate::{
|
||||
class::{
|
||||
application::Application,
|
||||
clipboard_confirmation_dialog::ClipboardConfirmationDialog,
|
||||
config::Config,
|
||||
inspector_window::InspectorWindow,
|
||||
key_state_overlay::KeyStateOverlay,
|
||||
resize_overlay::ResizeOverlay,
|
||||
search_overlay::SearchOverlay,
|
||||
surface_child_exited::SurfaceChildExited,
|
||||
title_dialog::{self, TitleDialog},
|
||||
window::Window,
|
||||
},
|
||||
key as gtk_key,
|
||||
};
|
||||
|
||||
/// Simple dimensions struct for the surface used by various properties
|
||||
@@ -2268,12 +2292,18 @@ impl RtSurface for RtSurfaceHandle {
|
||||
|
||||
/// A namespace for our clipboard-related functions so Surface isn't SO large.
|
||||
mod clipboard {
|
||||
use adw::{prelude::*, subclass::prelude::ObjectSubclassIsExt};
|
||||
|
||||
use super::{
|
||||
Clipboard, ClipboardConfirmationDialog, ClipboardError, ClipboardRequest, Surface, gdk,
|
||||
gio, glib,
|
||||
Clipboard,
|
||||
ClipboardConfirmationDialog,
|
||||
ClipboardError,
|
||||
ClipboardRequest,
|
||||
Surface,
|
||||
gdk,
|
||||
gio,
|
||||
glib,
|
||||
};
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::ObjectSubclassIsExt;
|
||||
|
||||
/// Set the clipboard contents.
|
||||
pub(super) fn set(
|
||||
|
||||
@@ -6,11 +6,9 @@
|
||||
|
||||
use std::sync::OnceLock;
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use ghostty_apprt::surface::ChildExited;
|
||||
use gtk::glib;
|
||||
use gtk::glib::subclass::Signal;
|
||||
use gtk::{glib, glib::subclass::Signal};
|
||||
|
||||
/// Boxed wrapper so `ChildExited` can be a GObject property.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, glib::Boxed)]
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
//! `GtkWidget` (any `crate::class::surface::Surface` is accepted) and the
|
||||
//! `config` property as `GObject` (a `crate::class::config::Config`).
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use gtk::glib;
|
||||
|
||||
glib::wrapper! {
|
||||
@@ -75,9 +74,10 @@ mod imp {
|
||||
impl SurfaceScrolledWindow {
|
||||
#[template_callback(function)]
|
||||
fn scrollbar_policy(config: Option<glib::Object>) -> gtk::PolicyType {
|
||||
use crate::class::config::Config;
|
||||
use ghostty_config::types_b::Scrollbar;
|
||||
|
||||
use crate::class::config::Config;
|
||||
|
||||
let Some(config) = config.and_then(|c| c.downcast::<Config>().ok()) else {
|
||||
return gtk::PolicyType::Automatic;
|
||||
};
|
||||
|
||||
@@ -5,17 +5,20 @@
|
||||
|
||||
use std::cell::RefCell;
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use ghostty_apprt::surface::NewSurfaceContext;
|
||||
use gtk::gio;
|
||||
use gtk::glib::{self, clone, subclass::Signal};
|
||||
use gtk::{
|
||||
gio,
|
||||
glib::{self, clone, subclass::Signal},
|
||||
};
|
||||
|
||||
use super::application::Application;
|
||||
use super::config::Config;
|
||||
use super::split_tree::{SplitTree, SurfaceTree};
|
||||
use super::surface::{Surface, SurfaceOverrides};
|
||||
use super::title_dialog::{Target as TitleTarget, TitleDialog};
|
||||
use super::{
|
||||
application::Application,
|
||||
config::Config,
|
||||
split_tree::{SplitTree, SurfaceTree},
|
||||
surface::{Surface, SurfaceOverrides},
|
||||
title_dialog::{Target as TitleTarget, TitleDialog},
|
||||
};
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct Tab(ObjectSubclass<imp::Tab>)
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
//! Port of apprt/gtk/class/title_dialog.zig (`GhosttyTitleDialog`).
|
||||
//! Properties `target`, `initial-value`; signal `set(title: string)`.
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use std::{
|
||||
cell::{Cell, RefCell},
|
||||
sync::OnceLock,
|
||||
};
|
||||
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use ghostty_os::i18n::tr;
|
||||
use gtk::glib;
|
||||
use gtk::glib::subclass::Signal;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::sync::OnceLock;
|
||||
use gtk::{glib, glib::subclass::Signal};
|
||||
|
||||
/// `GhosttyTitleDialogTarget`.
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, glib::Enum)]
|
||||
@@ -29,13 +30,20 @@ impl Target {
|
||||
}
|
||||
|
||||
mod imp {
|
||||
use gtk::{glib, glib::prelude::*, subclass::prelude::*};
|
||||
|
||||
use super::{
|
||||
AdwAlertDialogImpl, AdwDialogImpl, Cell, ObjectImpl, ObjectSubclass, OnceLock, RefCell,
|
||||
Signal, Target, WidgetImpl,
|
||||
AdwAlertDialogImpl,
|
||||
AdwDialogImpl,
|
||||
Cell,
|
||||
ObjectImpl,
|
||||
ObjectSubclass,
|
||||
OnceLock,
|
||||
RefCell,
|
||||
Signal,
|
||||
Target,
|
||||
WidgetImpl,
|
||||
};
|
||||
use gtk::glib;
|
||||
use gtk::glib::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
|
||||
#[derive(Default, glib::Properties, gtk::CompositeTemplate)]
|
||||
#[properties(wrapper_type = super::TitleDialog)]
|
||||
|
||||
@@ -13,34 +13,51 @@
|
||||
//! [`Surface`] object (Zig took the `*CoreSurface` and used
|
||||
//! `rt_surface.gobj()`); the core surface is looked up via `Surface::core()`.
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::rc::Rc;
|
||||
use std::time::Duration;
|
||||
use std::{
|
||||
cell::{Cell, RefCell},
|
||||
rc::Rc,
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
use ghostty_apprt::surface::NewSurfaceContext;
|
||||
use ghostty_config::command::Command as ConfigCommand;
|
||||
use ghostty_config::types_a::WindowSubtitle;
|
||||
use ghostty_config::types_b::{
|
||||
GtkTabsLocation, GtkTitlebarStyle, GtkToolbarStyle, WindowDecoration, WindowNewTabPosition,
|
||||
WindowShowTabBar, WindowTheme,
|
||||
use ghostty_config::{
|
||||
command::Command as ConfigCommand,
|
||||
types_a::WindowSubtitle,
|
||||
types_b::{
|
||||
GtkTabsLocation,
|
||||
GtkTitlebarStyle,
|
||||
GtkToolbarStyle,
|
||||
WindowDecoration,
|
||||
WindowNewTabPosition,
|
||||
WindowShowTabBar,
|
||||
WindowTheme,
|
||||
},
|
||||
};
|
||||
use ghostty_input::binding::{Action as BindingAction, CloseTabMode};
|
||||
use ghostty_os::i18n::tr;
|
||||
use gtk::glib::{self, clone};
|
||||
use gtk::{CompositeTemplate, TemplateChild, gio};
|
||||
use gtk::{
|
||||
CompositeTemplate,
|
||||
TemplateChild,
|
||||
gio,
|
||||
glib::{self, clone},
|
||||
};
|
||||
|
||||
use super::application::Application;
|
||||
use super::close_confirmation_dialog::{CloseConfirmationDialog, Target as CloseTarget};
|
||||
use super::command_palette::CommandPalette;
|
||||
use super::config::Config;
|
||||
use super::debug_warning::DebugWarning;
|
||||
use super::split_tree::{SplitTree, SurfaceTree, Tree};
|
||||
use super::surface::{Surface, SurfaceOverrides};
|
||||
use super::tab::Tab;
|
||||
use crate::winproto::{self, WindowHost};
|
||||
use crate::{adw_version, gtk_version};
|
||||
use super::{
|
||||
application::Application,
|
||||
close_confirmation_dialog::{CloseConfirmationDialog, Target as CloseTarget},
|
||||
command_palette::CommandPalette,
|
||||
config::Config,
|
||||
debug_warning::DebugWarning,
|
||||
split_tree::{SplitTree, SurfaceTree, Tree},
|
||||
surface::{Surface, SurfaceOverrides},
|
||||
tab::Tab,
|
||||
};
|
||||
use crate::{
|
||||
adw_version,
|
||||
gtk_version,
|
||||
winproto::{self, WindowHost},
|
||||
};
|
||||
|
||||
/// Which tab to select (Zig: `Window.SelectTab`).
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
@@ -108,15 +125,30 @@ impl WindowHost for Host {
|
||||
}
|
||||
|
||||
mod imp {
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use adw::{prelude::*, subclass::prelude::*};
|
||||
|
||||
use super::{
|
||||
Cell, CommandPalette, CompositeTemplate, Config, DebugWarning, NewSurfaceContext, RefCell,
|
||||
SplitTree, Surface, Tab, TabOverrides, TemplateChild, TitlebarStyle, Window as WindowObj,
|
||||
WindowDecoration, glib, gtk_version,
|
||||
Cell,
|
||||
CommandPalette,
|
||||
CompositeTemplate,
|
||||
Config,
|
||||
DebugWarning,
|
||||
NewSurfaceContext,
|
||||
RefCell,
|
||||
SplitTree,
|
||||
Surface,
|
||||
Tab,
|
||||
TabOverrides,
|
||||
TemplateChild,
|
||||
TitlebarStyle,
|
||||
Window as WindowObj,
|
||||
WindowDecoration,
|
||||
glib,
|
||||
gtk_version,
|
||||
};
|
||||
use crate::winproto;
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
#[derive(glib::Properties, CompositeTemplate)]
|
||||
#[properties(wrapper_type = WindowObj)]
|
||||
|
||||
Reference in new issue
Block a user