diff --git a/modules/client_terminal/terminal.lua b/modules/client_terminal/terminal.lua index d57d0118..318d06df 100644 --- a/modules/client_terminal/terminal.lua +++ b/modules/client_terminal/terminal.lua @@ -181,8 +181,6 @@ function Terminal.addLine(text, color) local numLines = terminalBuffer:getChildCount() + 1 if numLines > MaxLogLines then terminalBuffer:getChildByIndex(1):destroy() - else - terminalBuffer:setHeight(terminalBuffer:getHeight() + LabelHeight) end -- create new line label diff --git a/modules/client_terminal/terminal.otui b/modules/client_terminal/terminal.otui index 29891b7d..4894a19a 100644 --- a/modules/client_terminal/terminal.otui +++ b/modules/client_terminal/terminal.otui @@ -14,7 +14,7 @@ UIWindow id: terminalBuffer layout: type: verticalBox - align-bottom: true + fit-children: true focusable: false anchors.left: parent.left anchors.right: parent.right diff --git a/modules/client_topmenu/topmenu.otui b/modules/client_topmenu/topmenu.otui index 35d34315..ef576d6c 100644 --- a/modules/client_topmenu/topmenu.otui +++ b/modules/client_topmenu/topmenu.otui @@ -70,8 +70,8 @@ TopPanel anchors.right: parent.right UILabel - size: 68 16 text-align: right + text-auto-resize: true color: white id: frameCounter anchors.top: parent.top diff --git a/src/framework/application.cpp b/src/framework/application.cpp index 7a067ffe..c9f3f3f8 100644 --- a/src/framework/application.cpp +++ b/src/framework/application.cpp @@ -201,6 +201,9 @@ void Application::run() if(redraw) { g_graphics.beginRender(); + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT); + Rect viewportRect(0, 0, g_graphics.getViewportSize()); // draw the foreground into a texture @@ -214,8 +217,8 @@ void Application::run() m_foreground->copyFromScreen(viewportRect); } - //glClearColor(0,0,0,0); - //glClear(GL_COLOR_BUFFER_BIT); + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT); // draw background (animated stuff) m_backgroundFrameCounter.processNextFrame(); @@ -223,6 +226,7 @@ void Application::run() // draw the foreground (steady stuff) g_painter->setColor(Color::white); + g_painter->setOpacity(1.0); g_painter->drawTexturedRect(viewportRect, m_foreground, viewportRect); g_graphics.endRender(); diff --git a/src/framework/core/logger.cpp b/src/framework/core/logger.cpp index 30adb9ba..277c526e 100644 --- a/src/framework/core/logger.cpp +++ b/src/framework/core/logger.cpp @@ -80,8 +80,9 @@ void Logger::fireOldMessages() { if(m_onLog) { auto backup = m_logMessages; - for(const LogMessage& logMessage : backup) + for(const LogMessage& logMessage : backup) { m_onLog(logMessage.level, logMessage.message, logMessage.when); + } } } diff --git a/src/framework/core/logger.h b/src/framework/core/logger.h index 2ed2f338..12c7b052 100644 --- a/src/framework/core/logger.h +++ b/src/framework/core/logger.h @@ -48,7 +48,7 @@ public: void info(const std::string& what) { log(Fw::LogInfo, what); } void warning(const std::string& what) { log(Fw::LogWarning, what); } void error(const std::string& what) { log(Fw::LogError, what); } - void fatal(const std::string& what) { log(Fw::LogError, what); } + void fatal(const std::string& what) { log(Fw::LogFatal, what); } void fireOldMessages(); void setLogFile(const std::string& file); diff --git a/src/framework/graphics/graphics.cpp b/src/framework/graphics/graphics.cpp index c4903f1f..803f2d1a 100644 --- a/src/framework/graphics/graphics.cpp +++ b/src/framework/graphics/graphics.cpp @@ -87,12 +87,17 @@ void Graphics::init() */ // determine max texture size - static GLint maxTextureSize = -1; - if(maxTextureSize == -1) - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); + GLint maxTextureSize = 0; + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); if(m_maxTextureSize == -1 || m_maxTextureSize > maxTextureSize) m_maxTextureSize = maxTextureSize; + // check if we have alpha channel in the color buffer, because we need alpha channel for glCopyTexSubImage2D + GLint alphaBits = 0; + glGetIntegerv(GL_ALPHA_BITS, &alphaBits); + if(alphaBits <= 0) + g_logger.fatal("OpenGL visual doesn't have an alpha buffer"); + selectPainterEngine(m_prefferedPainterEngine); m_emptyTexture = TexturePtr(new Texture); } diff --git a/src/framework/graphics/painterogl2_shadersources.h b/src/framework/graphics/painterogl2_shadersources.h index 84e0999b..a4fd3fce 100644 --- a/src/framework/graphics/painterogl2_shadersources.h +++ b/src/framework/graphics/painterogl2_shadersources.h @@ -34,7 +34,7 @@ static const std::string glslMainWithTexCoordsVertexShader = "\n\ void main()\n\ {\n\ gl_Position = calculatePosition();\n\ - texCoord = textureMatrix * vec3(a_texCoord,1);\n\ + texCoord = (textureMatrix * vec3(a_texCoord,1)).xy;\n\ }\n"; static std::string glslPositionOnlyVertexShader = "\n\ diff --git a/src/framework/platform/win32window.cpp b/src/framework/platform/win32window.cpp index de2c9973..1e8c83d9 100644 --- a/src/framework/platform/win32window.cpp +++ b/src/framework/platform/win32window.cpp @@ -302,7 +302,7 @@ void WIN32Window::internalChooseGLVisual() 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, - 24, // Select Our Color Depth + 32, // Select Our Color Depth 8, 0, 8, 0, 8, 0, // Color Bits Ignored 8, // Alpha Buffer Bits 0, // Shift Bit Ignored diff --git a/src/framework/platform/x11window.cpp b/src/framework/platform/x11window.cpp index c28a5c92..13cfddcc 100644 --- a/src/framework/platform/x11window.cpp +++ b/src/framework/platform/x11window.cpp @@ -387,7 +387,10 @@ void X11Window::internalChooseGLVisual() static int attrList[] = { GLX_RENDER_TYPE, GLX_RGBA_BIT, GLX_DOUBLEBUFFER, True, - GLX_ALPHA_SIZE, 1, + GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, + GLX_ALPHA_SIZE, 8, None }; diff --git a/src/framework/ui/uitextedit.cpp b/src/framework/ui/uitextedit.cpp index fbb26828..d19e4aa1 100644 --- a/src/framework/ui/uitextedit.cpp +++ b/src/framework/ui/uitextedit.cpp @@ -26,6 +26,7 @@ #include #include #include +#include UITextEdit::UITextEdit() { @@ -252,6 +253,7 @@ void UITextEdit::setCursorPos(int pos) else m_cursorPos = pos; update(); + g_app->repaint(); } } @@ -514,4 +516,5 @@ bool UITextEdit::onMousePress(const Point& mousePos, Fw::MouseButton button) void UITextEdit::blinkCursor() { m_cursorTicks = g_clock.millis(); + g_app->repaint(); } diff --git a/src/framework/ui/uiwidget.cpp b/src/framework/ui/uiwidget.cpp index d305ce05..36d9b8fe 100644 --- a/src/framework/ui/uiwidget.cpp +++ b/src/framework/ui/uiwidget.cpp @@ -811,7 +811,6 @@ bool UIWidget::setRect(const Rect& rect) if(rect == oldRect) return false; - g_app->repaint(); m_rect = rect; // updates own layout @@ -1353,6 +1352,8 @@ void UIWidget::onStyleApply(const std::string& styleName, const OTMLNodePtr& sty parseBaseStyle(styleNode); parseImageStyle(styleNode); parseTextStyle(styleNode); + + g_app->repaint(); } void UIWidget::onGeometryChange(const Rect& oldRect, const Rect& newRect) @@ -1367,6 +1368,8 @@ void UIWidget::onGeometryChange(const Rect& oldRect, const Rect& newRect) } callLuaField("onGeometryChange", oldRect, newRect); + + g_app->repaint(); } void UIWidget::onLayoutUpdate() diff --git a/src/framework/ui/uiwidgettext.cpp b/src/framework/ui/uiwidgettext.cpp index 9cd396a4..50575cca 100644 --- a/src/framework/ui/uiwidgettext.cpp +++ b/src/framework/ui/uiwidgettext.cpp @@ -25,6 +25,7 @@ #include #include #include +#include void UIWidget::initText() { @@ -93,6 +94,7 @@ void UIWidget::drawText(const Rect& screenCoords) void UIWidget::onTextChange(const std::string& text, const std::string& oldText) { + g_app->repaint(); callLuaField("onTextChange", text, oldText); }