Support tinyfiledialogs on Windows

This commit is contained in:
UK992 2016-07-25 14:43:06 +02:00
parent 521f8c0135
commit 06142b37b8
9 changed files with 22 additions and 21 deletions

View file

@ -14,7 +14,7 @@ path = "lib.rs"
[features]
debugmozjs = ['js/debugmozjs']
[target.'cfg(any(target_os = "macos", target_os = "linux"))'.dependencies]
[target.'cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))'.dependencies]
tinyfiledialogs = {git = "https://github.com/jdm/tinyfiledialogs"}
[dependencies]

View file

@ -95,7 +95,7 @@ use task_source::networking::NetworkingTaskSource;
use task_source::user_interaction::UserInteractionTaskSource;
use time;
use timers::{IsInterval, OneshotTimerCallback, OneshotTimerHandle, OneshotTimers, TimerCallback};
#[cfg(any(target_os = "macos", target_os = "linux"))]
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
use tinyfiledialogs::{self, MessageBoxIcon};
use url::Url;
use util::geometry::{self, MAX_RECT};
@ -361,14 +361,14 @@ impl Window {
}
}
#[cfg(any(target_os = "macos", target_os = "linux"))]
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
fn display_alert_dialog(message: &str) {
tinyfiledialogs::message_box_ok("Alert!", message, MessageBoxIcon::Warning);
}
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
#[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))]
fn display_alert_dialog(_message: &str) {
// tinyfiledialogs not supported on Windows
// tinyfiledialogs not supported on Android
}
// https://html.spec.whatwg.org/multipage/#atob

View file

@ -82,7 +82,7 @@ extern crate smallvec;
#[macro_use]
extern crate style;
extern crate time;
#[cfg(any(target_os = "macos", target_os = "linux"))]
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
extern crate tinyfiledialogs;
extern crate url;
#[macro_use]
@ -186,4 +186,3 @@ pub fn init(sw_senders: SWManagerSenders) {
pub unsafe fn script_can_initiate_scroll(_: *mut JSContext, _: Handle<*mut JSObject>) -> bool {
!opts::get().use_webrender
}