[client] cimgui: update to 1.91.8

This commit is contained in:
Geoffrey McRae 2025-03-05 15:16:31 +11:00
parent 6dcf178879
commit d9f2df361d
10 changed files with 115 additions and 39 deletions

View File

@ -137,6 +137,8 @@ set(SOURCES
# Force cimgui to build as a static library. # Force cimgui to build as a static library.
set(IMGUI_STATIC "yes" CACHE STRING "Build as a static library") set(IMGUI_STATIC "yes" CACHE STRING "Build as a static library")
add_definitions("-DCIMGUI_USE_OPENGL2=1")
add_definitions("-DCIMGUI_USE_OPENGL3=1")
add_subdirectory("${PROJECT_TOP}/resources" "${CMAKE_BINARY_DIR}/resources") add_subdirectory("${PROJECT_TOP}/resources" "${CMAKE_BINARY_DIR}/resources")
add_subdirectory("${PROJECT_TOP}/common" "${CMAKE_BINARY_DIR}/common" ) add_subdirectory("${PROJECT_TOP}/common" "${CMAKE_BINARY_DIR}/common" )

View File

@ -346,8 +346,8 @@ void app_handleKeyPress(int sc, int charcode)
app_setOverlay(false); app_setOverlay(false);
else else
{ {
if (sc < sizeof(g_state.io->KeysDown)) if (linux_to_imgui[sc])
g_state.io->KeysDown[sc] = true; ImGuiIO_AddKeyEvent(g_state.io, linux_to_imgui[sc], true);
} }
return; return;
} }
@ -365,7 +365,10 @@ void app_handleKeyPress(int sc, int charcode)
return; return;
if (purespice_keyDown(ps2)) if (purespice_keyDown(ps2))
g_state.keyDown[sc] = true; {
if (linux_to_imgui[sc])
ImGuiIO_AddKeyEvent(g_state.io, linux_to_imgui[sc], true);
}
else else
{ {
DEBUG_ERROR("app_handleKeyPress: failed to send message"); DEBUG_ERROR("app_handleKeyPress: failed to send message");
@ -391,8 +394,8 @@ void app_handleKeyRelease(int sc, int charcode)
if (app_isOverlayMode()) if (app_isOverlayMode())
{ {
if (sc < sizeof(g_state.io->KeysDown)) if (linux_to_imgui[sc])
g_state.io->KeysDown[sc] = false; ImGuiIO_AddKeyEvent(g_state.io, linux_to_imgui[sc], false);
return; return;
} }

View File

@ -22,6 +22,7 @@
#include "main.h" #include "main.h"
#include "app.h" #include "app.h"
#include "util.h" #include "util.h"
#include "kb.h"
#include "common/time.h" #include "common/time.h"
#include "common/debug.h" #include "common/debug.h"
@ -662,8 +663,9 @@ void core_resetOverlayInputState(void)
g_state.io->MouseDown[ImGuiMouseButton_Left ] = false; g_state.io->MouseDown[ImGuiMouseButton_Left ] = false;
g_state.io->MouseDown[ImGuiMouseButton_Right ] = false; g_state.io->MouseDown[ImGuiMouseButton_Right ] = false;
g_state.io->MouseDown[ImGuiMouseButton_Middle] = false; g_state.io->MouseDown[ImGuiMouseButton_Middle] = false;
for(int key = 0; key < ARRAY_LENGTH(g_state.io->KeysDown); key++) for(int key = ImGuiKey_NamedKey_BEGIN; key < ImGuiKey_NamedKey_END; key++)
g_state.io->KeysDown[key] = false; if (linux_to_imgui[key])
ImGuiIO_AddKeyEvent(g_state.io, linux_to_imgui[key], false);
} }
void core_updateOverlayState(void) void core_updateOverlayState(void)

View File

