1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-08 12:15:49 +00:00

(Menu) Split up keyboard input line cb code to separate file - menu_input_line_cb

This commit is contained in:
twinaphex 2014-03-02 05:24:57 +01:00
parent 23489132b3
commit 6f19662d75
9 changed files with 75 additions and 31 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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;

View File

@ -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;

View 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);
}
}

View 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

View File

@ -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"