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