I had the same problem, so I did a little research. I found otu you can use a JVM Argument to solve the problem. Here is how to do it; Open Minecraft Launcher then go to the installations tab, click the ellipsis icon and select Edit from the menu. From here click more options then to the JVM Arguments paste this to the end of it -Dorg.lwjgl.opengl.Window.undecorated=true Open the game then make it fullscreen. I tried this on Optifine 1.20.4 and it worked, so give it a try.
I had the same problem, so I did a little research. I found otu you can use a JVM Argument to solve the problem. Here is how to do it;
Open Minecraft Launcher then go to the installations tab, click the ellipsis icon and select Edit from the menu.
From here click more options then to the JVM Arguments paste this to the end of it
-Dorg.lwjgl.opengl.Window.undecorated=true
Open the game then make it fullscreen.
I tried this on Optifine 1.20.4 and it worked, so give it a try.