mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-17 13:20:45 +00:00
Add missing members to SkiaDisplay port
This commit is contained in:
parent
ab0c447be4
commit
3b9ba0d7d2
@ -109,6 +109,11 @@ bool SkiaDisplay::isMaximized() const
|
||||
return m_window.isMaximized();
|
||||
}
|
||||
|
||||
bool SkiaDisplay::isMinimized() const
|
||||
{
|
||||
return m_window.isMinimized();
|
||||
}
|
||||
|
||||
void SkiaDisplay::setTitleBar(const std::string& title)
|
||||
{
|
||||
m_window.setTitle(title);
|
||||
@ -140,6 +145,16 @@ void SkiaDisplay::releaseMouse()
|
||||
m_window.releaseMouse();
|
||||
}
|
||||
|
||||
std::string SkiaDisplay::getLayout()
|
||||
{
|
||||
return m_window.getLayout();
|
||||
}
|
||||
|
||||
void SkiaDisplay::setLayout(const std::string& layout)
|
||||
{
|
||||
m_window.setLayout(layout);
|
||||
}
|
||||
|
||||
DisplayHandle SkiaDisplay::nativeHandle()
|
||||
{
|
||||
return (DisplayHandle)m_window.handle();
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
void flip(const gfx::Rect& bounds) override;
|
||||
void maximize() override;
|
||||
bool isMaximized() const override;
|
||||
bool isMinimized() const override;
|
||||
void setTitleBar(const std::string& title) override;
|
||||
NativeCursor nativeMouseCursor() override;
|
||||
bool setNativeMouseCursor(NativeCursor cursor) override;
|
||||
@ -51,6 +52,9 @@ public:
|
||||
void captureMouse() override;
|
||||
void releaseMouse() override;
|
||||
|
||||
std::string getLayout() override;
|
||||
void setLayout(const std::string& layout) override;
|
||||
|
||||
// Returns the HWND on Windows.
|
||||
DisplayHandle nativeHandle() override;
|
||||
|
||||
|
@ -31,6 +31,7 @@ public:
|
||||
void setVisible(bool visible);
|
||||
void maximize();
|
||||
bool isMaximized() const;
|
||||
bool isMinimized() const;
|
||||
gfx::Size clientSize() const;
|
||||
gfx::Size restoredSize() const;
|
||||
void setTitle(const std::string& title);
|
||||
@ -39,6 +40,8 @@ public:
|
||||
void setMousePosition(const gfx::Point& position);
|
||||
bool setNativeMouseCursor(NativeCursor cursor);
|
||||
void updateWindow(const gfx::Rect& bounds);
|
||||
std::string getLayout() { return ""; }
|
||||
void setLayout(const std::string& layout) { }
|
||||
void* handle();
|
||||
|
||||
private:
|
||||
|
@ -195,7 +195,7 @@ private:
|
||||
[m_nsGL setView:m_window.contentView];
|
||||
}
|
||||
catch (const std::exception& ex) {
|
||||
LOG("Cannot create GL context: %s\n", ex.what());
|
||||
//LOG("Cannot create GL context: %s\n", ex.what());
|
||||
detachGL();
|
||||
return false;
|
||||
}
|
||||
@ -340,6 +340,11 @@ bool SkiaWindow::isMaximized() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SkiaWindow::isMinimized() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
gfx::Size SkiaWindow::clientSize() const
|
||||
{
|
||||
if (!m_impl)
|
||||
|
@ -157,7 +157,7 @@ bool SkiaWindow::attachGL()
|
||||
(GrBackendContext)m_glCtx->gl()));
|
||||
}
|
||||
catch (const std::exception& ex) {
|
||||
LOG("Cannot create GL context: %s\n", ex.what());
|
||||
//LOG("Cannot create GL context: %s\n", ex.what());
|
||||
detachGL();
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <windowsx.h>
|
||||
#include <commctrl.h>
|
||||
#include <shellapi.h>
|
||||
#include <sstream>
|
||||
|
||||
#include "gfx/size.h"
|
||||
#include "she/event.h"
|
||||
@ -73,6 +74,10 @@ namespace she {
|
||||
return (IsZoomed(m_hwnd) ? true: false);
|
||||
}
|
||||
|
||||
bool isMinimized() const {
|
||||
return (GetWindowLong(m_hwnd, GWL_STYLE) & WS_MINIMIZE ? true: false);
|
||||
}
|
||||
|
||||
gfx::Size clientSize() const {
|
||||
return m_clientSize;
|
||||
}
|
||||
@ -162,6 +167,54 @@ namespace she {
|
||||
UpdateWindow(m_hwnd);
|
||||
}
|
||||
|
||||
std::string getLayout() {
|
||||
WINDOWPLACEMENT wp;
|
||||
wp.length = sizeof(WINDOWPLACEMENT);
|
||||
if (GetWindowPlacement(m_hwnd, &wp)) {
|
||||
std::ostringstream s;
|
||||
s << 1 << ' '
|
||||
<< wp.flags << ' '
|
||||
<< wp.showCmd << ' '
|
||||
<< wp.ptMinPosition.x << ' '
|
||||
<< wp.ptMinPosition.y << ' '
|
||||
<< wp.ptMaxPosition.x << ' '
|
||||
<< wp.ptMaxPosition.y << ' '
|
||||
<< wp.rcNormalPosition.left << ' '
|
||||
<< wp.rcNormalPosition.top << ' '
|
||||
<< wp.rcNormalPosition.right << ' '
|
||||
<< wp.rcNormalPosition.bottom;
|
||||
return s.str();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void setLayout(const std::string& layout) {
|
||||
WINDOWPLACEMENT wp;
|
||||
wp.length = sizeof(WINDOWPLACEMENT);
|
||||
|
||||
std::istringstream s(layout);
|
||||
int ver;
|
||||
s >> ver;
|
||||
if (ver == 1) {
|
||||
s >> wp.flags
|
||||
>> wp.showCmd
|
||||
>> wp.ptMinPosition.x
|
||||
>> wp.ptMinPosition.y
|
||||
>> wp.ptMaxPosition.x
|
||||
>> wp.ptMaxPosition.y
|
||||
>> wp.rcNormalPosition.left
|
||||
>> wp.rcNormalPosition.top
|
||||
>> wp.rcNormalPosition.right
|
||||
>> wp.rcNormalPosition.bottom;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if (SetWindowPlacement(m_hwnd, &wp)) {
|
||||
// TODO use the return value
|
||||
}
|
||||
}
|
||||
|
||||
HWND handle() {
|
||||
return m_hwnd;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user