Skip to content

Commit

Permalink
chore(windows): remove winrt support (#356)
Browse files Browse the repository at this point in the history
* Remove winrt support

* Add change file
  • Loading branch information
Ngo Iok Ui (Wu Yu Wei) committed Jul 24, 2021
1 parent 847cffe commit c37973e
Show file tree
Hide file tree
Showing 9 changed files with 353 additions and 1,058 deletions.
5 changes: 5 additions & 0 deletions .changes/windows-remove-winrt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Remove winrt support since it's outdated for a long time. We will reimplement it again once `windws-rs` is stable!
11 changes: 4 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ targets = [
]

[features]
default = [ "file-drop", "protocol", "win32", "tray" ]
default = [ "file-drop", "protocol", "tray" ]
file-drop = [ ]
protocol = [ ]
dox = [ "tao/dox" ]
tray = [ "tao/tray" ]
win32 = [ "webview2", "winapi", "webview2-sys" ]

[dependencies]
libc = "0.2"
Expand All @@ -54,11 +53,9 @@ gtk = "0.9"
gdk = "0.13"

[target."cfg(target_os = \"windows\")".dependencies]
webview2 = { version = "0.1.1", optional = true }
webview2-sys = { version = "0.1.0", optional = true }
winapi = { version = "0.3", features = [ "libloaderapi", "oleidl" ], optional = true }
windows-webview2 = { version = "0.1", optional = true }
windows = { version = "0.7", optional = true }
webview2 = "0.1"
webview2-sys = "0.1"
winapi = { version = "0.3", features = [ "libloaderapi", "oleidl" ] }

[target."cfg(any(target_os = \"ios\", target_os = \"macos\"))".dependencies]
cocoa = "0.24"
Expand Down
9 changes: 1 addition & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
//! ## Feature flags
//!
//! Wry uses a set of feature flags to toggle several advanced features. `file-drop`, `protocol`,
//! `tray`, and `win32` are enabled by default.
//! and `tray` are enabled by default.
//!
//! - `file-drop`: Enables [`with_file_drop_handler`] to control the behaviour when there are files
//! interacting with the window.
Expand All @@ -56,8 +56,6 @@
//! those types if you disable it. They just don't create the actual objects. We set this flag
//! because some implementations require more installed packages. Disable this if you don't want
//! to install `libappindicator` and `clang` package.
//! - `win32`: Enables purely Win32 APIs to build the WebView on **Windows**. This makes backward
//! compatibility down to Windows 7 possible.
//! - `dox`: Enables this in `package.metadata.docs.rs` section to skip linking some **Linux**
//! libraries and prevent from building documentation on doc.rs fails.
//!
Expand Down Expand Up @@ -153,11 +151,6 @@ pub enum Error {
#[error("Icon error: {0}")]
Icon(#[from] BadIcon),
#[cfg(target_os = "windows")]
#[cfg(feature = "winrt")]
#[error(transparent)]
WindowsError(#[from] windows::Error),
#[cfg(target_os = "windows")]
#[cfg(feature = "win32")]
#[error(transparent)]
WebView2Error(#[from] webview2::Error),
}
9 changes: 1 addition & 8 deletions src/webview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ use url::Url;
#[cfg(target_os = "windows")]
use crate::application::platform::windows::WindowExtWindows;
use crate::application::window::Window;
#[cfg(target_os = "windows")]
#[cfg(feature = "winrt")]
use windows_webview2::Windows::Win32::WindowsAndMessaging::HWND;

pub struct WebViewAttributes {
/// Whether the WebView window should be visible.
Expand Down Expand Up @@ -351,14 +348,10 @@ impl WebView {
Ok(())
}

/// Resize the WebView manually. This is required on Windows because its WebView API doesn't
/// Resize the WebView manually. This is only required on Windows because its WebView API doesn't
/// provide a way to resize automatically.
pub fn resize(&self) -> Result<()> {
#[cfg(target_os = "windows")]
#[cfg(feature = "winrt")]
self.webview.resize(HWND(self.window.hwnd() as _))?;
#[cfg(target_os = "windows")]
#[cfg(feature = "win32")]
self.webview.resize(self.window.hwnd())?;
Ok(())
}
Expand Down
File renamed without changes.
Loading

0 comments on commit c37973e

Please sign in to comment.