mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-07 19:49:53 -05:00
research in ideation.md
This commit is contained in:
parent
6b76de1e77
commit
7838d09275
4 changed files with 109 additions and 1 deletions
53
ideation.md
53
ideation.md
|
|
@ -15,3 +15,56 @@
|
|||
# Style Guide
|
||||
|
||||
Perhaps we do what river does for organization? Checkout river/Server.zig:17's use of @This();
|
||||
|
||||
# information
|
||||
|
||||
server owns
|
||||
- compositor
|
||||
|
||||
wlr_compositor owms
|
||||
- a list of wlr_surfaces
|
||||
|
||||
wlr_surfaces owns
|
||||
- wl_resources which should (be/have?) buffers
|
||||
|
||||
## Scene Structure
|
||||
wlr_scene owns
|
||||
- list of outputs
|
||||
- wlr_scene_tree
|
||||
|
||||
wlr_scene_tree owns
|
||||
- its own wlr_scene_node
|
||||
- list of its children wlr_scene_node
|
||||
|
||||
wlr_scene_node can be TREE, RECT or BUFFER and owns
|
||||
- its own type
|
||||
- a pointer to its parent wlr_scene_tree
|
||||
- a list of children as wlr_scene_trees
|
||||
- boolean if enabled
|
||||
- x, y position relative to parent
|
||||
- wl signal for destroy
|
||||
- *void arbitrary data
|
||||
|
||||
```zig
|
||||
struct wl_resource *_surface;
|
||||
|
||||
wl_resource_for_each(_surface, &server->compositor->surfaces) {
|
||||
struct wlr_surface *surface = wlr_surface_from_resource(_surface);
|
||||
if (!wlr_surface_has_buffer(surface)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
struct wlr_box render_box = {
|
||||
.x = 20, .y = 20,
|
||||
.width = surface->current->width,
|
||||
.height = surface->current->height
|
||||
};
|
||||
|
||||
float matrix[16];
|
||||
wlr_matrix_project_box(&matrix, &render_box,
|
||||
surface->current->transform,
|
||||
0, &wlr_output->transform_matrix);
|
||||
wlr_render_with_matrix(renderer, surface->texture, &matrix, 1.0f);
|
||||
wlr_surface_send_frame_done(surface, &now);
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -3,6 +3,5 @@ const std = @import("std");
|
|||
const Server = @import("server.zig").Server;
|
||||
|
||||
pub fn main() !void {
|
||||
std.debug.print("Starting mezzaluna", .{});
|
||||
_ = try Server.init();
|
||||
}
|
||||
|
|
|
|||
6
src/output.zig
Normal file
6
src/output.zig
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
const std = @import("std");
|
||||
const wl = @import("wayland").server.wl;
|
||||
const wlr = @import("wlroots");
|
||||
|
||||
pub const Ouput = struct {
|
||||
}
|
||||
50
src/scene.zig
Normal file
50
src/scene.zig
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
const wl = @import("wayland").server.wl;
|
||||
const wlr = @import("wlroots");
|
||||
|
||||
// server owns
|
||||
// - compositor
|
||||
//
|
||||
// wlr_compositor owms
|
||||
// - a list of wlr_surfaces
|
||||
//
|
||||
// wlr_surfaces own_buffers
|
||||
//
|
||||
// struct wl_resource *_surface;
|
||||
// wl_resource_for_each(_surface, &server->compositor->surfaces) {
|
||||
// struct wlr_surface *surface = wlr_surface_from_resource(_surface);
|
||||
// if (!wlr_surface_has_buffer(surface)) {
|
||||
// continue;
|
||||
// }
|
||||
// struct wlr_box render_box = {
|
||||
// .x = 20, .y = 20,
|
||||
// .width = surface->current->width,
|
||||
// .height = surface->current->height
|
||||
// };
|
||||
// float matrix[16];
|
||||
// wlr_matrix_project_box(&matrix, &render_box,
|
||||
// surface->current->transform,
|
||||
// 0, &wlr_output->transform_matrix);
|
||||
// wlr_render_with_matrix(renderer, surface->texture, &matrix, 1.0f);
|
||||
// wlr_surface_send_frame_done(surface, &now);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// wlr_scene owns
|
||||
// - list of outputs
|
||||
// - wlr_scene_tree
|
||||
//
|
||||
// wlr_scene_tree owns
|
||||
// - its own wlr_scene_node
|
||||
// - list of its children wlr_scene_node
|
||||
//
|
||||
// wlr_scene_node can be TREE, RECT or BUFFER and owns
|
||||
// - its own type
|
||||
// - a pointer to its parent wlr_scene_tree
|
||||
// - a list of children as wlr_scene_trees
|
||||
// - boolean if enabled
|
||||
// - x, y position relative to parent
|
||||
// - wl signal for destroy
|
||||
// - *void arbitrary data
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue