various updates

This commit is contained in:
rozodru 2025-07-18 12:48:00 -04:00
parent 22311288c9
commit 1c97f9e32b
7 changed files with 142 additions and 23 deletions

View File

@ -209,4 +209,42 @@ The project has successfully completed the **foundation and desktop UI phase**.
- **Comprehensive input support** including gaming and gesture capabilities
- **Robust build system** with proper dependency management
NEDM is now a **fully-featured modern Wayland compositor** with excellent application compatibility, integrated desktop UI, wallpaper support, and comprehensive configuration options. The next phase focuses on integrating the configuration system with the implementations, advanced features, and performance optimization to provide a complete desktop experience.
NEDM is now a **fully-featured modern Wayland compositor** with excellent application compatibility, integrated desktop UI, wallpaper support, and comprehensive configuration options. The next phase focuses on integrating the configuration system with the implementations, advanced features, and performance optimization to provide a complete desktop experience.
## 🚧 Current Issues & Debugging (Session 2)
### 12. **Startup Crash Fixes**
- **Original Issue**: NEDM crashed on startup with `wl_list_empty(&kb->events.key.listener_list)' failed`
- **Root Cause**: Multiple cleanup order bugs in shutdown sequence
- **Fixes Applied**:
- Fixed keyboard event listener cleanup order in `seat.c:898-899`
- Fixed wallpaper listener removal check in `wallpaper.c:243`
- Fixed cursor event listener cleanup order in `seat.c:914-927`
- Created proper `input_manager_destroy()` function for virtual keyboard cleanup
- Fixed config file by copying from `examples/config` instead of using broken user config
### 13. **UI Rendering Issues** ⚠️ (Partially Fixed)
- **Status Bar**: No text displayed - renders to Cairo surface but displays colored rectangle
- **Wallpaper**: No image displayed - renders to Cairo surface but displays colored rectangle
- **Window Layering**: Status bar appears behind windows - moved to layer 3 (OVERLAY)
**Technical Analysis**:
- Status bar creates Cairo surface and renders text properly
- Wallpaper creates Cairo surface and renders image properly
- **Core Problem**: Both use `wlr_scene_rect_create()` instead of proper scene buffer from Cairo surface
- **Solution Required**: Implement proper wlroots buffer creation from Cairo surfaces
**Configuration Applied**:
- Enabled status bar config: `configure_status_bar` options
- Enabled wallpaper config: `configure_wallpaper` options
- Added proper default initialization for both configs in `nedm.c`
### 14. **Current Status**
- **NEDM runs successfully** without crashes
- **All original functionality working** (keybindings, window management, etc.)
- **Config parsing fixed** by using proper config file
- **Keyboard crash eliminated** - was the main issue reported
**Remaining Work**:
- Implement proper Cairo surface → wlroots buffer → scene buffer pipeline
- Fix wallpaper and status bar rendering to display actual content instead of colored rectangles

View File

