|
25 | 25 | #include "cinder/app/linux/WindowImplLinux.h" |
26 | 26 | #include "cinder/app/linux/AppImplLinux.h" |
27 | 27 | #include "cinder/app/linux/PlatformLinux.h" |
28 | | -#include "cinder/Log.h" |
29 | | - |
30 | 28 | namespace cinder { namespace app { |
31 | 29 |
|
32 | 30 | WindowImplLinux::WindowImplLinux( const Window::Format &format, WindowImplLinux *sharedRendererWindow, AppImplLinux *appImpl ) |
@@ -74,6 +72,7 @@ WindowImplLinux::WindowImplLinux( const Window::Format &format, WindowImplLinux |
74 | 72 | ::glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, minorVersion ); |
75 | 73 | ::glfwWindowHint( GLFW_DECORATED, format.isBorderless() ? GL_FALSE : GL_TRUE ); |
76 | 74 | ::glfwWindowHint( GLFW_RESIZABLE, format.isResizable() ? GL_TRUE : GL_FALSE ); |
| 75 | + ::glfwWindowHint( GLFW_FLOATING, format.isAlwaysOnTop() ? GL_TRUE : GL_FALSE ); |
77 | 76 | if( options.getCoreProfile() ) { |
78 | 77 | ::glfwWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE ); |
79 | 78 | std::cout << "Rendering with OpenGL Core Profile " << majorVersion << "." << minorVersion << std::endl; |
@@ -105,6 +104,9 @@ WindowImplLinux::WindowImplLinux( const Window::Format &format, WindowImplLinux |
105 | 104 | mWindowRef = Window::privateCreate__( this, mAppImpl->getApp() ); |
106 | 105 |
|
107 | 106 | mAppImpl->registerWindowEvents( this ); |
| 107 | + |
| 108 | + setBorderless( format.isBorderless() ); |
| 109 | + setAlwaysOnTop( format.isAlwaysOnTop() ); |
108 | 110 | } |
109 | 111 |
|
110 | 112 | WindowImplLinux::~WindowImplLinux() |
@@ -188,14 +190,30 @@ const std::vector<TouchEvent::Touch>& WindowImplLinux::getActiveTouches() const |
188 | 190 |
|
189 | 191 | void WindowImplLinux::setBorderless( bool borderless ) |
190 | 192 | { |
191 | | - CI_LOG_W( "Window::setBorderless() currently unimplemented in GLFW" ); |
192 | | - // TODO: Find a way to do this w/o recreating |
| 193 | + if( mBorderless == borderless ) |
| 194 | + return; |
| 195 | + |
| 196 | +#if ! defined( CINDER_HEADLESS ) |
| 197 | + if( mGlfwWindow ) { |
| 198 | + ::glfwSetWindowAttrib( mGlfwWindow, GLFW_DECORATED, borderless ? GLFW_FALSE : GLFW_TRUE ); |
| 199 | + } |
| 200 | +#endif |
| 201 | + |
| 202 | + mBorderless = borderless; |
193 | 203 | } |
194 | 204 |
|
195 | 205 | void WindowImplLinux::setAlwaysOnTop( bool alwaysOnTop ) |
196 | 206 | { |
197 | | - CI_LOG_W( "Window::setAlwaysOnTop() currently unimplemented in GLFW" ); |
198 | | - // TODO: Find a way to do this w/o recreating |
| 207 | + if( mAlwayOnTop == alwaysOnTop ) |
| 208 | + return; |
| 209 | + |
| 210 | +#if ! defined( CINDER_HEADLESS ) |
| 211 | + if( mGlfwWindow ) { |
| 212 | + ::glfwSetWindowAttrib( mGlfwWindow, GLFW_FLOATING, alwaysOnTop ? GLFW_TRUE : GLFW_FALSE ); |
| 213 | + } |
| 214 | +#endif |
| 215 | + |
| 216 | + mAlwayOnTop = alwaysOnTop; |
199 | 217 | } |
200 | 218 |
|
201 | 219 | void WindowImplLinux::keyDown( const KeyEvent &event ) |
|
0 commit comments