Fix fontmap resolution on sway

This commit is contained in:
Kenny Levinsen
2023-08-22 14:38:36 +02:00
parent 558d528f70
commit ebeb21f3c2
+15 -10
View File
@@ -199,7 +199,6 @@ impl Dispatch<wl_registry::WlRegistry, ()> for State {
if let OperationMode::XdgToplevel = state.mode { if let OperationMode::XdgToplevel = state.mode {
let wm_base = let wm_base =
registry.bind::<xdg_wm_base::XdgWmBase, _, _>(name, 2, qh, ()); registry.bind::<xdg_wm_base::XdgWmBase, _, _>(name, 2, qh, ());
match &state.main_surface.wl_surface { match &state.main_surface.wl_surface {
Some(surface) => { Some(surface) => {
let xdg_surface = wm_base.get_xdg_surface(surface, qh, ()); let xdg_surface = wm_base.get_xdg_surface(surface, qh, ());
@@ -395,12 +394,15 @@ impl Dispatch<zwlr_layer_surface_v1::ZwlrLayerSurfaceV1, ()> for State {
) { ) {
if let zwlr_layer_surface_v1::Event::Configure { if let zwlr_layer_surface_v1::Event::Configure {
serial, serial,
width, mut width,
height, mut height,
} = event } = event
{ {
if (width, height) == (0, 0) { if (width, height) == (0, 0) {
return; if state.configured {
return;
}
(width, height) = (640, 480);
} }
layer_surface.ack_configure(serial); layer_surface.ack_configure(serial);
state.configured = true; state.configured = true;
@@ -408,12 +410,11 @@ impl Dispatch<zwlr_layer_surface_v1::ZwlrLayerSurfaceV1, ()> for State {
let dim = (width as i32, height as i32); let dim = (width as i32, height as i32);
if state.dimensions == dim { if state.configured && state.dimensions == dim {
return; return;
} }
state.bufmgr.clear_buffers(); state.bufmgr.clear_buffers();
state.dimensions = dim; state.dimensions = dim;
state.fonts.resolve();
let fonts = state.fonts.unwrap(); let fonts = state.fonts.unwrap();
let layout = state.layout.clone(); let layout = state.layout.clone();
layout.geometry_update( layout.geometry_update(
@@ -481,13 +482,16 @@ impl Dispatch<xdg_toplevel::XdgToplevel, ()> for State {
) { ) {
match event { match event {
xdg_toplevel::Event::Configure { xdg_toplevel::Event::Configure {
width, mut width,
height, mut height,
states, states,
.. ..
} => { } => {
if (width, height) == (0, 0) { if (width, height) == (0, 0) {
return; if state.configured {
return;
}
(width, height) = (640, 480);
} }
let activated = states let activated = states
.iter() .iter()
@@ -503,7 +507,7 @@ impl Dispatch<xdg_toplevel::XdgToplevel, ()> for State {
} }
} }
if state.dimensions != (width, height) { if !state.configured || state.dimensions != (width, height) {
match (&state.bg_surface.wl_surface, &state.bg_surface.viewport) { match (&state.bg_surface.wl_surface, &state.bg_surface.viewport) {
(Some(surface), Some(viewport)) => { (Some(surface), Some(viewport)) => {
viewport.set_destination(width, height); viewport.set_destination(width, height);
@@ -585,6 +589,7 @@ impl Dispatch<wl_keyboard::WlKeyboard, ()> for State {
state.running = false; state.running = false;
return; return;
} }
state.keyboard.resolve();
let k = state.keyboard.key(key, kbstate); let k = state.keyboard.key(key, kbstate);
let repeats = k.repeats; let repeats = k.repeats;
let ev = Event::KeyEvent(k); let ev = Event::KeyEvent(k);