[aseprite] 123/308: Add missing members to SkiaDisplay port
Tobias Hansen
thansen at moszumanska.debian.org
Tue Mar 8 02:45:00 UTC 2016
This is an automated email from the git hooks/post-receive script.
thansen pushed a commit to branch master
in repository aseprite.
commit 3b9ba0d7d201804740fdd0316982e103a80d651d
Author: David Capello <davidcapello at gmail.com>
Date: Wed Dec 16 18:45:01 2015 -0300
Add missing members to SkiaDisplay port
---
src/she/skia/skia_display.cpp | 15 ++++++++++++
src/she/skia/skia_display.h | 4 +++
src/she/skia/skia_window_osx.h | 3 +++
src/she/skia/skia_window_osx.mm | 7 +++++-
src/she/skia/skia_window_win.cpp | 2 +-
src/she/win/window.h | 53 ++++++++++++++++++++++++++++++++++++++++
6 files changed, 82 insertions(+), 2 deletions(-)
diff --git a/src/she/skia/skia_display.cpp b/src/she/skia/skia_display.cpp
index 8982077..4b84803 100644
--- a/src/she/skia/skia_display.cpp
+++ b/src/she/skia/skia_display.cpp
@@ -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();
diff --git a/src/she/skia/skia_display.h b/src/she/skia/skia_display.h
index 21ab241..00b77de 100644
--- a/src/she/skia/skia_display.h
+++ b/src/she/skia/skia_display.h
@@ -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;
diff --git a/src/she/skia/skia_window_osx.h b/src/she/skia/skia_window_osx.h
index 8012f4f..c8785d1 100644
--- a/src/she/skia/skia_window_osx.h
+++ b/src/she/skia/skia_window_osx.h
@@ -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:
diff --git a/src/she/skia/skia_window_osx.mm b/src/she/skia/skia_window_osx.mm
index 89d2f65..82d9ee7 100644
--- a/src/she/skia/skia_window_osx.mm
+++ b/src/she/skia/skia_window_osx.mm
@@ -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)
diff --git a/src/she/skia/skia_window_win.cpp b/src/she/skia/skia_window_win.cpp
index 602df48..94728de 100644
--- a/src/she/skia/skia_window_win.cpp
+++ b/src/she/skia/skia_window_win.cpp
@@ -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();
}
}
diff --git a/src/she/win/window.h b/src/she/win/window.h
index bad64f5..f16f764 100644
--- a/src/she/win/window.h
+++ b/src/she/win/window.h
@@ -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;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git
More information about the Pkg-games-commits
mailing list