mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 22:46:14 -05:00
fix: mark authentication windows as dialogs
This commit is contained in:
2 files changed
+25
No files matched your search
@@ -1,6 +1,8 @@
|
|||||||
use std::{sync::Arc, time::Duration};
|
use std::{sync::Arc, time::Duration};
|
||||||
|
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
|
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||||
|
use gpapi::utils::window::{WindowTypeHint, set_window_type_hint};
|
||||||
use gpapi::{
|
use gpapi::{
|
||||||
auth::{AuthWindowTheme, AuthenticationCancelled, SamlAuthData},
|
auth::{AuthWindowTheme, AuthenticationCancelled, SamlAuthData},
|
||||||
gp_params::GpParams,
|
gp_params::GpParams,
|
||||||
@@ -156,6 +158,9 @@ impl<'a> WebviewAuthenticator<'a> {
|
|||||||
.center()
|
.center()
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
|
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||||
|
set_window_type_hint(&auth_window, WindowTypeHint::Dialog)?;
|
||||||
|
|
||||||
self
|
self
|
||||||
.setup_auth_window(&auth_window, Arc::clone(&auth_messenger))
|
.setup_auth_window(&auth_window, Arc::clone(&auth_messenger))
|
||||||
.await?;
|
.await?;
|
||||||
|
|||||||
@@ -1,5 +1,25 @@
|
|||||||
use tauri::WebviewWindow;
|
use tauri::WebviewWindow;
|
||||||
|
|
||||||
|
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||||
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
|
pub enum WindowTypeHint {
|
||||||
|
Dialog,
|
||||||
|
Utility,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||||
|
pub fn set_window_type_hint(window: &WebviewWindow, hint: WindowTypeHint) -> anyhow::Result<()> {
|
||||||
|
use gtk::{gdk, traits::GtkWindowExt};
|
||||||
|
|
||||||
|
let hint = match hint {
|
||||||
|
WindowTypeHint::Dialog => gdk::WindowTypeHint::Dialog,
|
||||||
|
WindowTypeHint::Utility => gdk::WindowTypeHint::Utility,
|
||||||
|
};
|
||||||
|
|
||||||
|
window.gtk_window()?.set_type_hint(hint);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the frame-to-content height difference for a standard titled macOS window.
|
/// Returns the frame-to-content height difference for a standard titled macOS window.
|
||||||
/// This is nonzero only on macOS.
|
/// This is nonzero only on macOS.
|
||||||
pub fn get_title_bar_height() -> f64 {
|
pub fn get_title_bar_height() -> f64 {
|
||||||
|
|||||||
Reference in new issue
Block a user