mirror of
https://github.com/minetest/minetest.git
synced 2025-01-10 23:37:29 +01:00
ContentDB dialog: React to window info changes immediately (#15248)
This commit is contained in:
parent
6ac4447134
commit
07ff2a5c01
@ -496,6 +496,11 @@ local function handle_events(event)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if event == "WindowInfoChange" then
|
||||||
|
ui.update()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -305,12 +305,23 @@ local function handle_submit(this, fields)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function handle_events(event)
|
||||||
|
if event == "WindowInfoChange" then
|
||||||
|
ui.update()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function create_package_dialog(package)
|
function create_package_dialog(package)
|
||||||
assert(package)
|
assert(package)
|
||||||
|
|
||||||
local dlg = dialog_create("package_dialog_" .. package.id,
|
local dlg = dialog_create("package_dialog_" .. package.id,
|
||||||
get_formspec,
|
get_formspec,
|
||||||
handle_submit)
|
handle_submit,
|
||||||
|
handle_events)
|
||||||
local data = dlg.data
|
local data = dlg.data
|
||||||
|
|
||||||
data.package = package
|
data.package = package
|
||||||
|
@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "client/renderingengine.h"
|
#include "client/renderingengine.h"
|
||||||
#include "client/shader.h"
|
#include "client/shader.h"
|
||||||
#include "client/tile.h"
|
#include "client/tile.h"
|
||||||
|
#include "clientdynamicinfo.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "content/content.h"
|
#include "content/content.h"
|
||||||
#include "content/mods.h"
|
#include "content/mods.h"
|
||||||
@ -316,6 +317,7 @@ void GUIEngine::run()
|
|||||||
);
|
);
|
||||||
const bool initial_window_maximized = !g_settings->getBool("fullscreen") &&
|
const bool initial_window_maximized = !g_settings->getBool("fullscreen") &&
|
||||||
g_settings->getBool("window_maximized");
|
g_settings->getBool("window_maximized");
|
||||||
|
auto last_window_info = ClientDynamicInfo::getCurrent();
|
||||||
|
|
||||||
FpsControl fps_control;
|
FpsControl fps_control;
|
||||||
f32 dtime = 0.0f;
|
f32 dtime = 0.0f;
|
||||||
@ -335,6 +337,11 @@ void GUIEngine::run()
|
|||||||
updateTopLeftTextSize();
|
updateTopLeftTextSize();
|
||||||
text_height = g_fontengine->getTextHeight();
|
text_height = g_fontengine->getTextHeight();
|
||||||
}
|
}
|
||||||
|
auto window_info = ClientDynamicInfo::getCurrent();
|
||||||
|
if (!window_info.equal(last_window_info)) {
|
||||||
|
m_script->handleMainMenuEvent("WindowInfoChange");
|
||||||
|
last_window_info = window_info;
|
||||||
|
}
|
||||||
|
|
||||||
driver->beginScene(true, true, RenderingEngine::MENU_SKY_COLOR);
|
driver->beginScene(true, true, RenderingEngine::MENU_SKY_COLOR);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user