mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-22 10:50:15 -10:00
On top of the Chinese keyboard pages (pull request 19735): - The index page had 43 keys, the others 44. Copied into the grid by its size, it left the grid's last key as the page before had it - a character, or the next-page key - drawn and acting as that. It has 44 now: a blank before the house key. - i, u and v on the index have no page and did nothing when pressed. They are blank keys. - The menu's page triggers (L and R) and the next-page key stepped one page at a time through every value up to the last, so with the 64 Chinese values at the end, going round the keyboard's pages took 64 more steps, and L from the first page landed on the last page of z. Both go through one call now, input_osk_step(): round the Latin, symbol and other languages' pages and the Chinese index, and not through the pages of characters, which step among themselves - the index before the first and after the last, as before the only way from one page of an initial to the next. - A page of characters was 44 pointers to strings, 2,816 in all, each one a relocation where the program is loaded at an address of its own (Android, and every other position-independent build): fixed up at every start. Every character here is 3 bytes of UTF-8, so a page is one string of up to 30 now, and input_osk_chinese_grid() lays it out as the 4x11 grid - the digits and backspace on top, ten characters on each row below, return, the down arrow and the house at their ends - when the page is shown. The 63 identical cases that copied each page into the grid (380 lines) go. Built for x86-64 as position-independent code, the two files have 484 data relocations in place of 3,244, and are 24,136 bytes smaller. - The table's header named the machine path its text was counted from; it says what the table is instead. The script that counted the characters was not in the pull request. tools/osk_chinese_pages_check.py holds the table to what the code needs of it: a page for every value of the enum, in its order, each of at most 30 characters of 3 bytes, none on two pages; an index of 44 keys with an initial's key where it has pages and a blank where it has none. The frontend harness gains a lane: stepping on goes round every page once, by the index and through no page of characters; back from the first page is the index; the pages of characters step among themselves, the index at both ends; a page is laid out as the grid, blank past its last character; and the index laid out after a full page keeps nothing of it. Not run on a device: the keyboard has not been seen drawn, as it was not for the pull request.
174 lines
4.5 KiB
C
174 lines
4.5 KiB
C
/* RetroArch - A frontend for libretro.
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
|
* Copyright (C) 2011-2017 - Daniel De Matteis
|
|
*
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
*
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef _INPUT_OSK_H
|
|
#define _INPUT_OSK_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
|
|
#include <boolean.h>
|
|
|
|
#include <retro_common_api.h>
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include "../../config.h"
|
|
#endif
|
|
|
|
#define OSK_CHARS_PER_LINE 11
|
|
|
|
RETRO_BEGIN_DECLS
|
|
|
|
enum osk_type
|
|
{
|
|
OSK_TYPE_UNKNOWN = 0U,
|
|
OSK_LOWERCASE_LATIN,
|
|
OSK_UPPERCASE_LATIN,
|
|
OSK_SYMBOLS_PAGE1,
|
|
#ifdef HAVE_LANGEXTRA
|
|
OSK_HIRAGANA_PAGE1,
|
|
OSK_HIRAGANA_PAGE2,
|
|
OSK_KATAKANA_PAGE1,
|
|
OSK_KATAKANA_PAGE2,
|
|
OSK_KOREAN_PAGE1,
|
|
/* One value per Chinese key page: the pinyin initial index page, then
|
|
* every page of every initial, in the order of chinese_osk_pages.h.
|
|
* A value here is the page selector - it is what the next-page key,
|
|
* the menu's page triggers and the grid switch all step through - so
|
|
* an initial with more than one page needs more than one value.
|
|
* i, u and v have no page: no game title uses them as an initial. */
|
|
OSK_CHINESE_INDEX,
|
|
OSK_CHINESE_A_1,
|
|
OSK_CHINESE_B_1,
|
|
OSK_CHINESE_B_2,
|
|
OSK_CHINESE_B_3,
|
|
OSK_CHINESE_C_1,
|
|
OSK_CHINESE_C_2,
|
|
OSK_CHINESE_C_3,
|
|
OSK_CHINESE_D_1,
|
|
OSK_CHINESE_D_2,
|
|
OS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E_Z_5,
|
|
#endif
|
|
OSK_TYPE_LAST
|
|
};
|
|
|
|
/* The page after (@dir > 0) or before (@dir < 0) a page of the
|
|
* keyboard, as its next-page key and the menu's page triggers step. */
|
|
enum osk_type input_osk_step(enum osk_type osk_idx, int dir,
|
|
bool show_symbol_pages);
|
|
|
|
#ifdef HAVE_LANGEXTRA
|
|
/* A Chinese page laid out in @grid, 44 keys. */
|
|
void input_osk_chinese_grid(char **grid, enum osk_type osk_idx);
|
|
#endif
|
|
|
|
void input_event_osk_append(
|
|
input_keyboard_line_t *keyboard_line,
|
|
enum osk_type *osk_idx,
|
|
unsigned *osk_last_codepoint,
|
|
unsigned *osk_last_codepoint_len,
|
|
int ptr,
|
|
bool show_symbol_pages,
|
|
const char *word,
|
|
size_t len);
|
|
|
|
/**
|
|
* input_osk_native_active:
|
|
*
|
|
* Whether a system-provided keyboard panel (platform IME, Steam OSK,
|
|
* ...) is currently on screen and owns text entry.
|
|
*
|
|
* While this is true the frontend must not draw its own on-screen
|
|
* keyboard over the top of it, and must not feed the keyboard line
|
|
* from the OSK grid: the native panel is already doing both.
|
|
*
|
|
* @return true if a native keyboard panel is up.
|
|
**/
|
|
bool input_osk_native_active(void);
|
|
|
|
/**
|
|
* input_osk_native_available:
|
|
*
|
|
* Whether this device offers a native keyboard panel at all, whether
|
|
* or not one is on screen right now. Menu code uses this to decide
|
|
* if offering the choice between the two keyboards makes sense.
|
|
*
|
|
* @return true if a native keyboard panel could be shown.
|
|
**/
|
|
bool input_osk_native_available(void);
|
|
|
|
void osk_update_last_codepoint(
|
|
unsigned *last_codepoint,
|
|
unsigned *last_codepoint_len,
|
|
const char *word);
|
|
|
|
RETRO_END_DECLS
|
|
|
|
#endif
|