@ -403,6 +403,35 @@ input_manager_create(struct nedm_server *server) {
return input;
}
void
input_manager_destroy(struct nedm_input_manager *input) {
if (!input) {
return;
}
// Remove virtual keyboard listeners first
if (input->virtual_keyboard) {
wl_list_remove(&input->virtual_keyboard_new.link);
}
// Remove virtual pointer listeners
if (input->virtual_pointer) {
wl_list_remove(&input->virtual_pointer_new.link);
}
// Remove input device listeners
wl_list_remove(&input->new_input.link);
// Clean up device list - but don't free devices if they were already handled by seat
struct nedm_input_device *device, *tmp;
wl_list_for_each_safe(device, tmp, &input->devices, link) {
wl_list_remove(&device->link);
// Don't free device - it should have been freed by seat destruction
}
free(input);
}
uint32_t
get_mouse_bindsym(const char *name, char **error) {
// Get event code from name

View File

@ -12,6 +12,8 @@
struct nedm_input_manager *
input_manager_create(struct nedm_server *server);
void
input_manager_destroy(struct nedm_input_manager *input);
void
input_manager_handle_device_destroy(struct wl_listener *listener, void *data);
uint32_t
input_manager_get_mouse_button(const char *name, char **error);

32
nedm.c
View File

@ -412,6 +412,35 @@ main(int argc, char *argv[]) {
server.message_config.font = strdup("pango:Monospace 10");
server.message_config.anchor = NEDM_MESSAGE_TOP_RIGHT;
// Initialize status bar config defaults
server.status_bar_config.position = NEDM_STATUS_BAR_TOP_RIGHT;
server.status_bar_config.height = 24;
server.status_bar_config.width_percent = 20;
server.status_bar_config.update_interval = 1000;
server.status_bar_config.bg_color[0] = 0.1;
server.status_bar_config.bg_color[1] = 0.1;
server.status_bar_config.bg_color[2] = 0.1;
server.status_bar_config.bg_color[3] = 0.9;
server.status_bar_config.text_color[0] = 1.0;
server.status_bar_config.text_color[1] = 1.0;
server.status_bar_config.text_color[2] = 1.0;
server.status_bar_config.text_color[3] = 1.0;
server.status_bar_config.font = strdup("monospace 10");
server.status_bar_config.show_time = true;
server.status_bar_config.show_date = true;
server.status_bar_config.show_battery = true;
server.status_bar_config.show_volume = true;
server.status_bar_config.show_wifi = true;
server.status_bar_config.show_workspace = true;
// Initialize wallpaper config defaults
server.wallpaper_config.image_path = strdup("assets/nedm.png");
server.wallpaper_config.mode = NEDM_WALLPAPER_FILL;
server.wallpaper_config.bg_color[0] = 0.2;
server.wallpaper_config.bg_color[1] = 0.2;
server.wallpaper_config.bg_color[2] = 0.3;
server.wallpaper_config.bg_color[3] = 1.0;
event_loop = wl_display_get_event_loop(server.wl_display);
sigint_source =
wl_event_loop_add_signal(event_loop, SIGINT, handle_signal, &server);
@ -829,8 +858,9 @@ end:
}
if(server.input != NULL) {
free(server.input);
input_manager_destroy(server.input);
}
pango_cairo_font_map_set_default(NULL);
cairo_debug_reset_static_data();
FcFini();

10
seat.c
View File

@ -895,8 +895,10 @@ handle_destroy(struct wl_listener *listener,
struct nedm_keyboard_group *group, *group_tmp;
wl_list_for_each_safe(group, group_tmp, &seat->keyboard_groups, link) {
wl_list_remove(&group->link);
wlr_keyboard_group_destroy(group->wlr_group);
wl_list_remove(&group->key.link);
wl_list_remove(&group->modifiers.link);
wl_event_source_remove(group->key_repeat_timer);
wlr_keyboard_group_destroy(group->wlr_group);
if(group->identifier) {
free(group->identifier);
}
@ -909,9 +911,6 @@ handle_destroy(struct wl_listener *listener,
}
wlr_xcursor_manager_destroy(seat->xcursor_manager);
if(seat->cursor) {
wlr_cursor_destroy(seat->cursor);
}
wl_list_remove(&seat->cursor_motion.link);
wl_list_remove(&seat->cursor_motion_absolute.link);
wl_list_remove(&seat->cursor_button.link);
@ -923,6 +922,9 @@ handle_destroy(struct wl_listener *listener,
wl_list_remove(&seat->request_set_cursor.link);
wl_list_remove(&seat->request_set_selection.link);
wl_list_remove(&seat->request_set_primary_selection.link);
if(seat->cursor) {
wlr_cursor_destroy(seat->cursor);
}
seat->server->seat = NULL;
free(seat);
}

View File

@ -32,7 +32,7 @@
static struct wlr_scene_rect *create_status_bar_rect(struct nedm_output *output,
uint32_t width, uint32_t height, float bg_color[4]) {
struct wlr_scene_rect *rect = wlr_scene_rect_create(output->layers[2],
struct wlr_scene_rect *rect = wlr_scene_rect_create(output->layers[3],
width, height, bg_color);
return rect;
@ -165,6 +165,12 @@ void nedm_status_bar_render(struct nedm_status_bar *status_bar) {
struct nedm_status_info info = {0};
status_bar_gather_system_info(&info);
// Debug: Print what we gathered
wlr_log(WLR_DEBUG, "Status bar info: time=%s, date=%s, battery=%s",
info.time_str ? info.time_str : "NULL",
info.date_str ? info.date_str : "NULL",
info.battery_str ? info.battery_str : "NULL");
// Calculate positions for right-aligned text
int current_x = status_bar->width - STATUS_BAR_MARGIN;
int y = (status_bar->height - 12) / 2; // Center vertically
@ -303,7 +309,10 @@ void nedm_status_bar_create_for_output(struct nedm_output *output) {
status_bar->font_desc = pango_font_description_from_string(font_str);
pango_layout_set_font_description(status_bar->pango_layout, status_bar->font_desc);
// Create the status bar rectangle
// Render the status bar text first
nedm_status_bar_render(status_bar);
// Create the status bar rectangle (temporary - should be replaced with Cairo surface)
status_bar->scene_rect = create_status_bar_rect(output, status_bar->width, status_bar->height, config->bg_color);
if (!status_bar->scene_rect) {
wlr_log(WLR_ERROR, "Failed to create scene rect for status bar");

View File

@ -189,27 +189,34 @@ void nedm_wallpaper_create_for_output(struct nedm_output *output) {
return;
}
// Create a colored rectangle as background in the BACKGROUND layer
// Use the configured background color
wallpaper->scene_rect = wlr_scene_rect_create(output->layers[0], // BACKGROUND layer
wallpaper->output_width, wallpaper->output_height, config->bg_color);
// Render the wallpaper first
nedm_wallpaper_render(wallpaper);
if (!wallpaper->scene_rect) {
wlr_log(WLR_ERROR, "Failed to create scene rect for wallpaper");
nedm_wallpaper_destroy(wallpaper);
return;
// Create a scene buffer from the rendered wallpaper
if (wallpaper->render_surface) {
// Create a wlr_buffer from the cairo surface
cairo_surface_flush(wallpaper->render_surface);
unsigned char *data = cairo_image_surface_get_data(wallpaper->render_surface);
int stride = cairo_image_surface_get_stride(wallpaper->render_surface);
// For now, create a colored rectangle as fallback
wallpaper->scene_rect = wlr_scene_rect_create(output->layers[0], // BACKGROUND layer
wallpaper->output_width, wallpaper->output_height, config->bg_color);
if (!wallpaper->scene_rect) {
wlr_log(WLR_ERROR, "Failed to create scene rect for wallpaper");
nedm_wallpaper_destroy(wallpaper);
return;
}
// Position the wallpaper at (0, 0) to cover the entire output
wlr_scene_node_set_position(&wallpaper->scene_rect->node, 0, 0);
}
// Position the wallpaper at (0, 0) to cover the entire output
wlr_scene_node_set_position(&wallpaper->scene_rect->node, 0, 0);
// Set up event listeners
wallpaper->output_destroy.notify = wallpaper_handle_output_destroy;
wl_signal_add(&output->events.destroy, &wallpaper->output_destroy);
// Render the wallpaper
nedm_wallpaper_render(wallpaper);
wlr_log(WLR_INFO, "Created wallpaper for output %s (%dx%d) with image %s",
output->wlr_output->name, wallpaper->output_width, wallpaper->output_height,
wallpaper->image_path);
@ -240,7 +247,9 @@ void nedm_wallpaper_destroy(struct nedm_wallpaper *wallpaper) {
free(wallpaper->image_path);
}
wl_list_remove(&wallpaper->output_destroy.link);
if (wallpaper->output_destroy.notify) {
wl_list_remove(&wallpaper->output_destroy.link);
}
if (wallpaper->output) {
wallpaper->output->wallpaper = NULL;