From: kub Date: Tue, 10 Sep 2024 20:30:54 +0000 (+0200) Subject: better support for resizable windows X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbbf5e3fc0aff858e206dd98ce4605b960d397cb;p=libpicofe.git better support for resizable windows --- diff --git a/plat.h b/plat.h index a5dfc79..8385d06 100644 --- a/plat.h +++ b/plat.h @@ -119,6 +119,7 @@ static __inline int plat_target_switch_layer(int which, int enable) } /* menu: enter (switch bpp, etc), begin/end drawing */ +void plat_video_menu_update(void); void plat_video_menu_enter(int is_rom_loaded); void plat_video_menu_begin(void); void plat_video_menu_end(void); diff --git a/plat_sdl.c b/plat_sdl.c index ff92c6a..f90827a 100644 --- a/plat_sdl.c +++ b/plat_sdl.c @@ -145,7 +145,8 @@ int plat_sdl_change_video_mode(int w, int h, int force) flags |= SDL_FULLSCREEN; win_w = fs_w; win_h = fs_h; - } + } else if (window_b) + flags |= SDL_RESIZABLE; SDL_PumpEvents(); @@ -174,12 +175,12 @@ void plat_sdl_event_handler(void *event_) switch (event->type) { case SDL_VIDEORESIZE: //printf("resize %dx%d\n", event->resize.w, event->resize.h); - if (plat_target.vout_method != 0 - && !plat_target.vout_fullscreen && !old_fullscreen) + if ((plat_target.vout_method != 0 || window_b) && + !plat_target.vout_fullscreen && !old_fullscreen) { window_w = event->resize.w & ~3; window_h = event->resize.h & ~3; - plat_sdl_change_video_mode(0, 0, 1); + plat_sdl_change_video_mode(window_w, window_h, 1); } break; case SDL_ACTIVEEVENT: @@ -378,4 +379,8 @@ void plat_sdl_overlay_clear(void) *dst = v; } +int plat_sdl_is_windowed(void) +{ + return window_b != 0; +} // vim:shiftwidth=2:expandtab diff --git a/plat_sdl.h b/plat_sdl.h index a953265..13e5197 100644 --- a/plat_sdl.h +++ b/plat_sdl.h @@ -7,6 +7,7 @@ extern void (*plat_sdl_resize_cb)(int w, int h); extern void (*plat_sdl_quit_cb)(void); int plat_sdl_init(void); +int plat_sdl_is_windowed(void); int plat_sdl_change_video_mode(int w, int h, int force); void plat_sdl_overlay_clear(void); void plat_sdl_event_handler(void *event_);