this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

vxfw: target widget should also get capture phase events

+7 -8
+7 -8
src/vxfw/App.zig
··· 717 717 718 718 fn handleEvent(self: *FocusHandler, ctx: *vxfw.EventContext, event: vxfw.Event) anyerror!void { 719 719 const path = self.path_to_focused.items; 720 - if (path.len == 0) return; 721 - 722 - const target_idx = path.len - 1; 720 + assert(path.len > 0); 723 721 724 - // Capturing phase 722 + // Capturing phase. We send capture events from the root to the target (inclusive of target) 725 723 ctx.phase = .capturing; 726 - for (path[0..target_idx]) |widget| { 724 + for (path) |widget| { 727 725 try widget.captureEvent(ctx, event); 728 726 if (ctx.consume_event) return; 729 727 } 730 728 731 - // Target phase 729 + // Target phase. This is only sent to the target 732 730 ctx.phase = .at_target; 733 - const target = path[target_idx]; 731 + const target = self.path_to_focused.getLast(); 734 732 try target.handleEvent(ctx, event); 735 733 if (ctx.consume_event) return; 736 734 737 - // Bubbling phase 735 + // Bubbling phase. Bubbling phase moves from target (exclusive) to the root 738 736 ctx.phase = .bubbling; 737 + const target_idx = path.len - 1; 739 738 var iter = std.mem.reverseIterator(path[0..target_idx]); 740 739 while (iter.next()) |widget| { 741 740 try widget.handleEvent(ctx, event);