mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Show normal mouse cursor when DJUI panels are closed
This commit is contained in:
parent
33c82b7514
commit
95fa0c626e
5 changed files with 35 additions and 4 deletions
|
|
@ -1,6 +1,8 @@
|
|||
#include "djui.h"
|
||||
#include "pc/controller/controller_mouse.h"
|
||||
#include "pc/controller/controller_sdl.h"
|
||||
#include "pc/gfx/gfx_window_manager_api.h"
|
||||
#include "pc/pc_main.h"
|
||||
|
||||
extern ALIGNED8 u8 gd_texture_hand_open[];
|
||||
extern ALIGNED8 u8 gd_texture_hand_closed[];
|
||||
|
|
@ -19,6 +21,12 @@ void djui_cursor_set_visible(bool visible) {
|
|||
if (sMouseCursor) {
|
||||
djui_base_set_visible(&sMouseCursor->base, visible);
|
||||
}
|
||||
|
||||
if (configWindow.fullscreen) {
|
||||
wm_api->set_cursor_visible(false);
|
||||
} else {
|
||||
wm_api->set_cursor_visible(!visible);
|
||||
}
|
||||
sSavedMouseX = mouse_window_x;
|
||||
sSavedMouseY = mouse_window_y;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -353,7 +353,9 @@ static void gfx_dxgi_init(const char *window_title) {
|
|||
|
||||
ShowWindow(dxgi.h_wnd, SW_SHOW);
|
||||
UpdateWindow(dxgi.h_wnd);
|
||||
if (configWindow.fullscreen) {
|
||||
ShowCursor(FALSE);
|
||||
}
|
||||
|
||||
update_screen_settings();
|
||||
}
|
||||
|
|
@ -648,6 +650,8 @@ void gfx_dxgi_set_clipboard_text(char* text) {
|
|||
}
|
||||
}
|
||||
|
||||
void gfx_dxgi_set_cursor_visible(bool visible) { ShowCursor(visible); }
|
||||
|
||||
void ThrowIfFailed(HRESULT res) {
|
||||
if (FAILED(res)) {
|
||||
fprintf(stderr, "Error: 0x%08X\n", res);
|
||||
|
|
@ -680,6 +684,7 @@ struct GfxWindowManagerAPI gfx_dxgi = {
|
|||
gfx_dxgi_stop_text_input,
|
||||
gfx_dxgi_get_clipboard_text,
|
||||
gfx_dxgi_set_clipboard_text,
|
||||
gfx_dxgi_set_cursor_visible,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -156,7 +156,9 @@ static void gfx_sdl_init(const char *window_title) {
|
|||
|
||||
gfx_sdl_set_mode();
|
||||
|
||||
if (configWindow.fullscreen) {
|
||||
SDL_ShowCursor(0);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < sizeof(windows_scancode_table) / sizeof(SDLKey); i++) {
|
||||
inverted_scancode_table[windows_scancode_table[i]] = i;
|
||||
|
|
@ -264,6 +266,12 @@ static void gfx_sdl_shutdown(void) {
|
|||
SDL_Quit();
|
||||
}
|
||||
|
||||
static void gfx_sdl_start_text_input(void) { SDL_StartTextInput(); }
|
||||
static void gfx_sdl_stop_text_input(void) { SDL_StopTextInput(); }
|
||||
static char* gfx_sdl_get_clipboard_text(void) { return SDL_GetClipboardText(); }
|
||||
static void gfx_sdl_set_clipboard_text(char* text) { SDL_SetClipboardText(text); }
|
||||
static void gfx_sdl_set_cursor_visible(bool visible) { SDL_ShowCursor(visible ? SDL_ENABLE : SDL_DISABLE); }
|
||||
|
||||
struct GfxWindowManagerAPI gfx_sdl = {
|
||||
gfx_sdl_init,
|
||||
gfx_sdl_set_keyboard_callbacks,
|
||||
|
|
@ -274,7 +282,12 @@ struct GfxWindowManagerAPI gfx_sdl = {
|
|||
gfx_sdl_swap_buffers_begin,
|
||||
gfx_sdl_swap_buffers_end,
|
||||
gfx_sdl_get_time,
|
||||
gfx_sdl_shutdown
|
||||
gfx_sdl_shutdown,
|
||||
gfx_sdl_start_text_input,
|
||||
gfx_sdl_stop_text_input,
|
||||
gfx_sdl_get_clipboard_text,
|
||||
gfx_sdl_set_clipboard_text,
|
||||
gfx_sdl_set_cursor_visible,
|
||||
};
|
||||
|
||||
#endif // BACKEND_WM
|
||||
|
|
|
|||
|
|
@ -226,7 +226,9 @@ static void gfx_sdl_init(const char *window_title) {
|
|||
gfx_sdl_set_vsync(configWindow.vsync);
|
||||
|
||||
gfx_sdl_set_fullscreen();
|
||||
if (configWindow.fullscreen) {
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < sizeof(windows_scancode_table) / sizeof(SDL_Scancode); i++) {
|
||||
inverted_scancode_table[windows_scancode_table[i]] = i;
|
||||
|
|
@ -370,6 +372,7 @@ static void gfx_sdl_start_text_input(void) { SDL_StartTextInput(); }
|
|||
static void gfx_sdl_stop_text_input(void) { SDL_StopTextInput(); }
|
||||
static char* gfx_sdl_get_clipboard_text(void) { return SDL_GetClipboardText(); }
|
||||
static void gfx_sdl_set_clipboard_text(char* text) { SDL_SetClipboardText(text); }
|
||||
static void gfx_sdl_set_cursor_visible(bool visible) { SDL_ShowCursor(visible ? SDL_ENABLE : SDL_DISABLE); }
|
||||
|
||||
struct GfxWindowManagerAPI gfx_sdl = {
|
||||
gfx_sdl_init,
|
||||
|
|
@ -386,6 +389,7 @@ struct GfxWindowManagerAPI gfx_sdl = {
|
|||
gfx_sdl_stop_text_input,
|
||||
gfx_sdl_get_clipboard_text,
|
||||
gfx_sdl_set_clipboard_text,
|
||||
gfx_sdl_set_cursor_visible,
|
||||
};
|
||||
|
||||
#endif // BACKEND_WM
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ struct GfxWindowManagerAPI {
|
|||
void (*stop_text_input)(void);
|
||||
char* (*get_clipboard_text)(void);
|
||||
void (*set_clipboard_text)(char*);
|
||||
void (*set_cursor_visible)(bool);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue