Skip to content
Merged
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
Binary file added desktop/assets/graphite-icon-color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions desktop/assets/graphite-icon-color.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions desktop/assets/rs.graphite.GraphiteEditor.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Name=Graphite
GenericName=Vector & Raster Graphics Editor
Comment=Open-source vector & raster graphics editor. Featuring node based procedural nondestructive editing workflow.
Exec=graphite-editor
Terminal=false
Type=Application
Icon=graphite-icon-color
Categories=Graphics;VectorGraphics;RasterGraphics;
Keywords=graphite;editor;vector;raster;procedural;design;
StartupWMClass=rs.graphite.GraphiteEditor
28 changes: 19 additions & 9 deletions desktop/src/app.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::CustomEvent;
use crate::WindowSize;
use crate::consts::APP_NAME;
use crate::dialogs::dialog_open_graphite_file;
use crate::dialogs::dialog_save_graphite_file;
use crate::render::GraphicsState;
Expand Down Expand Up @@ -142,15 +143,24 @@ impl ApplicationHandler<CustomEvent> for WinitApp {
}

fn resumed(&mut self, event_loop: &ActiveEventLoop) {
let window = Arc::new(
event_loop
.create_window(
Window::default_attributes()
.with_title("CEF Offscreen Rendering")
.with_inner_size(winit::dpi::LogicalSize::new(1200, 800)),
)
.unwrap(),
);
let mut window = Window::default_attributes()
.with_title(APP_NAME)
.with_min_inner_size(winit::dpi::LogicalSize::new(400, 300))
.with_inner_size(winit::dpi::LogicalSize::new(1200, 800));

#[cfg(target_family = "unix")]
{
use crate::consts::APP_ID;
use winit::platform::wayland::ActiveEventLoopExtWayland;

window = if event_loop.is_wayland() {
winit::platform::wayland::WindowAttributesExtWayland::with_name(window, APP_ID, "")
} else {
winit::platform::x11::WindowAttributesExtX11::with_name(window, APP_ID, APP_NAME)
}
}

let window = Arc::new(event_loop.create_window(window).unwrap());
let graphics_state = GraphicsState::new(window.clone(), self.wgpu_context.clone());

self.window = Some(window);
Expand Down
3 changes: 3 additions & 0 deletions desktop/src/consts.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub(crate) static APP_NAME: &str = "Graphite";
pub(crate) static APP_ID: &str = "rs.graphite.GraphiteEditor";
pub(crate) static APP_DIRECTORY_NAME: &str = "graphite-editor";
4 changes: 2 additions & 2 deletions desktop/src/dirs.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fs::create_dir_all;
use std::path::PathBuf;

static APP_NAME: &str = "graphite-desktop";
use crate::consts::APP_DIRECTORY_NAME;

pub(crate) fn ensure_dir_exists(path: &PathBuf) {
if !path.exists() {
Expand All @@ -10,7 +10,7 @@ pub(crate) fn ensure_dir_exists(path: &PathBuf) {
}

pub(crate) fn graphite_data_dir() -> PathBuf {
let path = dirs::data_dir().expect("Failed to get data directory").join(APP_NAME);
let path = dirs::data_dir().expect("Failed to get data directory").join(APP_DIRECTORY_NAME);
ensure_dir_exists(&path);
path
}
2 changes: 2 additions & 0 deletions desktop/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use graphite_editor::messages::prelude::Message;
use tracing_subscriber::EnvFilter;
use winit::event_loop::EventLoop;

pub(crate) mod consts;

mod cef;
use cef::{Setup, WindowSize};

Expand Down
Loading