x11/skia: Fix problems saving window size on .ini file

This commit is contained in:
David Capello 2017-04-21 15:24:47 -03:00
parent 4542deaa0a
commit daf1e3fb3e
2 changed files with 25 additions and 8 deletions

View File

@ -103,7 +103,6 @@ void X11Window::removeWindow(X11Window* window)
X11Window::X11Window(::Display* display, int width, int height, int scale)
: m_display(display)
, m_scale(scale)
, m_clientSize(1, 1)
{
// Initialize special messages (just the first time a X11Window is
// created)
@ -146,7 +145,7 @@ X11Window::~X11Window()
void X11Window::setScale(const int scale)
{
m_scale = scale;
resizeDisplay(m_clientSize);
resizeDisplay(clientSize());
}
void X11Window::setTitle(const std::string& title)
@ -159,6 +158,26 @@ void X11Window::setTitle(const std::string& title)
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()
{
}
@ -208,9 +227,8 @@ void X11Window::processX11Event(XEvent& event)
if (newSize.w > 0 &&
newSize.h > 0 &&
m_clientSize != newSize) {
m_clientSize = newSize;
resizeDisplay(m_clientSize);
newSize != clientSize()) {
resizeDisplay(newSize);
}
break;
}

View File

@ -34,8 +34,8 @@ public:
void setTitle(const std::string& title);
gfx::Size clientSize() const { return m_clientSize; }
gfx::Size restoredSize() const { return m_clientSize; }
gfx::Size clientSize() const;
gfx::Size restoredSize() const;
void captureMouse();
void releaseMouse();
void setMousePosition(const gfx::Point& position);
@ -65,7 +65,6 @@ private:
::Window m_window;
::GC m_gc;
int m_scale;
gfx::Size m_clientSize;
};
} // namespace she