implement fullscreen for x11
This commit is contained in:
parent
028441831d
commit
7206f7aad9
|
@ -19,7 +19,7 @@ function Client.init()
|
|||
local displaySize = g_window.getDisplaySize()
|
||||
local pos = { x = (displaySize.width - size.width)/2,
|
||||
y = (displaySize.height - size.height)/2 }
|
||||
pos = Settings.getPoint('window-pos', size)
|
||||
pos = Settings.getPoint('window-pos', pos)
|
||||
g_window.move(pos)
|
||||
|
||||
-- window maximized?
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
Options = {}
|
||||
|
||||
-- public functions
|
||||
function Options.load()
|
||||
-- set default settings
|
||||
Settings.setDefault('vsync', true)
|
||||
Settings.setDefault('showfps', true)
|
||||
local booleanOptions = { vsync = true,
|
||||
showfps = true,
|
||||
fullscreen = false }
|
||||
|
||||
-- load the options
|
||||
Options.enableVsync(Settings.getBoolean('vsync'))
|
||||
Options.enableFps(Settings.getBoolean('showfps'))
|
||||
for k,v in pairs(booleanOptions) do
|
||||
Settings.setDefault(k, v)
|
||||
Options.changeOption(k, Settings.getBoolean(k))
|
||||
end
|
||||
end
|
||||
|
||||
function Options.show()
|
||||
|
@ -20,15 +20,14 @@ function Options.openWebpage()
|
|||
end
|
||||
|
||||
-- private functions
|
||||
function Options.enableVsync(on)
|
||||
g_window.setVerticalSync(on)
|
||||
Settings.set('vsync', on)
|
||||
Options.vsync = on
|
||||
function Options.changeOption(key, status)
|
||||
if key == 'vsync' then
|
||||
g_window.setVerticalSync(status)
|
||||
elseif key == 'showfps' then
|
||||
addEvent(function() rootWidget:recursiveGetChildById('frameCounter'):setVisible(status) end)
|
||||
elseif key == 'fullscreen' then
|
||||
addEvent(function() g_window.setFullscreen(status) end)
|
||||
end
|
||||
|
||||
function Options.enableFps(on)
|
||||
local frameCounter = rootWidget:recursiveGetChildById('frameCounter')
|
||||
frameCounter:setVisible(on)
|
||||
Settings.set('showfps', on)
|
||||
Options.fps = on
|
||||
Settings.set(key, status)
|
||||
Options[key] = status
|
||||
end
|
||||
|
|
|
@ -1,32 +1,38 @@
|
|||
MainWindow
|
||||
id: optionsWindow
|
||||
title: Options
|
||||
size: 286 100
|
||||
OptionCheckBox < CheckBox
|
||||
margin-left: 18
|
||||
margin-right: 18
|
||||
@onCheckChange: Options.changeOption(self:getId(), self:isChecked())
|
||||
@onSetup: self:setChecked(Options[self:getId()])
|
||||
|
||||
CheckBox
|
||||
id: vsyncCheckBox
|
||||
text: Enable vertical synchronization
|
||||
tooltip: Limits FPS to 60
|
||||
$first:
|
||||
margin-top: 28
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
margin-top: 28
|
||||
margin-left: 18
|
||||
margin-right: 18
|
||||
@onCheckChange: Options.enableVsync(self:isChecked())
|
||||
@onSetup: self:setChecked(Options.vsync)
|
||||
|
||||
CheckBox
|
||||
id: fpsCheckBox
|
||||
text: Show frame rate
|
||||
$middle:
|
||||
margin-top: 10
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: prev.bottom
|
||||
margin-top: 10
|
||||
margin-left: 18
|
||||
margin-right: 18
|
||||
@onCheckChange: Options.enableFps(self:isChecked())
|
||||
@onSetup: self:setChecked(Options.fps)
|
||||
|
||||
MainWindow
|
||||
id: optionsWindow
|
||||
title: Options
|
||||
size: 286 120
|
||||
|
||||
OptionCheckBox
|
||||
id: vsync
|
||||
text: Enable vertical synchronization
|
||||
tooltip: Limits FPS to 60
|
||||
|
||||
OptionCheckBox
|
||||
id: showfps
|
||||
text: Show frame rate
|
||||
|
||||
OptionCheckBox
|
||||
id: fullscreen
|
||||
text: Fullscreen
|
||||
|
||||
Button
|
||||
text: Ok
|
||||
|
|
|
@ -34,7 +34,7 @@ PlatformWindow& g_window = window;
|
|||
|
||||
void PlatformWindow::updateUnmaximizedCoords()
|
||||
{
|
||||
if(!isMaximized()) {
|
||||
if(!isMaximized() && !isFullscreen()) {
|
||||
m_unmaximizedPos = m_pos;
|
||||
m_unmaximizedSize = m_size;
|
||||
}
|
||||
|
|
|
@ -495,8 +495,6 @@ void X11Window::hide()
|
|||
|
||||
void X11Window::maximize()
|
||||
{
|
||||
updateUnmaximizedCoords();
|
||||
|
||||
Atom wmState = XInternAtom(m_display, "_NET_WM_STATE", False);
|
||||
Atom wmStateMaximizedVert = XInternAtom(m_display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
|
||||
Atom wmStateMaximizedHorz = XInternAtom(m_display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
|
||||
|
|
Loading…
Reference in New Issue