@ -411,28 +411,100 @@ const char * linux_to_display[KEY_MAX] =
[KEY_STOPCD] = "StopMedia", [KEY_STOPCD] = "StopMedia",
}; };
void initImGuiKeyMap(int * keymap) const int linux_to_imgui[KEY_MAX] =
{ {
keymap[ImGuiKey_Tab ] = KEY_TAB; [KEY_TAB ] = ImGuiKey_Tab,
keymap[ImGuiKey_LeftArrow ] = KEY_LEFT; [KEY_LEFT ] = ImGuiKey_LeftArrow,
keymap[ImGuiKey_RightArrow ] = KEY_RIGHT; [KEY_RIGHT ] = ImGuiKey_RightArrow,
keymap[ImGuiKey_UpArrow ] = KEY_UP; [KEY_UP ] = ImGuiKey_UpArrow,
keymap[ImGuiKey_DownArrow ] = KEY_DOWN; [KEY_DOWN ] = ImGuiKey_DownArrow,
keymap[ImGuiKey_PageUp ] = KEY_PAGEUP; [KEY_PAGEUP ] = ImGuiKey_PageUp,
keymap[ImGuiKey_PageDown ] = KEY_PAGEDOWN; [KEY_PAGEDOWN ] = ImGuiKey_PageDown,
keymap[ImGuiKey_Home ] = KEY_HOME; [KEY_HOME ] = ImGuiKey_Home,
keymap[ImGuiKey_End ] = KEY_END; [KEY_END ] = ImGuiKey_End,
keymap[ImGuiKey_Insert ] = KEY_INSERT; [KEY_INSERT ] = ImGuiKey_Insert,
keymap[ImGuiKey_Delete ] = KEY_DELETE; [KEY_DELETE ] = ImGuiKey_Delete,
keymap[ImGuiKey_Backspace ] = KEY_BACKSPACE; [KEY_BACKSPACE ] = ImGuiKey_Backspace,
keymap[ImGuiKey_Space ] = KEY_SPACE; [KEY_SPACE ] = ImGuiKey_Space,
keymap[ImGuiKey_Enter ] = KEY_ENTER; [KEY_ENTER ] = ImGuiKey_Enter,
keymap[ImGuiKey_Escape ] = KEY_SPACE; [KEY_0 ] = ImGuiKey_0,
keymap[ImGuiKey_KeypadEnter] = KEY_KPENTER; [KEY_1 ] = ImGuiKey_1,
keymap[ImGuiKey_A ] = KEY_A; [KEY_2 ] = ImGuiKey_2,
keymap[ImGuiKey_C ] = KEY_C; [KEY_3 ] = ImGuiKey_3,
keymap[ImGuiKey_V ] = KEY_V; [KEY_4 ] = ImGuiKey_4,
keymap[ImGuiKey_X ] = KEY_X; [KEY_5 ] = ImGuiKey_5,
keymap[ImGuiKey_Y ] = KEY_Y; [KEY_6 ] = ImGuiKey_6,
keymap[ImGuiKey_Z ] = KEY_Z; [KEY_7 ] = ImGuiKey_7,
} [KEY_8 ] = ImGuiKey_8,
[KEY_9 ] = ImGuiKey_9,
[KEY_A ] = ImGuiKey_A,
[KEY_B ] = ImGuiKey_B,
[KEY_C ] = ImGuiKey_C,
[KEY_D ] = ImGuiKey_D,
[KEY_E ] = ImGuiKey_E,
[KEY_F ] = ImGuiKey_F,
[KEY_G ] = ImGuiKey_G,
[KEY_H ] = ImGuiKey_H,
[KEY_I ] = ImGuiKey_I,
[KEY_J ] = ImGuiKey_J,
[KEY_K ] = ImGuiKey_K,
[KEY_L ] = ImGuiKey_L,
[KEY_M ] = ImGuiKey_M,
[KEY_N ] = ImGuiKey_N,
[KEY_O ] = ImGuiKey_O,
[KEY_P ] = ImGuiKey_P,
[KEY_Q ] = ImGuiKey_Q,
[KEY_R ] = ImGuiKey_R,
[KEY_S ] = ImGuiKey_S,
[KEY_T ] = ImGuiKey_T,
[KEY_U ] = ImGuiKey_U,
[KEY_V ] = ImGuiKey_V,
[KEY_W ] = ImGuiKey_W,
[KEY_X ] = ImGuiKey_X,
[KEY_Y ] = ImGuiKey_Y,
[KEY_Z ] = ImGuiKey_Z,
[KEY_F1 ] = ImGuiKey_F1,
[KEY_F2 ] = ImGuiKey_F2,
[KEY_F3 ] = ImGuiKey_F3,
[KEY_F4 ] = ImGuiKey_F4,
[KEY_F5 ] = ImGuiKey_F5,
[KEY_F6 ] = ImGuiKey_F6,
[KEY_F7 ] = ImGuiKey_F7,
[KEY_F8 ] = ImGuiKey_F8,
[KEY_F9 ] = ImGuiKey_F9,
[KEY_F10 ] = ImGuiKey_F10,
[KEY_F11 ] = ImGuiKey_F11,
[KEY_F12 ] = ImGuiKey_F12,
[KEY_APOSTROPHE] = ImGuiKey_Apostrophe,
[KEY_COMMA ] = ImGuiKey_Comma,
[KEY_MINUS ] = ImGuiKey_Minus,
[KEY_DOT ] = ImGuiKey_Period,
[KEY_SLASH ] = ImGuiKey_Slash,
[KEY_SEMICOLON ] = ImGuiKey_Semicolon,
[KEY_EQUAL ] = ImGuiKey_Equal,
[KEY_LEFTBRACE ] = ImGuiKey_LeftBracket,
[KEY_RIGHTBRACE] = ImGuiKey_RightBracket,
[KEY_GRAVE ] = ImGuiKey_GraveAccent,
[KEY_CAPSLOCK ] = ImGuiKey_CapsLock,
[KEY_SCROLLLOCK] = ImGuiKey_ScrollLock,
[KEY_NUMLOCK ] = ImGuiKey_NumLock,
[KEY_PRINT ] = ImGuiKey_PrintScreen,
[KEY_PAUSE ] = ImGuiKey_Pause,
[KEY_KP0 ] = ImGuiKey_Keypad0,
[KEY_KP1 ] = ImGuiKey_Keypad1,
[KEY_KP2 ] = ImGuiKey_Keypad2,
[KEY_KP3 ] = ImGuiKey_Keypad3,
[KEY_KP4 ] = ImGuiKey_Keypad4,
[KEY_KP5 ] = ImGuiKey_Keypad5,
[KEY_KP6 ] = ImGuiKey_Keypad6,
[KEY_KP7 ] = ImGuiKey_Keypad7,
[KEY_KP8 ] = ImGuiKey_Keypad8,
[KEY_KP9 ] = ImGuiKey_Keypad9,
[KEY_KPDOT ] = ImGuiKey_KeypadDecimal,
[KEY_KPSLASH ] = ImGuiKey_KeypadDivide,
[KEY_KPASTERISK] = ImGuiKey_KeypadMultiply,
[KEY_KPMINUS ] = ImGuiKey_KeypadSubtract,
[KEY_KPPLUS ] = ImGuiKey_KeypadAdd,
[KEY_KPENTER ] = ImGuiKey_KeypadEnter,
[KEY_KPEQUAL ] = ImGuiKey_KeypadEqual
};

