mirror of
https://github.com/libretro/RetroArch
synced 2025-04-15 23:42:30 +00:00
(Menu) Split up keyboard input line cb code to separate file - menu_input_line_cb
This commit is contained in:
parent
23489132b3
commit
6f19662d75
2
Makefile
2
Makefile
@ -95,7 +95,7 @@ ifneq ($(findstring Linux,$(OS)),)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RGUI), 1)
|
||||
OBJ += frontend/menu/menu_common.o frontend/menu/menu_navigation.o frontend/menu/menu_settings.o frontend/menu/menu_context.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_navigation.o frontend/menu/menu_settings.o frontend/menu/menu_context.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||
DEFINES += -DHAVE_MENU
|
||||
ifeq ($(HAVE_LAKKA), 1)
|
||||
OBJ += frontend/menu/disp/lakka.o
|
||||
|
@ -70,7 +70,7 @@ endif
|
||||
|
||||
ifeq ($(HAVE_RGUI), 1)
|
||||
DEFINES += -DHAVE_MENU -DHAVE_RGUI
|
||||
OBJ += frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_navigation.o frontend/menu/menu_context.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_navigation.o frontend/menu/menu_context.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SDL), 1)
|
||||
|
@ -114,7 +114,7 @@ JLIBS =
|
||||
|
||||
ifeq ($(HAVE_RGUI), 1)
|
||||
DEFINES += -DHAVE_RGUI -DHAVE_MENU
|
||||
OBJ += frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_navigation.o frontend/menu/menu_context.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_navigation.o frontend/menu/menu_context.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SDL), 1)
|
||||
|
@ -24,6 +24,7 @@
|
||||
frontend_ctx_driver_t *frontend_ctx;
|
||||
|
||||
#if defined(HAVE_MENU)
|
||||
#include "menu/menu_input_line_cb.h"
|
||||
#include "menu/menu_common.h"
|
||||
#endif
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "../../file.h"
|
||||
#include "../../file_ext.h"
|
||||
#include "../../input/input_common.h"
|
||||
#include "../../input/keyboard_line.h"
|
||||
|
||||
#include "../../compat/posix_string.h"
|
||||
|
||||
@ -1736,31 +1735,6 @@ bool menu_poll_find_trigger(struct rgui_bind_state *state, struct rgui_bind_stat
|
||||
return false;
|
||||
}
|
||||
|
||||
static void menu_search_callback(void *userdata, const char *str)
|
||||
{
|
||||
rgui_handle_t *rgui = (rgui_handle_t*)userdata;
|
||||
|
||||
if (str && *str)
|
||||
file_list_search(rgui->selection_buf, str, &rgui->selection_ptr);
|
||||
rgui->keyboard.display = false;
|
||||
rgui->keyboard.label = NULL;
|
||||
rgui->old_input_state = -1ULL; // Avoid triggering states on pressing return.
|
||||
}
|
||||
|
||||
void menu_key_event(bool down, unsigned keycode, uint32_t character, uint16_t mod)
|
||||
{
|
||||
(void)down;
|
||||
(void)keycode;
|
||||
(void)mod;
|
||||
|
||||
if (character == '/')
|
||||
{
|
||||
rgui->keyboard.display = true;
|
||||
rgui->keyboard.label = "Search:";
|
||||
rgui->keyboard.buffer = input_keyboard_start_line(rgui, menu_search_callback);
|
||||
}
|
||||
}
|
||||
|
||||
static inline int menu_list_get_first_char(file_list_t *buf, unsigned offset)
|
||||
{
|
||||
const char *path = NULL;
|
||||
|
@ -441,8 +441,6 @@ void menu_set_settings_label(char *type_str, size_t type_str_size, unsigned *w,
|
||||
void menu_populate_entries(void *data, unsigned menu_type);
|
||||
unsigned menu_type_is(unsigned type);
|
||||
|
||||
void menu_key_event(bool down, unsigned keycode, uint32_t character, uint16_t key_modifiers);
|
||||
|
||||
uint64_t menu_input(void);
|
||||
|
||||
extern const menu_ctx_driver_t *menu_ctx;
|
||||
|
48
frontend/menu/menu_input_line_cb.c
Normal file
48
frontend/menu/menu_input_line_cb.c
Normal file
@ -0,0 +1,48 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - 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/>.
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
#include "menu_common.h"
|
||||
#include "../../input/keyboard_line.h"
|
||||
|
||||
static void menu_search_callback(void *userdata, const char *str)
|
||||
{
|
||||
rgui_handle_t *rgui = (rgui_handle_t*)userdata;
|
||||
|
||||
if (str && *str)
|
||||
file_list_search(rgui->selection_buf, str, &rgui->selection_ptr);
|
||||
rgui->keyboard.display = false;
|
||||
rgui->keyboard.label = NULL;
|
||||
rgui->old_input_state = -1ULL; // Avoid triggering states on pressing return.
|
||||
}
|
||||
|
||||
void menu_key_event(bool down, unsigned keycode, uint32_t character, uint16_t mod)
|
||||
{
|
||||
(void)down;
|
||||
(void)keycode;
|
||||
(void)mod;
|
||||
|
||||
if (character == '/')
|
||||
{
|
||||
rgui->keyboard.display = true;
|
||||
rgui->keyboard.label = "Search:";
|
||||
rgui->keyboard.buffer = input_keyboard_start_line(rgui, menu_search_callback);
|
||||
}
|
||||
}
|
22
frontend/menu/menu_input_line_cb.h
Normal file
22
frontend/menu/menu_input_line_cb.h
Normal file
@ -0,0 +1,22 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - 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 _MENU_INPUT_LINE_CB_H
|
||||
#define _MENU_INPUT_LINE_CB_H
|
||||
|
||||
void menu_key_event(bool down, unsigned keycode, uint32_t character, uint16_t key_modifiers);
|
||||
|
||||
#endif
|
@ -571,6 +571,7 @@ SCREENSHOTS
|
||||
MENU
|
||||
============================================================ */
|
||||
#ifdef HAVE_MENU
|
||||
#include "../frontend/menu/menu_input_line.c"
|
||||
#include "../frontend/menu/menu_common.c"
|
||||
#include "../frontend/menu/menu_navigation.c"
|
||||
#include "../frontend/menu/menu_context.c"
|
||||
|
Loading…
x
Reference in New Issue
Block a user