Skip to content

Commit

Permalink
use Window instead of WebviewWindow for consistency and POLP
Browse files Browse the repository at this point in the history
  • Loading branch information
gulbanana committed Mar 18, 2024
1 parent 903d699 commit 1662f37
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src-tauri/src/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use std::{

use anyhow::Result;
use jj_lib::{git::RemoteCallbacks, repo::MutableRepo};
use tauri::{Manager, WebviewWindow};
use tauri::{Manager, Window};

use crate::{messages::InputRequest, worker::WorkerCallbacks, AppState};

pub struct FrontendCallbacks(pub WebviewWindow);
pub struct FrontendCallbacks(pub Window);

impl WorkerCallbacks for FrontendCallbacks {
fn with_git(
Expand Down
10 changes: 5 additions & 5 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use anyhow::{anyhow, Context, Result};
use log::LevelFilter;
use tauri::menu::Menu;
use tauri::{ipc::InvokeError, Manager};
use tauri::{State, WebviewWindow, Window, WindowEvent, Wry};
use tauri::{State, Window, WindowEvent, Wry};
use tauri_plugin_window_state::StateFlags;

use messages::{
Expand Down Expand Up @@ -138,7 +138,7 @@ fn main() -> Result<()> {
.ok_or(anyhow!("preconfigured window not found"))?;
let (sender, receiver) = channel();

let handle = window.clone();
let mut handle = window.as_ref().window();
let window_worker = thread::spawn(move || {
log::info!("start worker");

Expand All @@ -160,10 +160,10 @@ fn main() -> Result<()> {

window.on_menu_event(|w, e| handler::fatal!(menu::handle_event(w, e)));

let handle = window.clone();
handle = window.as_ref().window();
window.on_window_event(move |event| handle_window_event(&handle, event));

let handle = window.clone();
handle = window.as_ref().window();
window.listen("gg://revision/select", move |event| {
let payload: Result<Option<messages::RevHeader>, serde_json::Error> =
serde_json::from_str(event.payload());
Expand Down Expand Up @@ -497,7 +497,7 @@ fn try_mutate<T: Mutation + Send + Sync + 'static>(
call_rx.recv().map_err(InvokeError::from_error)
}

fn handle_window_event(window: &WebviewWindow, event: &WindowEvent) {
fn handle_window_event(window: &Window, event: &WindowEvent) {
match *event {
WindowEvent::Focused(true) => {
log::debug!("window focused; requesting snapshot");
Expand Down

0 comments on commit 1662f37

Please sign in to comment.