diff --git a/code/__DEFINES/keybinding.dm b/code/__DEFINES/keybinding.dm index 97b9c9d82aad..50a16edc350a 100644 --- a/code/__DEFINES/keybinding.dm +++ b/code/__DEFINES/keybinding.dm @@ -31,6 +31,7 @@ #define COMSIG_KB_CLIENT_GETHELP_DOWN "keybinding_client_gethelp_down" #define COMSIG_KB_CLIENT_SCREENSHOT_DOWN "keybinding_client_screenshot_down" #define COMSIG_KB_CLIENT_MINIMALHUD_DOWN "keybinding_client_minimalhud_down" +#define COMSIG_KB_CLIENT_FULLSCREEN_DOWN "keybinding_client_fullscreen_down" //Communication #define COMSIG_KB_CLIENT_OOC_DOWN "keybinding_client_ooc_down" diff --git a/code/datums/keybinding/client.dm b/code/datums/keybinding/client.dm index e4b940c7f722..3e78c4ac4c23 100644 --- a/code/datums/keybinding/client.dm +++ b/code/datums/keybinding/client.dm @@ -45,3 +45,39 @@ return user.mob.button_pressed_F12() return TRUE + +/client + var/fullscreen = FALSE +/datum/keybinding/client/t_fullscreen + hotkey_keys = list("F11") + name = "change_fullscreen" + full_name = "Toggle Fullscreen" + description = "Change window to Fullscreen or back" + keybind_signal = COMSIG_KB_CLIENT_FULLSCREEN_DOWN + +/datum/keybinding/client/t_fullscreen/down(client/C) + . = ..() + C.toggle_fullscreen() + + +/client/verb/toggle_fullscreen() + set name = "Toggle Fullscreen" + set category = "OOC" + + fullscreen = !fullscreen + + if (fullscreen) + winset(usr, "mainwindow", "on-size=") + winset(usr, "mainwindow", "titlebar=false") + winset(usr, "mainwindow", "can-resize=false") + winset(usr, "mainwindow", "menu=") + winset(usr, "mainwindow", "is-maximized=false") + winset(usr, "mainwindow", "is-maximized=true") + else + winset(usr, "mainwindow", "titlebar=true") + winset(usr, "mainwindow", "can-resize=true") + winset(usr, "mainwindow", "menu=menu") + winset(usr, "mainwindow", "is-maximized=false") + winset(usr, "mainwindow", "on-size=fitviewport") + + fit_viewport()