From d1af22f8610af3743a195980a7afa2dd48673cd6 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 21 May 2023 18:13:20 +0800 Subject: [PATCH] fix trust level of framebuffer canvas this is some bit-rot that happened to the `ball` demo because it's currently the only application that uses the framebuffer canvas. the trust level of the framebuffer canvas has to be lower than that of the modals, otherwise a modals box is not allowed to draw on top of the framebuffer. in this case, a patch that was applied when trust levels were refactored was missed on the framebuffer canvas, which caused the trust level of the canvas to be higher than that of a modals. Thus, when a modal attempts to pop up over the ball demo, one just sees the defacement lines but no actal content. --- services/gam/src/layouts/chat.rs | 2 ++ services/gam/src/layouts/framebuffer.rs | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/services/gam/src/layouts/chat.rs b/services/gam/src/layouts/chat.rs index b3659dffa..b4a62a5d3 100644 --- a/services/gam/src/layouts/chat.rs +++ b/services/gam/src/layouts/chat.rs @@ -53,6 +53,8 @@ impl ChatLayout { let input_cr = input_canvas.clip_rect(); canvases.insert(input_canvas.gid(), input_canvas); + // trust level must be lower than "modals" otherwise a modal can't draw over the content + // dividing by 2 does the trick let content_canvas = Canvas::new( Rectangle::new_v_span(*status_cliprect, input_cr), (MISC_CONTEXT_DEFAULT_TRUST - TRUST_OFFSET) / 2, &trng, None, crate::api::CanvasType::ChatContent diff --git a/services/gam/src/layouts/framebuffer.rs b/services/gam/src/layouts/framebuffer.rs index cdc9c1366..71a6e26e2 100644 --- a/services/gam/src/layouts/framebuffer.rs +++ b/services/gam/src/layouts/framebuffer.rs @@ -20,9 +20,11 @@ impl Framebuffer { ) -> Result { let screensize = gfx.screen_size().expect("Couldn't get screen size"); + // trust level must be lower than "modals" otherwise a modal can't draw over the content + // dividing by 2 does the trick let fb_canvas = Canvas::new( Rectangle::new(Point::new(0, status_cliprect.br().y + 1), screensize), - MISC_CONTEXT_DEFAULT_TRUST - TRUST_OFFSET, &trng, None, crate::api::CanvasType::Framebuffer + (MISC_CONTEXT_DEFAULT_TRUST - TRUST_OFFSET) / 2, &trng, None, crate::api::CanvasType::Framebuffer ).expect("couldn't create modal canvas"); let fb_gid = fb_canvas.gid(); canvases.insert(fb_canvas.gid(), fb_canvas);