mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-31 16:20:22 +00:00
x11/skia: Fix problems saving window size on .ini file
This commit is contained in:
parent
4542deaa0a
commit
daf1e3fb3e
@ -103,7 +103,6 @@ void X11Window::removeWindow(X11Window* window)
|
|||||||
X11Window::X11Window(::Display* display, int width, int height, int scale)
|
X11Window::X11Window(::Display* display, int width, int height, int scale)
|
||||||
: m_display(display)
|
: m_display(display)
|
||||||
, m_scale(scale)
|
, m_scale(scale)
|
||||||
, m_clientSize(1, 1)
|
|
||||||
{
|
{
|
||||||
// Initialize special messages (just the first time a X11Window is
|
// Initialize special messages (just the first time a X11Window is
|
||||||
// created)
|
// created)
|
||||||
@ -146,7 +145,7 @@ X11Window::~X11Window()
|
|||||||
void X11Window::setScale(const int scale)
|
void X11Window::setScale(const int scale)
|
||||||
{
|
{
|
||||||
m_scale = scale;
|
m_scale = scale;
|
||||||
resizeDisplay(m_clientSize);
|
resizeDisplay(clientSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void X11Window::setTitle(const std::string& title)
|
void X11Window::setTitle(const std::string& title)
|
||||||
@ -159,6 +158,26 @@ void X11Window::setTitle(const std::string& title)
|
|||||||
XSetWMName(m_display, m_window, &prop);
|
XSetWMName(m_display, m_window, &prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gfx::Size X11Window::clientSize() const
|
||||||
|
{
|
||||||
|
Window root;
|
||||||
|
int x, y;
|
||||||
|
unsigned int width, height, border, depth;
|
||||||
|
XGetGeometry(m_display, m_window, &root,
|
||||||
|
&x, &y, &width, &height, &border, &depth);
|
||||||
|
return gfx::Size(int(width), int(height));
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx::Size X11Window::restoredSize() const
|
||||||
|
{
|
||||||
|
Window root;
|
||||||
|
int x, y;
|
||||||
|
unsigned int width, height, border, depth;
|
||||||
|
XGetGeometry(m_display, m_window, &root,
|
||||||
|
&x, &y, &width, &height, &border, &depth);
|
||||||
|
return gfx::Size(int(width), int(height));
|
||||||
|
}
|
||||||
|
|
||||||
void X11Window::captureMouse()
|
void X11Window::captureMouse()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -208,9 +227,8 @@ void X11Window::processX11Event(XEvent& event)
|
|||||||
|
|
||||||
if (newSize.w > 0 &&
|
if (newSize.w > 0 &&
|
||||||
newSize.h > 0 &&
|
newSize.h > 0 &&
|
||||||
m_clientSize != newSize) {
|
newSize != clientSize()) {
|
||||||
m_clientSize = newSize;
|
resizeDisplay(newSize);
|
||||||
resizeDisplay(m_clientSize);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ public:
|
|||||||
|
|
||||||
void setTitle(const std::string& title);
|
void setTitle(const std::string& title);
|
||||||
|
|
||||||
gfx::Size clientSize() const { return m_clientSize; }
|
gfx::Size clientSize() const;
|
||||||
gfx::Size restoredSize() const { return m_clientSize; }
|
gfx::Size restoredSize() const;
|
||||||
void captureMouse();
|
void captureMouse();
|
||||||
void releaseMouse();
|
void releaseMouse();
|
||||||
void setMousePosition(const gfx::Point& position);
|
void setMousePosition(const gfx::Point& position);
|
||||||
@ -65,7 +65,6 @@ private:
|
|||||||
::Window m_window;
|
::Window m_window;
|
||||||
::GC m_gc;
|
::GC m_gc;
|
||||||
int m_scale;
|
int m_scale;
|
||||||
gfx::Size m_clientSize;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace she
|
} // namespace she
|
||||||
|
Loading…
x
Reference in New Issue
Block a user