Skip to content

Commit

Permalink
Add menu item "Video/Center window"
Browse files Browse the repository at this point in the history
Makes one's life much simpler now.
  • Loading branch information
aybe committed Jul 4, 2024
1 parent 964b99c commit 8bb92ab
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
NEXT
- fix off-center and off-screen window after entering the
configuration tool while using TTF output mode (aybe).
- add menu item for centering window "Video/Center window" (aybe).
2024.07.01
- Correct Hercules InColor memory emulation. Read and write planar
behavior was incorrect due to a misunderstanding of available
Expand Down
1 change: 1 addition & 0 deletions src/gui/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ static const char *def_menu_video[] =
#endif
"VideoRatioMenu",
"mapper_aspratio",
"center_window",
#if !defined(C_SDL2) && defined(MACOSX)
"highdpienable",
#endif
Expand Down
10 changes: 10 additions & 0 deletions src/gui/menu_callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2071,6 +2071,13 @@ bool vsync_set_syncrate_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item *
return true;
}

bool center_window_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * const menuitem) {
(void)menu;//UNUSED
(void)menuitem;//UNUSED
SDL_SetWindowPosition(sdl.window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
return true;
}

bool set_titletext_menu_callback(DOSBoxMenu * const menu,DOSBoxMenu::item * const menuitem) {
(void)menu;//UNUSED
(void)menuitem;//UNUSED
Expand Down Expand Up @@ -3198,6 +3205,9 @@ void AllocCallback1() {
set_callback_function(scaler_set_menu_callback);
}

mainMenu.alloc_item(DOSBoxMenu::item_type_id,"center_window").set_text("Center window").
set_callback_function(center_window_menu_callback);

mainMenu.alloc_item(DOSBoxMenu::item_type_id,"set_titletext").set_text("Set title bar text...").
set_callback_function(set_titletext_menu_callback);

Expand Down

0 comments on commit 8bb92ab

Please sign in to comment.