This commit is contained in:
1 parent
ccb809bdc3
commit
7caadb3f7f
59 files changed
+7495
-16
No files matched your search
@@ -274,3 +274,50 @@ pub fn MoonPlasmaCompositor::compose_frame(
|
||||
ignore(self.damage.take_damage(self.output_w, self.output_h))
|
||||
@renderer.render_scene(scene)
|
||||
}
|
||||
|
||||
///|
|
||||
/// Compose the current desktop GUI frame and present it onto a wasi-gfx
|
||||
/// `SurfaceFrameBufferContext`.
|
||||
pub fn MoonPlasmaCompositor::present_to_gfx(
|
||||
self : MoonPlasmaCompositor,
|
||||
ctx : @gfx.SurfaceFrameBufferContext,
|
||||
) -> @renderer.Pixmap {
|
||||
let pixmap = self.compose_frame()
|
||||
@gfx.present_pixmap(ctx, pixmap)
|
||||
pixmap
|
||||
}
|
||||
|
||||
///|
|
||||
/// Process pending wasi-gfx surface input events (pointer clicks for focus).
|
||||
pub fn MoonPlasmaCompositor::handle_gfx_events(
|
||||
self : MoonPlasmaCompositor,
|
||||
surface : @gfx.Surface,
|
||||
) -> Unit {
|
||||
let downs = surface.drain_pointer_down()
|
||||
for ev in downs {
|
||||
let px = ev.x.to_int()
|
||||
let py = ev.y.to_int()
|
||||
let order = self.wm.stacking_order()
|
||||
// Top-most window hit-test (iterate reverse Z-order).
|
||||
let mut i = order.length() - 1
|
||||
while i >= 0 {
|
||||
let wid = order[i]
|
||||
match self.windows.get(wid) {
|
||||
Some(win) =>
|
||||
if px >= win.geometry.x &&
|
||||
px < win.geometry.x + win.geometry.w &&
|
||||
py >= win.geometry.y - 32 &&
|
||||
py < win.geometry.y + win.geometry.h {
|
||||
self.apply_actions([
|
||||
@wm.WmAction::Focus(wid),
|
||||
@wm.WmAction::Raise(wid),
|
||||
])
|
||||
break
|
||||
}
|
||||
None => ()
|
||||
}
|
||||
i = i - 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user