[DEV] implement some old feature that does not been ported (start work on fullscreen)

This commit is contained in:
Edouard DUPIN 2016-10-12 21:51:10 +02:00
parent 42c3042e8c
commit aed53ea524
4 changed files with 65 additions and 26 deletions

View File

@ -355,6 +355,9 @@ void gale::Context::requestUpdateSize() {
}
void gale::Context::OS_Resize(const vec2& _size) {
if (m_windowsSize == _size) {
return;
}
// TODO : Better in the thread ... ==> but generate some init error ...
gale::Dimension::setPixelWindowsSize(_size);
if (m_imulationActive == true) {
@ -368,24 +371,48 @@ void gale::Context::OS_Resize(const vec2& _size) {
GALE_DEBUG("Receive MSG : THREAD_RESIZE : " << _context.m_windowsSize << " ==> " << _size);
_context.m_windowsSize = _size;
gale::Dimension::setPixelWindowsSize(_context.m_windowsSize);
// call application inside ..
_context.forceRedrawAll();
});
}
void gale::Context::setSize(const vec2& _size) {
GALE_INFO("setSize: NOT implemented ...");
};
void gale::Context::setFullScreen(bool _status) {
GALE_INFO("setFullScreen: NOT implemented ...");
};
void gale::Context::OS_Move(const vec2& _pos) {
/*
gale::eSystemMessage *data = new gale::eSystemMessage();
data->TypeMessage = eSystemMessage::msgResize;
data->resize.w = w;
data->resize.h = h;
if (m_windowsPos == _pos) {
return;
}
std::unique_lock<std::recursive_mutex> lock(m_mutex);
m_msgSystem.Post(data);
*/
m_msgSystem.post([_pos](gale::Context& _context){
GALE_DEBUG("Receive MSG : THREAD_MOVE : " << _context.m_windowsPos << " ==> " << _pos);
_context.m_windowsPos = _pos;
ememory::SharedPtr<gale::Application> appl = _context.getApplication();
if (appl == nullptr) {
return;
}
appl->onMovePosition(_context.m_windowsPos);
});
}
void gale::Context::setPos(const vec2& _pos) {
GALE_INFO("setPos: NOT implemented ...");
}
vec2 gale::Context::getPos() {
return m_windowsPos;
}
void gale::Context::OS_SetInput(enum gale::key::type _type,
enum gale::key::status _status,
int32_t _pointerID,
const vec2& _pos ) {
const vec2& _pos) {
if (m_imulationActive == true) {
m_simulationFile.filePuts(etk::to_string(gale::getTime()));
m_simulationFile.filePuts(":INPUT:");
@ -713,14 +740,6 @@ void gale::Context::stop() {
GALE_WARNING("stop: NOT implemented for this platform...");
}
void gale::Context::setSize(const vec2& _size) {
GALE_INFO("setSize: NOT implemented ...");
};
void gale::Context::setPos(const vec2& _pos) {
GALE_INFO("setPos: NOT implemented ...");
}
void gale::Context::hide() {
GALE_INFO("hide: NOT implemented ...");
};

View File

@ -24,7 +24,7 @@
#define MAX_MANAGE_INPUT (15)
namespace gale {
class Context/* : private gale::object::RemoveEvent */{
class Context {
protected:
std::recursive_mutex m_mutex;
private:
@ -130,7 +130,7 @@ namespace gale {
* @brief The application request that the Window will be killed
*/
virtual void stop();
private:
protected:
ivec2 m_windowsSize; //!< current size of the system
public:
/**
@ -150,6 +150,14 @@ namespace gale {
* @param[in] _size new Requested size of the windows.
*/
virtual void setSize(const vec2& _size);
/**
* @brief The application request a change of his current size force the fullscreen mode.
* @param[in] _status status of the fullscreen mode.
*/
virtual void setFullScreen(bool _status);
protected:
ivec2 m_windowsPos; //!< current size of the system
public:
/**
* @brief The OS inform that the current windows has change his position.
* @param[in] _pos New position of the Windows.
@ -160,6 +168,11 @@ namespace gale {
* @param[in] _pos New position of the Windows requested.
*/
virtual void setPos(const vec2& _pos);
/**
* @brief The Application request the current position of the windows.
* @return Turrent position of the Windows.
*/
virtual vec2 getPos();
/**
* @brief The OS inform that the Windows is now Hidden.
*/

View File

@ -415,6 +415,7 @@ class X11Interface : public gale::Context {
//GALE_INFO("X11 event ConfigureNotify event=" << (int32_t)event.xconfigure.event << " Window=" << (int32_t)event.xconfigure.window << " above=" << (int32_t)event.xconfigure.above << " border_width=" << (int32_t)event.xconfigure.border_width );
m_originX = event.xconfigure.x;
m_originY = event.xconfigure.y;
OS_Move(vec2(event.xconfigure.x,event.xconfigure.y));
X11_INFO("X11 configure windows position : (" << m_originX << "," << m_originY << ")");
m_currentHeight = event.xconfigure.height;
m_currentWidth = event.xconfigure.width;
@ -798,8 +799,14 @@ class X11Interface : public gale::Context {
XResizeWindow(m_display, m_WindowHandle, _size.x(), _size.y());
}
/****************************************************************************************/
void gale::Context::setFullScreen(bool _status) {
X11_INFO("X11-API: changeFullscreen=" << _status);
};
/****************************************************************************************/
virtual void setPos(const vec2& _pos) {
X11_INFO("X11-API: changePos=" << _pos);
m_windowsPos = _pos;
XMoveWindow(m_display, m_WindowHandle, _pos.x(), _pos.y());
m_originX = _pos.x();
m_originY = _pos.y();

View File

@ -216,49 +216,49 @@ namespace etk {
template<> std::string to_string<gale::key::Special>(const gale::key::Special& _obj) {
std::string out;
if (_obj.getCapsLock() == true) {
out = "CAPS";
out += "CAPS";
}
if (_obj.getShift() == true) {
if (out.size() > 0) {
out += "|";
}
out = "SHIFT";
out += "SHIFT";
}
if (_obj.getCtrl() == true) {
if (out.size() > 0) {
out += "|";
}
out = "CTRL";
out += "CTRL";
}
if (_obj.getMeta() == true) {
if (out.size() > 0) {
out += "|";
}
out = "META";
out += "META";
}
if (_obj.getAlt() == true) {
if (out.size() > 0) {
out += "|";
}
out = "ALT";
out += "ALT";
}
if (_obj.getAltGr() == true) {
if (out.size() > 0) {
out += "|";
}
out = "ALTGR";
out += "ALTGR";
}
if (_obj.getNumLock() == true) {
if (out.size() > 0) {
out += "|";
}
out = "NUM_LOCK";
out += "NUM_LOCK";
}
if (_obj.getInsert() == true) {
if (out.size() > 0) {
out += "|";
}
out = "INSERT";
out += "INSERT";
}
return out;
}