Added logging and X11 Keymap translation. Also various bugfixes.

This commit is contained in:
Patrick 2025-10-04 16:38:45 +02:00
commit 54a0f5eb4e
16 changed files with 181 additions and 57 deletions

View file

@ -1,6 +1,4 @@
#include <pgpl.h>
#include <stdio.h>
#include <stdlib.h>
static bool pgpl_gui_internal_event_loop(PGPL_Window *window,
@ -37,7 +35,8 @@ static bool pgpl_gui_internal_event_loop(PGPL_Window *window,
pgpl_gui_destroy(gui, true);
return false;
} else if (event_type == PGPL_WINDOW_EVENT_ERROR) {
printf("PGPL_Window has experienced an unexpected error!\nExiting...");
pgpl_log_message(PGPL_LOG_LEVEL_ERROR,
"PGPL_Window has experienced an unexpected error!");
} else {
uint32_t width, height;
uint32_t length = pgpl_vector_get_length(gui->widgets);

View file

@ -45,24 +45,21 @@ static void event(PGPL_GuiWidget *widget, PGPL_GuiTheme *theme, PGPL_Gui *gui,
if (event_type == PGPL_WINDOW_EVENT_MOUSE_PRESS &&
event_data->input_event.key == PGPL_WINDOW_MOUSE_BUTTON_LEFT) {
widget->gui_color = PGPL_GUI_STATUS_COLOR_ACTIVE;
return;
} else if (event_type == PGPL_WINDOW_EVENT_MOUSE_RELEASE &&
event_data->input_event.key == PGPL_WINDOW_MOUSE_BUTTON_LEFT) {
if (widget->gui_color == PGPL_GUI_STATUS_COLOR_ACTIVE) {
button_widget->click_callback(gui->app_data);
}
widget->gui_color = PGPL_GUI_STATUS_COLOR_HOVER;
return;
} else {
if (widget->gui_color != PGPL_GUI_STATUS_COLOR_ACTIVE) {
widget->gui_color = PGPL_GUI_STATUS_COLOR_HOVER;
}
return;
}
} else {
widget->gui_color = PGPL_GUI_STATUS_COLOR_NORMAL;
}
}
widget->gui_color = PGPL_GUI_STATUS_COLOR_NORMAL;
}
static void destroy(PGPL_GuiWidget *widget) {