Thread Tools Display Modes
02-11-20, 01:39 AM   #1
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
System Preferences - Graphics

Hi everyone,

I'd like to make a little addon to switch from full screen to windowed mode.

The problem is that the system preferences do it so nicely:



While a simple code to switch from a mode to the other like this:

Lua Code:
  1. C_CVar.SetCVar("gxMaximize", "1")
  2. RestartGx()

or

Lua Code:
  1. C_CVar.SetCVar("gxMaximize", "0")
  2. C_CVar.SetCVar("gxWindowedResolution", "1790x1007")
  3. RestartGx()

freeze for a little bit the game and is not as perfect as the first.

So the question.
How is, if any, the best way to achieve this ?

Thanks so much.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
02-11-20, 03:37 AM   #2
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 320
I just tried to find out what the Blizzard UI does when you click the "Apply" button. This seems to work for me:

Code:
OptionsFrameOkay_OnClick(VideoOptionsFrame, 1);
But it does not take into account any changed cvars. So the next step would be to find out what happens when you toggle the "display mode" drop down in the options...
__________________
~ Be the change you want to see in the world... of warcraft interface! ~
  Reply With Quote
02-11-20, 03:43 AM   #3
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 320
OK, it turns out UpdateWindow() is what you are looking for!

Code:
C_CVar.SetCVar("gxMaximize", "0")
C_CVar.SetCVar("gxWindowedResolution", "400x400")
UpdateWindow()
__________________
~ Be the change you want to see in the world... of warcraft interface! ~
  Reply With Quote
02-11-20, 11:22 AM   #4
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
It works like a charm.

Thanks so much.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » System Preferences - Graphics

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off