View File

@ -31,7 +31,6 @@
extern const uint32_t linux_to_ps2[KEY_MAX]; extern const uint32_t linux_to_ps2[KEY_MAX];
extern const char * linux_to_str[KEY_MAX]; extern const char * linux_to_str[KEY_MAX];
extern const char * linux_to_display[KEY_MAX]; extern const char * linux_to_display[KEY_MAX];
extern const int linux_to_imgui[KEY_MAX];
void initImGuiKeyMap(int * keymap);
#endif #endif

View File

@ -1204,8 +1204,6 @@ static int lg_run(void)
overlayGraph_register("UPLOAD", g_state.uploadTimings , 0.0f, 50.0f, NULL); overlayGraph_register("UPLOAD", g_state.uploadTimings , 0.0f, 50.0f, NULL);
overlayGraph_register("RENDER", g_state.renderDuration, 0.0f, 10.0f, NULL); overlayGraph_register("RENDER", g_state.renderDuration, 0.0f, 10.0f, NULL);
initImGuiKeyMap(g_state.io->KeyMap);
// unknown guest OS at this time // unknown guest OS at this time
g_state.guestOS = KVMFR_OS_OTHER; g_state.guestOS = KVMFR_OS_OTHER;

View File

@ -198,7 +198,7 @@ static int graphs_render(void * udata, bool interactive,
} }
igPlotLines_FloatPtr( igPlotLines_FloatPtr(
"", "##",
(float *)ringbuffer_getValues(graph->buffer), (float *)ringbuffer_getValues(graph->buffer),
ringbuffer_getLength(graph->buffer), ringbuffer_getLength(graph->buffer),
ringbuffer_getStart (graph->buffer), ringbuffer_getStart (graph->buffer),

View File

@ -195,7 +195,7 @@ static int splash_render(void * udata, bool interactive, struct Rect * windowRec
ImDrawList_AddImage( ImDrawList_AddImage(
list, list,
l_logo.tex, (ImTextureID)l_logo.tex,
(ImVec2){ (ImVec2){
logoRect.x, logoRect.x,
logoRect.y logoRect.y

View File

@ -104,7 +104,7 @@ static int status_render(void * udata, bool interactive, struct Rect * windowRec
ImDrawList_AddImage( ImDrawList_AddImage(
igGetBackgroundDrawList_Nil(), igGetBackgroundDrawList_Nil(),
img->tex, (ImTextureID)img->tex,
(ImVec2){ (ImVec2){
xPos, xPos,
marginY marginY

@ -1 +1 @@
Subproject commit 261250f88f374e751b2de1501ba5c0c11e420b5a Subproject commit d6b4ecda718352bb4adcd30ec25784fd16538b73