* widgets on non existing output do not spawn * fix no-x11-wayland build Co-authored-by: Bryan Ndjeutcha <ndjeutcha@gmail.com>
This commit is contained in:
parent
0180914015
commit
8800980011
2 changed files with 41 additions and 37 deletions
|
@ -308,8 +308,7 @@ fn initialize_window(
|
||||||
) -> Result<EwwWindow> {
|
) -> Result<EwwWindow> {
|
||||||
let actual_window_rect = window_def.geometry.get_window_rectangle(monitor_geometry);
|
let actual_window_rect = window_def.geometry.get_window_rectangle(monitor_geometry);
|
||||||
|
|
||||||
let window = display_backend::initialize_window(&window_def, monitor_geometry);
|
if let Some(window) = display_backend::initialize_window(&window_def, monitor_geometry) {
|
||||||
|
|
||||||
window.set_title(&format!("Eww - {}", window_def.name));
|
window.set_title(&format!("Eww - {}", window_def.name));
|
||||||
let wm_class_name = format!("eww-{}", window_def.name);
|
let wm_class_name = format!("eww-{}", window_def.name);
|
||||||
window.set_wmclass(&wm_class_name, &wm_class_name);
|
window.set_wmclass(&wm_class_name, &wm_class_name);
|
||||||
|
@ -341,8 +340,11 @@ fn initialize_window(
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(EwwWindow { name: window_def.name.clone(), definition: window_def, gtk_window: window })
|
Ok(EwwWindow { name: window_def.name.clone(), definition: window_def, gtk_window: window })
|
||||||
|
} else {
|
||||||
|
Err(anyhow!("monitor {} is unavailable", window_def.screen_number.unwrap()))
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Apply the provided window-positioning rules to the window.
|
/// Apply the provided window-positioning rules to the window.
|
||||||
|
|
|
@ -6,7 +6,7 @@ mod platform {
|
||||||
use anyhow::*;
|
use anyhow::*;
|
||||||
use gtk::{self, prelude::*};
|
use gtk::{self, prelude::*};
|
||||||
|
|
||||||
pub fn initialize_window(window_def: &EwwWindowDefinition, _monitor: gdk::Rectangle) -> gtk::Window {
|
pub fn initialize_window(window_def: &EwwWindowDefinition, _monitor: gdk::Rectangle) -> Option<gtk::Window> {
|
||||||
let window = if window_def.focusable {
|
let window = if window_def.focusable {
|
||||||
gtk::Window::new(gtk::WindowType::Toplevel)
|
gtk::Window::new(gtk::WindowType::Toplevel)
|
||||||
} else {
|
} else {
|
||||||
|
@ -21,7 +21,7 @@ mod platform {
|
||||||
} else {
|
} else {
|
||||||
window.set_keep_below(true);
|
window.set_keep_below(true);
|
||||||
}
|
}
|
||||||
window
|
Some(window)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reserve_space_for(_window: >k::Window, _monitor: gdk::Rectangle, _strut_def: StrutDefinition) -> Result<()> {
|
pub fn reserve_space_for(_window: >k::Window, _monitor: gdk::Rectangle, _strut_def: StrutDefinition) -> Result<()> {
|
||||||
|
@ -36,7 +36,7 @@ mod platform {
|
||||||
use gdk;
|
use gdk;
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
|
|
||||||
pub fn initialize_window(window_def: &EwwWindowDefinition, monitor: gdk::Rectangle) -> gtk::Window {
|
pub fn initialize_window(window_def: &EwwWindowDefinition, monitor: gdk::Rectangle) -> Option<gtk::Window> {
|
||||||
let window = gtk::Window::new(gtk::WindowType::Toplevel);
|
let window = gtk::Window::new(gtk::WindowType::Toplevel);
|
||||||
// Initialising a layer shell surface
|
// Initialising a layer shell surface
|
||||||
gtk_layer_shell::init_for_window(&window);
|
gtk_layer_shell::init_for_window(&window);
|
||||||
|
@ -45,9 +45,11 @@ mod platform {
|
||||||
Some(index) => {
|
Some(index) => {
|
||||||
if let Some(monitor) = gdk::Display::get_default().expect("could not get default display").get_monitor(index) {
|
if let Some(monitor) = gdk::Display::get_default().expect("could not get default display").get_monitor(index) {
|
||||||
gtk_layer_shell::set_monitor(&window, &monitor);
|
gtk_layer_shell::set_monitor(&window, &monitor);
|
||||||
};
|
} else {
|
||||||
|
return None
|
||||||
}
|
}
|
||||||
None => {}
|
}
|
||||||
|
None => {},
|
||||||
};
|
};
|
||||||
window.set_resizable(true);
|
window.set_resizable(true);
|
||||||
|
|
||||||
|
@ -100,7 +102,7 @@ mod platform {
|
||||||
if window_def.exclusive {
|
if window_def.exclusive {
|
||||||
gtk_layer_shell::auto_exclusive_zone_enable(&window);
|
gtk_layer_shell::auto_exclusive_zone_enable(&window);
|
||||||
}
|
}
|
||||||
window
|
Some(window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +121,7 @@ mod platform {
|
||||||
rust_connection::{DefaultStream, RustConnection},
|
rust_connection::{DefaultStream, RustConnection},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn initialize_window(window_def: &EwwWindowDefinition, _monitor: gdk::Rectangle) -> gtk::Window {
|
pub fn initialize_window(window_def: &EwwWindowDefinition, _monitor: gdk::Rectangle) -> Option<gtk::Window> {
|
||||||
let window = if window_def.focusable {
|
let window = if window_def.focusable {
|
||||||
gtk::Window::new(gtk::WindowType::Toplevel)
|
gtk::Window::new(gtk::WindowType::Toplevel)
|
||||||
} else {
|
} else {
|
||||||
|
@ -134,7 +136,7 @@ mod platform {
|
||||||
} else {
|
} else {
|
||||||
window.set_keep_below(true);
|
window.set_keep_below(true);
|
||||||
}
|
}
|
||||||
window
|
Some(window)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reserve_space_for(window: >k::Window, monitor: gdk::Rectangle, strut_def: StrutDefinition) -> Result<()> {
|
pub fn reserve_space_for(window: >k::Window, monitor: gdk::Rectangle, strut_def: StrutDefinition) -> Result<()> {
|
||||||
|
|
Loading…
Add table
Reference in a new issue