Font search

Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
2025-10-05 05:42:05 +03:00
parent 1414a66e56
commit 59acba3264
6 changed files with 603 additions and 545 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -41,7 +41,7 @@ private:
auto init_signal() -> void;
auto init_theme_portal() -> void;
auto pump_events() -> void;
auto render_frame() -> void;
auto tick() -> void;
auto create_layer_surface() -> void;
auto destroy_layer_surface() -> void;
auto ensure_egl_surface() -> void;
@@ -60,7 +60,7 @@ private:
wl_compositor *compositor {};
wl_seat *seat {};
wl_keyboard *kbd {};
wl_surface *wl_surface {};
wl_surface *surface {};
zwlr_layer_shell_v1 *layer_shell {};
zwlr_layer_surface_v1 *layer_surface {};
ext_background_effect_manager_v1 *mgr {};
@@ -85,9 +85,9 @@ private:
struct {
TypingBuffer typing {};
xkb_context *xkb_ctx {};
xkb_keymap *xkb_keymap {};
xkb_state *xkb_state {};
xkb_context *xkb_ctx_v {};
xkb_keymap *xkb_keymap_v {};
xkb_state *xkb_state_v {};
std::unordered_set<u32> held;
std::unordered_set<u32> pressed_syms;
@@ -100,11 +100,11 @@ private:
auto is_down_sym(xkb_keysym_t sym) const -> bool
{
if (!xkb_state)
if (!xkb_state_v)
return false;
for (auto k : held) {
if (xkb_state_key_get_one_sym(
xkb_state, static_cast<xkb_keycode_t>(k + 8))
xkb_state_v, static_cast<xkb_keycode_t>(k + 8))
== sym)
return true;
}
@@ -123,9 +123,9 @@ private:
auto mod_active(char const *name) const -> bool
{
return xkb_state
return xkb_state_v
&& xkb_state_mod_name_is_active(
xkb_state, name, XKB_STATE_MODS_EFFECTIVE)
xkb_state_v, name, XKB_STATE_MODS_EFFECTIVE)
> 0;
}

View File

@@ -1,39 +0,0 @@
#include "App.hpp"
#include <EGL/egl.h>
#include <GLES3/gl3.h>
#include <print>
#include <raylib.h>
#include <rlgl.h>
#include <xkbcommon/xkbcommon.h>
auto App::render_frame() -> void {
if (!m_visible || m_gl.edpy == EGL_NO_DISPLAY || m_gl.esurf == EGL_NO_SURFACE)
return;
glViewport(0, 0, m_win_w, m_win_h);
for (auto const cp : m_kbd.typing) {
std::println("Char typed: {} ({}) shift={} ctrl={}", rune_to_string(cp), cp,
m_kbd.shift() ? 'y' : 'n', m_kbd.ctrl() ? 'y' : 'n');
}
if (m_kbd.is_sym_pressed(XKB_KEY_Escape)) {
set_visible(!visible());
if (m_kbd.ctrl() && m_kbd.shift()) {
m_running = false;
}
}
BeginDrawing();
ClearBackground(BLANK);
DrawFPS(10, 10);
EndDrawing();
eglSwapBuffers(m_gl.edpy, m_gl.esurf);
m_kbd.typing.clear();
m_kbd.clear_transients();
}

42
src/Tick.cpp Normal file
View File

@@ -0,0 +1,42 @@
#include "App.hpp"
#include <EGL/egl.h>
#include <GLES3/gl3.h>
#include <print>
#include <raylib.h>
#include <rlgl.h>
#include <xkbcommon/xkbcommon.h>
auto App::tick() -> void
{
if (!m_visible || m_gl.edpy == EGL_NO_DISPLAY
|| m_gl.esurf == EGL_NO_SURFACE)
return;
glViewport(0, 0, m_win_w, m_win_h);
for (auto const cp : m_kbd.typing) {
std::println("Char typed: {} ({}) shift={} ctrl={}",
rune_to_string(cp), cp, m_kbd.shift() ? 'y' : 'n',
m_kbd.ctrl() ? 'y' : 'n');
}
if (m_kbd.is_sym_pressed(XKB_KEY_Escape)) {
set_visible(!visible());
if (m_kbd.ctrl() && m_kbd.shift()) {
m_running = false;
}
}
BeginDrawing();
ClearBackground(BLANK);
DrawFPS(10, 10);
EndDrawing();
eglSwapBuffers(m_gl.edpy, m_gl.esurf);
m_kbd.typing.clear();
m_kbd.clear_transients();
}