forge
Explore
Log in

Don't you dare go Hollow

Assume square corners for windowed fullscreen windows

Browse files at this commit

a1b0bd6d1cbbc695188f53839e42def4c5d38f43Ivan MolodetskikhParent: 892470a
src/layout/mod.rsmodified+24 -6
@@ -290,6 +290,9 @@ pub trait LayoutElement {
290 Some(requested)290 Some(requested)
291 }291 }
292 292
293+ fn is_windowed_fullscreen(&self) -> bool {
294+ false
295+ }
293 fn is_pending_windowed_fullscreen(&self) -> bool {296 fn is_pending_windowed_fullscreen(&self) -> bool {
294 false297 false
295 }298 }
@@ -297,6 +300,22 @@ pub trait LayoutElement {
297 let _ = value;300 let _ = value;
298 }301 }
299 302
303+ /// The effective geometry corner radius for this element.
304+ ///
305+ /// Returns zero when the element is in windowed fullscreen, since fullscreen windows have
306+ /// square corners.
307+ ///
308+ /// This method only handles windowed fullscreen and not maximized/real fullscreen. This is
309+ /// because windowed fullscreen is handled by the element itself, whereas other sizing modes
310+ /// are handled externally by the Tile, so the corner radius changes for those modes is also
311+ /// handled externally.
312+ fn geometry_corner_radius(&self) -> CornerRadius {
313+ if self.is_windowed_fullscreen() {
314+ return CornerRadius::default();
315+ }
316+ self.rules().geometry_corner_radius.unwrap_or_default()
317+ }
318+
300 fn is_child_of(&self, parent: &Self) -> bool;319 fn is_child_of(&self, parent: &Self) -> bool;
301 320
302 fn rules(&self) -> &ResolvedWindowRules;321 fn rules(&self) -> &ResolvedWindowRules;
@@ -2854,13 +2873,12 @@ impl<W: LayoutElement> Layout<W> {
2854 ws.scrolling_insert_position(pos_within_workspace)2873 ws.scrolling_insert_position(pos_within_workspace)
2855 };2874 };
2856 2875
2857- let rules = move_.tile.window().rules();
2858 let border_width = move_.tile.effective_border_width().unwrap_or(0.);2876 let border_width = move_.tile.effective_border_width().unwrap_or(0.);
2859- let corner_radius = rules2877+ let corner_radius = move_
2860- .geometry_corner_radius2878+ .tile
2861- .map_or(CornerRadius::default(), |radius| {2879+ .window()
2862- radius.expanded_by(border_width as f32)2880+ .geometry_corner_radius()
2863- });2881+ .expanded_by(border_width as f32);
2864 mon.insert_hint = Some(InsertHint {2882 mon.insert_hint = Some(InsertHint {
2865 workspace: insert_ws,2883 workspace: insert_ws,
2866 position,2884 position,
src/layout/tests.rsmodified+4 -0
@@ -243,6 +243,10 @@ impl LayoutElement for TestWindow {
243 self.0.requested_size.get()243 self.0.requested_size.get()
244 }244 }
245 245
246+ fn is_windowed_fullscreen(&self) -> bool {
247+ self.0.is_windowed_fullscreen.get()
248+ }
249+
246 fn is_pending_windowed_fullscreen(&self) -> bool {250 fn is_pending_windowed_fullscreen(&self) -> bool {
247 self.0.is_pending_windowed_fullscreen.get()251 self.0.is_pending_windowed_fullscreen.get()
248 }252 }
src/layout/tile.rsmodified+28 -19
@@ -403,9 +403,9 @@ impl<W: LayoutElement> Tile<W> {
403 self.shadow.update_config(shadow_config);403 self.shadow.update_config(shadow_config);
404 404
405 let window_size = self.window_size();405 let window_size = self.window_size();
406- let radius = rules406+ let radius = self
407- .geometry_corner_radius407+ .window
408- .unwrap_or_default()408+ .geometry_corner_radius()
409 .fit_to(window_size.w as f32, window_size.h as f32);409 .fit_to(window_size.w as f32, window_size.h as f32);
410 self.rounded_corner_damage.set_corner_radius(radius);410 self.rounded_corner_damage.set_corner_radius(radius);
411 }411 }
@@ -473,11 +473,22 @@ impl<W: LayoutElement> Tile<W> {
473 border_window_size.w -= border_width * 2.;473 border_window_size.w -= border_width * 2.;
474 border_window_size.h -= border_width * 2.;474 border_window_size.h -= border_width * 2.;
475 475
476- let radius = rules476+ // FIXME: this takes into account the animation from normal sizing mode to
477- .geometry_corner_radius477+ // maximized/fullscreen, but it doesn't take into account the corner radius animation from
478- .map_or(CornerRadius::default(), |radius| {478+ // the window itself.
479- radius.expanded_by(border_width as f32)479+ //
480- })480+ // Currently, an easy way to see the problem is to start from a window with a nonzero
481+ // radius, then go from windowed fullscreen (that forces 0 radius) to regular fullscreen.
482+ // At the start of the animation, windowed fullscreen becomes false, but the window hasn't
483+ // animated to the normal fullscreen yet, so the radius here jumps to its nonzero value,
484+ // even though it should remain zero throughout.
485+ //
486+ // Later, when windows get the surface shape protocol with radii, this issue will happen
487+ // when that changes between animated commits.
488+ let radius = self
489+ .window
490+ .geometry_corner_radius()
491+ .expanded_by(border_width as f32)
481 .scaled_by(1. - expanded_progress as f32);492 .scaled_by(1. - expanded_progress as f32);
482 self.border.update_render_elements(493 self.border.update_render_elements(
483 border_window_size,494 border_window_size,
@@ -496,9 +507,8 @@ impl<W: LayoutElement> Tile<W> {
496 let radius = if self.visual_border_width().is_some() {507 let radius = if self.visual_border_width().is_some() {
497 radius508 radius
498 } else {509 } else {
499- rules510+ self.window
500- .geometry_corner_radius511+ .geometry_corner_radius()
501- .unwrap_or_default()
502 .scaled_by(1. - expanded_progress as f32)512 .scaled_by(1. - expanded_progress as f32)
503 };513 };
504 self.shadow.update_render_elements(514 self.shadow.update_render_elements(
@@ -1059,9 +1069,9 @@ impl<W: LayoutElement> Tile<W> {
1059 // Clip to geometry including during the fullscreen animation to help with buggy clients1069 // Clip to geometry including during the fullscreen animation to help with buggy clients
1060 // that submit a full-sized buffer before acking the fullscreen state (Firefox).1070 // that submit a full-sized buffer before acking the fullscreen state (Firefox).
1061 let clip_to_geometry = fullscreen_progress < 1. && rules.clip_to_geometry == Some(true);1071 let clip_to_geometry = fullscreen_progress < 1. && rules.clip_to_geometry == Some(true);
1062- let radius = rules1072+ let radius = self
1063- .geometry_corner_radius1073+ .window
1064- .unwrap_or_default()1074+ .geometry_corner_radius()
1065 .scaled_by(1. - expanded_progress as f32);1075 .scaled_by(1. - expanded_progress as f32);
1066 1076
1067 // Popups go on top, whether it's resize or not.1077 // Popups go on top, whether it's resize or not.
@@ -1235,11 +1245,10 @@ impl<W: LayoutElement> Tile<W> {
1235 // animated corner radius.1245 // animated corner radius.
1236 if fullscreen_progress < 1. && has_border_shader {1246 if fullscreen_progress < 1. && has_border_shader {
1237 let border_width = self.visual_border_width().unwrap_or(0.);1247 let border_width = self.visual_border_width().unwrap_or(0.);
1238- let radius = rules1248+ let radius = self
1239- .geometry_corner_radius1249+ .window
1240- .map_or(CornerRadius::default(), |radius| {1250+ .geometry_corner_radius()
1241- radius.expanded_by(border_width as f32)1251+ .expanded_by(border_width as f32)
1242- })
1243 .scaled_by(1. - expanded_progress as f32);1252 .scaled_by(1. - expanded_progress as f32);
1244 1253
1245 let size = self.fullscreen_backdrop.size();1254 let size = self.fullscreen_backdrop.size();
src/ui/mru.rsmodified+3 -4
@@ -370,11 +370,10 @@ impl Thumbnail {
370 370
371 // Clip thumbnails to their geometry.371 // Clip thumbnails to their geometry.
372 let radius = if mapped.sizing_mode().is_normal() {372 let radius = if mapped.sizing_mode().is_normal() {
373- mapped.rules().geometry_corner_radius373+ mapped.geometry_corner_radius()
374 } else {374 } else {
375- None375+ CornerRadius::default()
376- }376+ };
377- .unwrap_or_default();
378 377
379 let has_border_shader = BorderRenderElement::has_shader(ctx.renderer);378 let has_border_shader = BorderRenderElement::has_shader(ctx.renderer);
380 let clip_shader = ClippedSurfaceRenderElement::shader(ctx.renderer).cloned();379 let clip_shader = ClippedSurfaceRenderElement::shader(ctx.renderer).cloned();
src/window/mapped.rsmodified+5 -2
@@ -486,8 +486,7 @@ impl Mapped {
486 let bbox = self.window.bbox_with_popups().to_physical_precise_up(scale);486 let bbox = self.window.bbox_with_popups().to_physical_precise_up(scale);
487 487
488 let has_border_shader = BorderRenderElement::has_shader(renderer);488 let has_border_shader = BorderRenderElement::has_shader(renderer);
489- let rules = self.rules();489+ let radius = self.geometry_corner_radius();
490- let radius = rules.geometry_corner_radius.unwrap_or_default();
491 let window_size = self490 let window_size = self
492 .size()491 .size()
493 .to_f64()492 .to_f64()
@@ -1293,6 +1292,10 @@ impl LayoutElement for Mapped {
1293 }1292 }
1294 }1293 }
1295 1294
1295+ fn is_windowed_fullscreen(&self) -> bool {
1296+ self.is_windowed_fullscreen
1297+ }
1298+
1296 fn is_pending_windowed_fullscreen(&self) -> bool {1299 fn is_pending_windowed_fullscreen(&self) -> bool {
1297 self.is_pending_windowed_fullscreen1300 self.is_pending_windowed_fullscreen
1298 }1301 }