mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-01 01:20:25 +00:00
Improve default window size on Skia/Win port (fix #693)
This commit is contained in:
parent
2fc447edd6
commit
a6544d92af
@ -212,8 +212,10 @@ void exit_module_gui()
|
||||
static void load_gui_config(int& w, int& h, bool& maximized,
|
||||
std::string& windowLayout)
|
||||
{
|
||||
w = get_config_int("GfxMode", "Width", 0);
|
||||
h = get_config_int("GfxMode", "Height", 0);
|
||||
gfx::Size defSize = she::instance()->defaultNewDisplaySize();
|
||||
|
||||
w = get_config_int("GfxMode", "Width", defSize.w);
|
||||
h = get_config_int("GfxMode", "Height", defSize.h);
|
||||
maximized = get_config_bool("GfxMode", "Maximized", false);
|
||||
windowLayout = get_config_string("GfxMode", "WindowLayout", "");
|
||||
}
|
||||
|
@ -163,6 +163,10 @@ public:
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
gfx::Size defaultNewDisplaySize() override {
|
||||
return gfx::Size(0, 0);
|
||||
}
|
||||
|
||||
Display* defaultDisplay() override {
|
||||
return unique_display;
|
||||
}
|
||||
|
@ -67,6 +67,19 @@ public:
|
||||
m_gpuAcceleration = state;
|
||||
}
|
||||
|
||||
gfx::Size defaultNewDisplaySize() override {
|
||||
gfx::Size sz;
|
||||
#ifdef _WIN32
|
||||
sz.w = GetSystemMetrics(SM_CXMAXIMIZED);
|
||||
sz.h = GetSystemMetrics(SM_CYMAXIMIZED);
|
||||
sz.w -= GetSystemMetrics(SM_CXSIZEFRAME)*4;
|
||||
sz.h -= GetSystemMetrics(SM_CYSIZEFRAME)*4;
|
||||
sz.w = MAX(0, sz.w);
|
||||
sz.h = MAX(0, sz.h);
|
||||
#endif
|
||||
return sz;
|
||||
}
|
||||
|
||||
Display* defaultDisplay() override {
|
||||
return m_defaultDisplay;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ namespace she {
|
||||
virtual EventQueue* eventQueue() = 0;
|
||||
virtual bool gpuAcceleration() const = 0;
|
||||
virtual void setGpuAcceleration(bool state) = 0;
|
||||
virtual gfx::Size defaultNewDisplaySize() = 0;
|
||||
virtual Display* defaultDisplay() = 0;
|
||||
virtual Display* createDisplay(int width, int height, int scale) = 0;
|
||||
virtual Surface* createSurface(int width, int height) = 0;
|
||||
|
@ -598,6 +598,19 @@ namespace she {
|
||||
|
||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, LONG_PTR(self));
|
||||
|
||||
// Center the window
|
||||
RECT workarea;
|
||||
if (SystemParametersInfo(SPI_GETWORKAREA, 0, (PVOID)&workarea, 0)) {
|
||||
SetWindowPos(hwnd, nullptr,
|
||||
(workarea.right-workarea.left)/2-width/2,
|
||||
(workarea.bottom-workarea.top)/2-height/2, 0, 0,
|
||||
SWP_NOSIZE |
|
||||
SWP_NOSENDCHANGING |
|
||||
SWP_NOOWNERZORDER |
|
||||
SWP_NOZORDER |
|
||||
SWP_NOREDRAW);
|
||||
}
|
||||
|
||||
// Set scroll info to receive WM_HSCROLL/VSCROLL events (events
|
||||
// generated by some trackpad drivers).
|
||||
SCROLLINFO si;
|
||||
|
Loading…
x
Reference in New Issue
Block a user