aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2020-11-14 21:10:26 +0300
committerGitHub <noreply@github.com>2020-11-14 21:10:26 +0300
commit9531e661b1cf777fc24d011e6116a501bd1b75e5 (patch)
tree5eb7f289690f5cc0ae572a985aeaf1f8206c7f60 /alacritty/src
parentc63bdf5cb966a5dd0afa3ed0327efca691abf504 (diff)
downloadr-alacritty-9531e661b1cf777fc24d011e6116a501bd1b75e5.tar.gz
r-alacritty-9531e661b1cf777fc24d011e6116a501bd1b75e5.tar.bz2
r-alacritty-9531e661b1cf777fc24d011e6116a501bd1b75e5.zip
Feature gate 'image' when building without x11 feature
On Wayland there's no way to embed icon into the window, thus there's no point in loading it when x11 feature is disabled.
Diffstat (limited to 'alacritty/src')
-rw-r--r--alacritty/src/window.rs26
1 files changed, 14 insertions, 12 deletions
diff --git a/alacritty/src/window.rs b/alacritty/src/window.rs
index 38e29328..953fffd9 100644
--- a/alacritty/src/window.rs
+++ b/alacritty/src/window.rs
@@ -5,7 +5,6 @@ use {
std::sync::Arc,
glutin::platform::unix::{WindowBuilderExtUnix, WindowExtUnix},
- image::ImageFormat,
};
#[rustfmt::skip]
@@ -31,8 +30,6 @@ use glutin::event_loop::EventLoop;
use glutin::platform::macos::{RequestUserAttentionType, WindowBuilderExtMacOS, WindowExtMacOS};
#[cfg(windows)]
use glutin::platform::windows::IconExtWindows;
-#[cfg(not(target_os = "macos"))]
-use glutin::window::Icon;
use glutin::window::{CursorIcon, Fullscreen, Window as GlutinWindow, WindowBuilder, WindowId};
use glutin::{self, ContextBuilder, PossiblyCurrent, WindowedContext};
#[cfg(windows)]
@@ -46,7 +43,7 @@ use crate::config::Config;
use crate::gl;
// It's required to be in this directory due to the `windows.rc` file.
-#[cfg(not(any(target_os = "macos", windows)))]
+#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
static WINDOW_ICON: &[u8] = include_bytes!("../alacritty.ico");
// This should match the definition of IDI_ICON from `windows.rc`.
@@ -256,11 +253,14 @@ impl Window {
#[cfg(not(any(target_os = "macos", windows)))]
pub fn get_platform_window(title: &str, window_config: &WindowConfig) -> WindowBuilder {
- let image = image::load_from_memory_with_format(WINDOW_ICON, ImageFormat::Ico)
- .expect("loading icon")
- .to_rgba();
- let (width, height) = image.dimensions();
- let icon = Icon::from_rgba(image.into_raw(), width, height);
+ #[cfg(feature = "x11")]
+ let icon = {
+ let image = image::load_from_memory_with_format(WINDOW_ICON, image::ImageFormat::Ico)
+ .expect("loading icon")
+ .to_rgba();
+ let (width, height) = image.dimensions();
+ glutin::window::Icon::from_rgba(image.into_raw(), width, height)
+ };
let class = &window_config.class;
@@ -270,8 +270,10 @@ impl Window {
.with_transparent(true)
.with_decorations(window_config.decorations != Decorations::None)
.with_maximized(window_config.maximized())
- .with_fullscreen(window_config.fullscreen())
- .with_window_icon(icon.ok());
+ .with_fullscreen(window_config.fullscreen());
+
+ #[cfg(feature = "x11")]
+ let builder = builder.with_window_icon(icon.ok());
#[cfg(feature = "wayland")]
let builder = builder.with_app_id(class.instance.clone());
@@ -290,7 +292,7 @@ impl Window {
#[cfg(windows)]
pub fn get_platform_window(title: &str, window_config: &WindowConfig) -> WindowBuilder {
- let icon = Icon::from_resource(IDI_ICON, None);
+ let icon = glutin::window::Icon::from_resource(IDI_ICON, None);
WindowBuilder::new()
.with_title(title)