Skip to content

Commit a97316d

Browse files
committed
removed redundant verbose print statements
1 parent 010afdf commit a97316d

10 files changed

Lines changed: 46 additions & 81 deletions

File tree

userland/apps/stlxdm/include/stlxdm_input_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "stlxdm_server.h"
99

1010
// Trace/debug output control
11-
#define STLXDM_INPUT_TRACE_ENABLED 1 // Set to 0 to disable all input manager trace output
11+
#define STLXDM_INPUT_TRACE_ENABLED 0 // Set to 0 to disable all input manager trace output
1212

1313
#if STLXDM_INPUT_TRACE_ENABLED
1414
#define STLXDM_INPUT_TRACE(fmt, ...) printf("[STLXDM_INPUT] " fmt "\n", ##__VA_ARGS__)

userland/apps/stlxdm/include/stlxdm_server.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
#include <stlxgfx/stlxgfx.h>
66
#include <stlxgfx/window.h>
77

8+
// Trace/debug output control
9+
#define STLXDM_SERVER_TRACE_ENABLED 0 // Set to 0 to disable all server trace output
10+
11+
#if STLXDM_SERVER_TRACE_ENABLED
12+
#define STLXDM_SERVER_TRACE(fmt, ...) printf("[STLXDM_SERVER] " fmt "\n", ##__VA_ARGS__)
13+
#else
14+
#define STLXDM_SERVER_TRACE(fmt, ...) ((void)0) // No-op when disabled
15+
#endif
16+
817
// Maximum number of concurrent clients
918
#define STLXDM_MAX_CLIENTS 16
1019

userland/apps/stlxdm/src/stlxdm_framebuffer.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ int stlxdm_get_framebuffer_info(struct gfx_framebuffer_info* fb_info) {
1414
printf("ERROR: Failed to get framebuffer info: %ld\n", result);
1515
return -1;
1616
}
17-
18-
printf("STLXDM] Framebuffer info: %ux%u, %u BPP, pitch=%u, size=%u\n",
19-
fb_info->width, fb_info->height, fb_info->bpp, fb_info->pitch, fb_info->size);
20-
17+
2118
return 0;
2219
}
2320

@@ -27,8 +24,7 @@ uint8_t* stlxdm_map_framebuffer(void) {
2724
printf("ERROR: Failed to map framebuffer: %ld\n", map_result);
2825
return NULL;
2926
}
30-
31-
printf("[STLXDM] Framebuffer mapped at address: 0x%lx\n", map_result);
27+
3228
return (uint8_t*)map_result;
3329
}
3430

@@ -38,8 +34,7 @@ int stlxdm_unmap_framebuffer(void) {
3834
printf("ERROR: Failed to unmap framebuffer: %ld\n", result);
3935
return -1;
4036
}
41-
42-
printf("Framebuffer unmapped successfully\n");
37+
4338
return 0;
4439
}
4540

userland/apps/stlxdm/src/stlxdm_hud.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ int stlxdm_hud_init(stlxdm_hud_t* hud, stlxgfx_context_t* gfx_ctx) {
3535
hud->mouse_y = -1;
3636
hud->mouse_over_hud = 0;
3737
hud->needs_redraw = 1; // Initial render needed
38-
39-
printf("[STLXDM_HUD] HUD initialized successfully\n");
38+
4039
return 0;
4140
}
4241

@@ -55,8 +54,6 @@ void stlxdm_hud_cleanup(stlxdm_hud_t* hud) {
5554
hud->component_count = 0;
5655
hud->max_components = 0;
5756
hud->needs_redraw = 0;
58-
59-
printf("[STLXDM_HUD] HUD cleaned up\n");
6057
}
6158

