a modern tui library written in zig

vxfw: remove focusable field

rockorager.dev cee974a2 4f8fe8f1

verified
-1
README.md
··· 155 155 // A Surface must have a size. Our root widget is the size of the screen 156 156 .size = max_size, 157 157 .widget = self.widget(), 158 - .focusable = false, 159 158 // We didn't actually need to draw anything for the root. In this case, we can set 160 159 // buffer to a zero length slice. If this slice is *not zero length*, the runtime will 161 160 // assert that it's length is equal to the size.width * size.height.
-1
examples/counter.zig
··· 93 93 // A Surface must have a size. Our root widget is the size of the screen 94 94 .size = max_size, 95 95 .widget = self.widget(), 96 - .focusable = false, 97 96 // We didn't actually need to draw anything for the root. In this case, we can set 98 97 // buffer to a zero length slice. If this slice is *not zero length*, the runtime will 99 98 // assert that it's length is equal to the size.width * size.height.
+1 -3
examples/fuzzy.zig
··· 54 54 const self: *Model = @ptrCast(@alignCast(ptr)); 55 55 const max = ctx.max.size(); 56 56 57 - var list_view: vxfw.SubSurface = .{ 57 + const list_view: vxfw.SubSurface = .{ 58 58 .origin = .{ .row = 2, .col = 0 }, 59 59 .surface = try self.list_view.draw(ctx.withConstraints( 60 60 ctx.min, 61 61 .{ .width = max.width, .height = max.height - 3 }, 62 62 )), 63 63 }; 64 - list_view.surface.focusable = false; 65 64 66 65 const text_field: vxfw.SubSurface = .{ 67 66 .origin = .{ .row = 0, .col = 2 }, ··· 86 85 return .{ 87 86 .size = max, 88 87 .widget = self.widget(), 89 - .focusable = true, 90 88 .buffer = &.{}, 91 89 .children = children, 92 90 };
-1
examples/scroll.zig
··· 138 138 return .{ 139 139 .size = max, 140 140 .widget = self.widget(), 141 - .focusable = true, 142 141 .buffer = &.{}, 143 142 .children = children, 144 143 };
+1 -2
src/vxfw/Button.zig
··· 107 107 const center: Center = .{ .child = text.widget() }; 108 108 const surf = try center.draw(ctx); 109 109 110 - var button_surf = try vxfw.Surface.initWithChildren(ctx.arena, self.widget(), surf.size, surf.children); 110 + const button_surf = try vxfw.Surface.initWithChildren(ctx.arena, self.widget(), surf.size, surf.children); 111 111 @memset(button_surf.buffer, .{ .style = style }); 112 - button_surf.focusable = true; 113 112 return button_surf; 114 113 } 115 114
+1 -4
src/vxfw/ListView.zig
··· 292 292 293 293 // Set state 294 294 { 295 - surface.focusable = true; 296 295 // Assume we have more. We only know we don't after drawing 297 296 self.scroll.has_more = true; 298 297 } ··· 355 354 ); 356 355 357 356 // Draw the child 358 - var surf = try child.draw(child_ctx); 359 - // We set the child to non-focusable so that we can manage where the keyevents go 360 - surf.focusable = false; 357 + const surf = try child.draw(child_ctx); 361 358 362 359 // Add the child surface to our list. It's offset from parent is the accumulated height 363 360 try child_list.append(.{
+1 -4
src/vxfw/ScrollView.zig
··· 348 348 349 349 // Set state 350 350 { 351 - surface.focusable = true; 352 351 // Assume we have more. We only know we don't after drawing 353 352 self.scroll.has_more_vertical = true; 354 353 } ··· 411 410 ); 412 411 413 412 // Draw the child 414 - var surf = try child.draw(child_ctx); 415 - // We set the child to non-focusable so that we can manage where the keyevents go 416 - surf.focusable = false; 413 + const surf = try child.draw(child_ctx); 417 414 418 415 // Add the child surface to our list. It's offset from parent is the accumulated height 419 416 try child_list.append(.{
-1
src/vxfw/TextField.zig
··· 206 206 self.widget(), 207 207 .{ .width = max_width, .height = @max(ctx.min.height, 1) }, 208 208 ); 209 - surface.focusable = true; 210 209 211 210 const base: vaxis.Cell = .{ .style = .{} }; 212 211 @memset(surface.buffer, base);
-4
src/vxfw/vxfw.zig
··· 329 329 /// The widget this surface belongs to 330 330 widget: Widget, 331 331 332 - /// If this widget / Surface is focusable 333 - focusable: bool = false, 334 - 335 332 /// Cursor state 336 333 cursor: ?CursorState = null, 337 334 ··· 393 390 .widget = self.widget, 394 391 .buffer = self.buffer[0 .. self.size.width * height], 395 392 .children = self.children, 396 - .focusable = self.focusable, 397 393 }; 398 394 } 399 395