mirror of
https://github.com/libretro/RetroArch
synced 2025-02-11 15:40:28 +00:00
Can now toggle fullscreen, use quit key from menu (mouse grab
toggle doesn't work yet)
This commit is contained in:
parent
2cd82ff2c2
commit
6235a5cd0d
@ -28,13 +28,18 @@
|
|||||||
|
|
||||||
#include "menu_event.h"
|
#include "menu_event.h"
|
||||||
|
|
||||||
|
#include "content.h"
|
||||||
#include "menu_driver.h"
|
#include "menu_driver.h"
|
||||||
#include "menu_input.h"
|
#include "menu_input.h"
|
||||||
#include "menu_animation.h"
|
#include "menu_animation.h"
|
||||||
#include "menu_display.h"
|
#include "menu_display.h"
|
||||||
#include "menu_navigation.h"
|
#include "menu_navigation.h"
|
||||||
|
|
||||||
|
#include "widgets/menu_dialog.h"
|
||||||
|
|
||||||
#include "../configuration.h"
|
#include "../configuration.h"
|
||||||
|
#include "../retroarch.h"
|
||||||
|
#include "../runloop.h"
|
||||||
|
|
||||||
static bool menu_keyboard_key_state[RETROK_LAST];
|
static bool menu_keyboard_key_state[RETROK_LAST];
|
||||||
|
|
||||||
@ -214,6 +219,15 @@ unsigned menu_event(uint64_t input, uint64_t trigger_input)
|
|||||||
{
|
{
|
||||||
switch ((enum retro_key)i)
|
switch ((enum retro_key)i)
|
||||||
{
|
{
|
||||||
|
case RETROK_ESCAPE:
|
||||||
|
BIT32_SET(trigger_input, RARCH_QUIT_KEY);
|
||||||
|
break;
|
||||||
|
case RETROK_f:
|
||||||
|
BIT32_SET(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY);
|
||||||
|
break;
|
||||||
|
case RETROK_F11:
|
||||||
|
BIT32_SET(trigger_input, RARCH_GRAB_MOUSE_TOGGLE);
|
||||||
|
break;
|
||||||
case RETROK_PAGEUP:
|
case RETROK_PAGEUP:
|
||||||
BIT32_SET(trigger_input, settings->menu_scroll_up_btn);
|
BIT32_SET(trigger_input, settings->menu_scroll_up_btn);
|
||||||
break;
|
break;
|
||||||
@ -277,6 +291,40 @@ unsigned menu_event(uint64_t input, uint64_t trigger_input)
|
|||||||
else if (trigger_input & (UINT64_C(1) << RARCH_MENU_TOGGLE))
|
else if (trigger_input & (UINT64_C(1) << RARCH_MENU_TOGGLE))
|
||||||
ret = MENU_ACTION_TOGGLE;
|
ret = MENU_ACTION_TOGGLE;
|
||||||
|
|
||||||
|
if (runloop_cmd_triggered(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY))
|
||||||
|
command_event(CMD_EVENT_FULLSCREEN_TOGGLE, NULL);
|
||||||
|
|
||||||
|
if (runloop_cmd_triggered(trigger_input, RARCH_GRAB_MOUSE_TOGGLE))
|
||||||
|
command_event(CMD_EVENT_GRAB_MOUSE_TOGGLE, NULL);
|
||||||
|
|
||||||
|
if (runloop_cmd_press(trigger_input, RARCH_QUIT_KEY))
|
||||||
|
{
|
||||||
|
int should_we_quit = true;
|
||||||
|
|
||||||
|
if (!runloop_is_quit_confirm())
|
||||||
|
{
|
||||||
|
if (settings && settings->confirm_on_exit)
|
||||||
|
{
|
||||||
|
if (menu_dialog_is_active())
|
||||||
|
should_we_quit = false;
|
||||||
|
else if (content_is_inited())
|
||||||
|
{
|
||||||
|
if(menu_display_toggle_get_reason() != MENU_TOGGLE_REASON_USER)
|
||||||
|
menu_display_toggle_set_reason(MENU_TOGGLE_REASON_MESSAGE);
|
||||||
|
rarch_ctl(RARCH_CTL_MENU_RUNNING, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
menu_dialog_show_message(MENU_DIALOG_QUIT_CONFIRM, MENU_ENUM_LABEL_CONFIRM_ON_EXIT);
|
||||||
|
|
||||||
|
should_we_quit = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((settings && !settings->confirm_on_exit) ||
|
||||||
|
should_we_quit)
|
||||||
|
return MENU_ACTION_QUIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mouse_enabled = settings->menu.mouse.enable;
|
mouse_enabled = settings->menu.mouse.enable;
|
||||||
#ifdef HAVE_OVERLAY
|
#ifdef HAVE_OVERLAY
|
||||||
if (!mouse_enabled)
|
if (!mouse_enabled)
|
||||||
|
@ -42,7 +42,8 @@ enum menu_action
|
|||||||
MENU_ACTION_SCROLL_UP,
|
MENU_ACTION_SCROLL_UP,
|
||||||
MENU_ACTION_TOGGLE,
|
MENU_ACTION_TOGGLE,
|
||||||
MENU_ACTION_POINTER_MOVED,
|
MENU_ACTION_POINTER_MOVED,
|
||||||
MENU_ACTION_POINTER_PRESSED
|
MENU_ACTION_POINTER_PRESSED,
|
||||||
|
MENU_ACTION_QUIT
|
||||||
};
|
};
|
||||||
|
|
||||||
enum menu_input_pointer_state
|
enum menu_input_pointer_state
|
||||||
|
35
runloop.c
35
runloop.c
@ -88,16 +88,20 @@
|
|||||||
#define DEFAULT_EXT ""
|
#define DEFAULT_EXT ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define runloop_cmd_triggered(trigger_input, id) (BIT64_GET(trigger_input, id))
|
|
||||||
|
|
||||||
#define runloop_cmd_press(current_input, id) BIT64_GET(current_input, id)
|
|
||||||
#define runloop_cmd_pressed(old_input, id) BIT64_GET(old_input, id)
|
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
#define runloop_cmd_menu_press(current_input, old_input, trigger_input) (BIT64_GET(trigger_input, RARCH_MENU_TOGGLE) || \
|
#define runloop_cmd_menu_press(current_input, old_input, trigger_input) (BIT64_GET(trigger_input, RARCH_MENU_TOGGLE) || runloop_cmd_get_state_menu_toggle_button_combo(settings, current_input, old_input, trigger_input))
|
||||||
runloop_cmd_get_state_menu_toggle_button_combo( \
|
|
||||||
settings, current_input, old_input, trigger_input))
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
enum runloop_state
|
||||||
|
{
|
||||||
|
RUNLOOP_STATE_NONE = 0,
|
||||||
|
RUNLOOP_STATE_ITERATE,
|
||||||
|
RUNLOOP_STATE_SLEEP,
|
||||||
|
RUNLOOP_STATE_MENU_ITERATE,
|
||||||
|
RUNLOOP_STATE_END,
|
||||||
|
RUNLOOP_STATE_QUIT
|
||||||
|
};
|
||||||
|
|
||||||
static rarch_system_info_t runloop_system;
|
static rarch_system_info_t runloop_system;
|
||||||
static struct retro_frame_time_callback runloop_frame_time;
|
static struct retro_frame_time_callback runloop_frame_time;
|
||||||
static retro_keyboard_event_t runloop_key_event = NULL;
|
static retro_keyboard_event_t runloop_key_event = NULL;
|
||||||
@ -720,16 +724,6 @@ void runloop_set_quit_confirm(bool on)
|
|||||||
runloop_quit_confirm = on;
|
runloop_quit_confirm = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum runloop_state
|
|
||||||
{
|
|
||||||
RUNLOOP_STATE_NONE = 0,
|
|
||||||
RUNLOOP_STATE_ITERATE,
|
|
||||||
RUNLOOP_STATE_SLEEP,
|
|
||||||
RUNLOOP_STATE_MENU_ITERATE,
|
|
||||||
RUNLOOP_STATE_END,
|
|
||||||
RUNLOOP_STATE_QUIT
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Time to exit out of the main loop?
|
/* Time to exit out of the main loop?
|
||||||
* Reasons for exiting:
|
* Reasons for exiting:
|
||||||
* a) Shutdown environment callback was invoked.
|
* a) Shutdown environment callback was invoked.
|
||||||
@ -801,6 +795,10 @@ static INLINE int runloop_iterate_time_to_exit(bool quit_key_pressed)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void runloop_external_state_checks(uint64_t trigger_input)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static enum runloop_state runloop_check_state(
|
static enum runloop_state runloop_check_state(
|
||||||
settings_t *settings,
|
settings_t *settings,
|
||||||
uint64_t current_input,
|
uint64_t current_input,
|
||||||
@ -899,6 +897,9 @@ static enum runloop_state runloop_check_state(
|
|||||||
|
|
||||||
if (!focused)
|
if (!focused)
|
||||||
return RUNLOOP_STATE_SLEEP;
|
return RUNLOOP_STATE_SLEEP;
|
||||||
|
|
||||||
|
if (action == MENU_ACTION_QUIT)
|
||||||
|
return RUNLOOP_STATE_QUIT;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -26,6 +26,11 @@
|
|||||||
|
|
||||||
#include "input/input_defines.h"
|
#include "input/input_defines.h"
|
||||||
|
|
||||||
|
#define runloop_cmd_triggered(trigger_input, id) (BIT64_GET(trigger_input, id))
|
||||||
|
|
||||||
|
#define runloop_cmd_press(current_input, id) (BIT64_GET(current_input, id))
|
||||||
|
#define runloop_cmd_pressed(old_input, id) (BIT64_GET(old_input, id))
|
||||||
|
|
||||||
RETRO_BEGIN_DECLS
|
RETRO_BEGIN_DECLS
|
||||||
|
|
||||||
enum runloop_ctl_state
|
enum runloop_ctl_state
|
||||||
|
Loading…
x
Reference in New Issue
Block a user