6259
int stlxdm_hud_register_component(stlxdm_hud_t* hud, stlxdm_hud_component_t* component) {
@@ -79,8 +76,6 @@ int stlxdm_hud_register_component(stlxdm_hud_t* hud, stlxdm_hud_component_t* com
7976

8077
// Mark HUD as needing redraw
8178
stlxdm_hud_mark_dirty(hud);
82-
83-
printf("[STLXDM_HUD] Registered component ID=%u, type=%d\n", component->id, component->type);
8479
return 0;
8580
}
8681

@@ -106,7 +101,6 @@ int stlxdm_hud_unregister_component(stlxdm_hud_t* hud, uint32_t component_id) {
106101
}
107102
}
108103

109-
printf("[STLXDM_HUD] Component ID=%u not found for unregistration\n", component_id);
110104
return -1;
111105
}
112106

@@ -167,7 +161,6 @@ int stlxdm_hud_handle_mouse_click(stlxdm_hud_t* hud, int32_t click_x, int32_t cl
167161

168162
// Check if click is within HUD area
169163
if (click_y < 0 || click_y >= STLXDM_HUD_HEIGHT) {
170-
printf("[STLXDM_HUD] Click outside HUD area (y=%d, HUD height=%d)\n", click_y, STLXDM_HUD_HEIGHT);
171164
return 0; // Click outside HUD, not handled
172165
}
173166

userland/apps/stlxdm/src/stlxdm_server.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
int stlxdm_server_init(stlxdm_server_t* server, stlxgfx_context_t* gfx_ctx, stlxgfx_pixel_format_t format) {
1414
if (!server || !gfx_ctx) {
15-
printf("[STLXDM_SERVER] ERROR: Invalid parameters for server init\n");
15+
STLXDM_SERVER_TRACE("ERROR: Invalid parameters for server init");
1616
return -1;
1717
}
1818

@@ -84,7 +84,7 @@ int stlxdm_server_accept_new_connections(stlxdm_server_t* server) {
8484
// Allocate receive buffer for this client
8585
server->clients[slot].receive_buffer = malloc(STLXGFX_MAX_PAYLOAD_SIZE);
8686
if (!server->clients[slot].receive_buffer) {
87-
printf("[STLXDM_SERVER] ERROR: Failed to allocate receive buffer for client %u\n", server->clients[slot].client_id);
87+
STLXDM_SERVER_TRACE("ERROR: Failed to allocate receive buffer for client %u", server->clients[slot].client_id);
8888
// Clean up the connection
8989
close(new_client_fd);
9090
server->clients[slot].socket_fd = -1;
@@ -97,13 +97,13 @@ int stlxdm_server_accept_new_connections(stlxdm_server_t* server) {
9797
new_connections++;
9898
} else {
9999
// No slots available, close the connection
100-
printf("[STLXDM_SERVER] WARNING: No client slots available, closing connection\n");
100+
STLXDM_SERVER_TRACE("WARNING: No client slots available, closing connection");
101101
close(new_client_fd);
102102
break;
103103
}
104104
} else if (new_client_fd == -2) {
105105
// Error accepting connection
106-
printf("[STLXDM_SERVER] ERROR: Failed to accept client connection\n");
106+
STLXDM_SERVER_TRACE("ERROR: Failed to accept client connection");
107107
return -1;
108108
} else {
109109
// No more pending connections (new_client_fd == -1)
@@ -137,7 +137,7 @@ static int stlxdm_server_dispatch_message(stlxdm_server_t* server,
137137
return stlxdm_server_handle_destroy_window_request(server, client, header, payload);
138138
}
139139
default: {
140-
printf("[STLXDM_SERVER] Unknown message type %u from client %u\n",
140+
STLXDM_SERVER_TRACE("Unknown message type %u from client %u",
141141
header->message_type, client->client_id);
142142
return -1;
143143
}
@@ -152,7 +152,7 @@ static int stlxdm_server_handle_create_window_request(stlxdm_server_t* server,
152152

153153
// Validate window dimensions
154154
if (req->width == 0 || req->height == 0 || req->width > 4096 || req->height > 4096) {
155-
printf("[STLXDM_SERVER] Invalid window dimensions: %ux%u\n", req->width, req->height);
155+
STLXDM_SERVER_TRACE("Invalid window dimensions: %ux%u", req->width, req->height);
156156
// TODO: Send error response
157157
return -1;
158158
}
@@ -165,14 +165,14 @@ static int stlxdm_server_handle_create_window_request(stlxdm_server_t* server,
165165

166166
// Validate title length
167167
if (req->title_length > 255) {
168-
printf("[STLXDM_SERVER] Title too long: %u characters\n", req->title_length);
168+
STLXDM_SERVER_TRACE("Title too long: %u characters", req->title_length);
169169
// TODO: Send error response
170170
return -1;
171171
}
172172

173173
// Check if client already has a window
174174
if (client->window != NULL) {
175-
printf("[STLXDM_SERVER] Client %u already has a window\n", client->client_id);
175+
STLXDM_SERVER_TRACE("Client %u already has a window", client->client_id);
176176
// TODO: Send error response
177177
return -1;
178178
}
@@ -181,7 +181,7 @@ static int stlxdm_server_handle_create_window_request(stlxdm_server_t* server,
181181
stlxgfx_context_t* gfx_ctx = server->gfx_ctx;
182182

183183
if (!gfx_ctx) {
184-
printf("[STLXDM_SERVER] ERROR: No graphics context available\n");
184+
STLXDM_SERVER_TRACE("ERROR: No graphics context available");
185185
return -1;
186186
}
187187

@@ -190,7 +190,7 @@ static int stlxdm_server_handle_create_window_request(stlxdm_server_t* server,
190190
stlxgfx_window_sync_t* sync_data;
191191

192192
if (stlxgfx_dm_create_window_sync_shm(gfx_ctx, &sync_shm_handle, &sync_data) != 0) {
193-
printf("[STLXDM_SERVER] Failed to create window sync SHM\n");
193+
STLXDM_SERVER_TRACE("Failed to create window sync SHM");
194194
return -1;
195195
}
196196

@@ -203,7 +203,7 @@ static int stlxdm_server_handle_create_window_request(stlxdm_server_t* server,
203203

204204
if (stlxgfx_dm_create_shared_surface_set(gfx_ctx, req->width, req->height, surface_format,
205205
&surface_shm_handle, &surface0, &surface1, &surface2) != 0) {
206-
printf("[STLXDM_SERVER] Failed to create surface set SHM\n");
206+
STLXDM_SERVER_TRACE("Failed to create surface set SHM");
207207
// Clean up sync SHM
208208
stlxgfx_dm_destroy_window_sync_shm(gfx_ctx, sync_shm_handle, sync_data);
209209
return -1;
@@ -214,7 +214,7 @@ static int stlxdm_server_handle_create_window_request(stlxdm_server_t* server,
214214
stlxgfx_event_ring_t* event_ring;
215215

216216
if (stlxgfx_dm_create_event_ring_shm(gfx_ctx, &event_shm_handle, &event_ring) != 0) {
217-
printf("[STLXDM_SERVER] Failed to create event ring SHM\n");
217+
STLXDM_SERVER_TRACE("Failed to create event ring SHM");
218218
// Clean up surface set SHM
219219
stlxgfx_dm_destroy_shared_surface_set(gfx_ctx, surface_shm_handle, surface0, surface1, surface2);
220220
// Clean up sync SHM
@@ -225,7 +225,7 @@ static int stlxdm_server_handle_create_window_request(stlxdm_server_t* server,
225225
// Create and populate window structure
226226
stlxgfx_window_t* window = malloc(sizeof(stlxgfx_window_t));
227227
if (!window) {
228-
printf("[STLXDM_SERVER] Failed to allocate window structure\n");
228+
STLXDM_SERVER_TRACE("Failed to allocate window structure");
229229
// Clean up all shared memory
230230
stlxgfx_dm_destroy_event_ring_shm(gfx_ctx, event_shm_handle, event_ring);
231231
stlxgfx_dm_destroy_shared_surface_set(gfx_ctx, surface_shm_handle, surface0, surface1, surface2);
@@ -278,11 +278,11 @@ static int stlxdm_server_handle_create_window_request(stlxdm_server_t* server,
278278
};
279279

280280
if (stlxgfx_send_message(client->socket_fd, &response_header, &response) == 0) {
281-
printf("[STLXDM_SERVER] Created window ID=%u with sync_shm=%lu, surface_shm=%lu, event_shm=%lu for client %u\n",
281+
STLXDM_SERVER_TRACE("Created window ID=%u with sync_shm=%lu, surface_shm=%lu, event_shm=%lu for client %u",
282282
window->window_id, sync_shm_handle, surface_shm_handle, event_shm_handle, client->client_id);
283283
return 0;
284284
} else {
285-
printf("[STLXDM_SERVER] Failed to send response to client %u\n", client->client_id);
285+
STLXDM_SERVER_TRACE("Failed to send response to client %u", client->client_id);
286286
// Clean up everything on send failure
287287
client->window = NULL;
288288
free(window);
@@ -301,7 +301,7 @@ static int stlxdm_server_handle_destroy_window_request(stlxdm_server_t* server,
301301

302302
// Check if client has a window
303303
if (client->window == NULL) {
304-
printf("[STLXDM_SERVER] Client %u has no window to destroy\n", client->client_id);
304+
STLXDM_SERVER_TRACE("Client %u has no window to destroy", client->client_id);
305305
// Send error response
306306
stlxgfx_message_header_t error_header = {
307307
.protocol_version = STLXGFX_PROTOCOL_VERSION,
@@ -323,7 +323,7 @@ static int stlxdm_server_handle_destroy_window_request(stlxdm_server_t* server,
323323

324324
// Validate that the window ID matches
325325
if (client->window->window_id != req->window_id) {
326-
printf("[STLXDM_SERVER] Window ID mismatch: client has %u, request for %u\n",
326+
STLXDM_SERVER_TRACE("Window ID mismatch: client has %u, request for %u",
327327
client->window->window_id, req->window_id);
328328
// Send error response
329329
stlxgfx_message_header_t error_header = {
@@ -348,13 +348,13 @@ static int stlxdm_server_handle_destroy_window_request(stlxdm_server_t* server,
348348
stlxgfx_context_t* gfx_ctx = server->gfx_ctx;
349349

350350
if (!gfx_ctx) {
351-
printf("[STLXDM_SERVER] ERROR: No graphics context available\n");
351+
STLXDM_SERVER_TRACE("ERROR: No graphics context available");
352352
return -1;
353353
}
354354

355355
// Clean up window resources
356356
stlxgfx_window_t* window = client->window;
357-
printf("[STLXDM_SERVER] Destroying window ID=%u for client %u\n",
357+
STLXDM_SERVER_TRACE("Destroying window ID=%u for client %u",
358358
window->window_id, client->client_id);
359359

360360
// Clean up shared memory resources
@@ -402,11 +402,11 @@ static int stlxdm_server_handle_destroy_window_request(stlxdm_server_t* server,
402402
};
403403

404404
if (stlxgfx_send_message(client->socket_fd, &response_header, &response) == 0) {
405-
printf("[STLXDM_SERVER] Successfully destroyed window ID=%u for client %u\n",
405+
STLXDM_SERVER_TRACE("Successfully destroyed window ID=%u for client %u",
406406
req->window_id, client->client_id);
407407
return 0;
408408
} else {
409-
printf("[STLXDM_SERVER] Failed to send destroy response to client %u\n", client->client_id);
409+
STLXDM_SERVER_TRACE("Failed to send destroy response to client %u", client->client_id);
410410
return -1;
411411
}
412412
}
@@ -431,16 +431,16 @@ int stlxdm_server_handle_client_requests(stlxdm_server_t* server) {
431431

432432
if (result == 0) {
433433
// Message received, dispatch to appropriate handler
434-
printf("[STLXDM_SERVER] Received %s (%u) from client %u (slot %d)\n",
434+
STLXDM_SERVER_TRACE("Received %s (%u) from client %u (slot %d)",
435435
stlxdm_server_get_message_type_name(header.message_type),
436436
header.message_type, client->client_id, i);
437437

438438
if (stlxdm_server_dispatch_message(server, client, &header, client->receive_buffer) < 0) {
439-
printf("[STLXDM_SERVER] Failed to handle message from client %u\n", client->client_id);
439+
STLXDM_SERVER_TRACE("Failed to handle message from client %u", client->client_id);
440440
}
441441
} else if (result == -2) {
442442
// Client disconnected or error
443-
printf("[STLXDM_SERVER] Client %u (slot %d) disconnected\n", client->client_id, i);
443+
STLXDM_SERVER_TRACE("Client %u (slot %d) disconnected", client->client_id, i);
444444
stlxdm_server_disconnect_client(server, i);
445445
}
446446
// result == -1 means no data available, which is normal
@@ -464,7 +464,7 @@ int stlxdm_server_disconnect_client(stlxdm_server_t* server, int client_index) {
464464
return 0; // Already disconnected
465465
}
466466

467-
printf("[STLXDM_SERVER] Disconnecting client %u (slot %d, fd %d)\n",
467+
STLXDM_SERVER_TRACE("Disconnecting client %u (slot %d, fd %d)",
468468
client->client_id, client_index, client->socket_fd);
469469

470470
// Close socket
@@ -475,7 +475,7 @@ int stlxdm_server_disconnect_client(stlxdm_server_t* server, int client_index) {
475475
// Clean up window if it exists
476476
if (client->window) {
477477
stlxgfx_window_t* window = client->window;
478-
printf("[STLXDM_SERVER] Cleaning up window ID=%u for client %u\n",
478+
STLXDM_SERVER_TRACE("Cleaning up window ID=%u for client %u",
479479
window->window_id, client->client_id);
480480

481481
// Properly destroy window with shared memory cleanup

userland/apps/stlxdm/src/stlxdm_splash.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,13 @@ int stlxdm_show_splash_screen(stlxdm_compositor_t* compositor) {
289289
printf("[STLXDM_SPLASH] ERROR: Invalid compositor for splash screen\n");
290290
return -1;
291291
}
292-
293-
printf("[STLXDM_SPLASH] Starting splash screen...\n");
294-
292+
295293
const struct gfx_framebuffer_info* fb_info = stlxdm_compositor_get_fb_info(compositor);
296294
if (!fb_info) {
297295
printf("[STLXDM_SPLASH] ERROR: No framebuffer info available\n");
298296
return -1;
299297
}
300-
298+
301299
stlxgfx_surface_t* splash_surface = stlxgfx_dm_create_surface(
302300
compositor->gfx_ctx,
303301
fb_info->width,
@@ -312,8 +310,7 @@ int stlxdm_show_splash_screen(stlxdm_compositor_t* compositor) {
312310

313311
uint32_t frame = 0;
314312
uint32_t elapsed_ms = 0;
315-
printf("[STLXDM_SPLASH] Displaying splash screen (press Enter to continue)\n");
316-
313+
317314
while (1) {
318315
create_dark_background(splash_surface);
319316
draw_animated_gradient_logo(splash_surface, frame);
@@ -336,7 +333,6 @@ int stlxdm_show_splash_screen(stlxdm_compositor_t* compositor) {
336333
}
337334

338335
if (check_for_enter_key()) {
339-
printf("[STLXDM_SPLASH] Enter key pressed, continuing to display manager\n");
340336
break;
341337
}
342338

@@ -354,6 +350,5 @@ int stlxdm_show_splash_screen(stlxdm_compositor_t* compositor) {
354350
stlxdm_launch_terminal();
355351

356352
stlxgfx_dm_destroy_surface(compositor->gfx_ctx, splash_surface);
357-
printf("[STLXDM_SPLASH] Splash screen completed\n");
358353
return 0;
359354
}

0 commit comments

Comments
 (0)