[client] egl: use a ui switch for damage display instead of a keybind

This commit is contained in:
Geoffrey McRae 2021-08-05 00:55:51 +10:00
parent f3f0157d3c
commit 6c44bbb53e
3 changed files with 13 additions and 5 deletions

View File

@ -103,6 +103,9 @@ typedef struct OverlayGraph * GraphHandle;
GraphHandle app_registerGraph(const char * name, RingBuffer buffer, float min, float max);
void app_unregisterGraph(GraphHandle handle);
void app_overlayConfigRegister(const char * title,
void (*callback)(void * udata), void * udata);
void app_clipboardRelease(void);
void app_clipboardNotifyTypes(const LG_ClipboardData types[], int count);
void app_clipboardNotifySize(const LG_ClipboardData type, size_t size);

View File

@ -26,6 +26,7 @@
#include "app.h"
#include "desktop_rects.h"
#include "shader.h"
#include "cimgui.h"
#include <stdlib.h>
#include <string.h>
@ -41,7 +42,6 @@ struct EGL_Damage
GLfloat transform[6];
bool show;
KeybindHandle toggleHandle;
int width , height;
float translateX, translateY;
@ -52,10 +52,10 @@ struct EGL_Damage
GLint uTransform;
};
void egl_damage_show_toggle(int key, void * opaque)
void egl_damage_config_ui(void * opaque)
{
EGL_Damage * damage = opaque;
damage->show ^= true;
igCheckbox("Show damage overlay", &damage->show);
}
bool egl_damage_init(EGL_Damage ** damage)
@ -90,7 +90,7 @@ bool egl_damage_init(EGL_Damage ** damage)
}
(*damage)->uTransform = egl_shader_get_uniform_location((*damage)->shader, "transform");
(*damage)->toggleHandle = app_registerKeybind(KEY_A, egl_damage_show_toggle, *damage, "Toggle damage display");
app_overlayConfigRegister("EGL", egl_damage_config_ui, *damage);
return true;
}
@ -100,7 +100,6 @@ void egl_damage_free(EGL_Damage ** damage)
if (!*damage)
return;
app_releaseKeybind(&(*damage)->toggleHandle);
egl_desktopRectsFree(&(*damage)->mesh);
egl_shader_free(&(*damage)->shader);

View File

@ -860,3 +860,9 @@ void app_setOverlay(bool enable)
core_resetOverlayInputState();
}
}
void app_overlayConfigRegister(const char * title,
void (*callback)(void * udata), void * udata)
{
overlayConfig_register(title, callback, udata);
}