# HG changeset patch # User Jacob Dawid # Date 1342799756 14400 # Node ID 22bd268429d3fcaee83359c2941885101c3d1c67 # Parent 2318531b7880ec1a5824a51157fc28434617f42b Cursor is now blinking in the terminal. diff -r 2318531b7880 -r 22bd268429d3 libqterminal/unix/Filter.cpp --- a/libqterminal/unix/Filter.cpp Fri Jul 20 09:37:44 2012 -0400 +++ b/libqterminal/unix/Filter.cpp Fri Jul 20 11:55:56 2012 -0400 @@ -110,7 +110,6 @@ } return list; } -//QList FilterChain::hotSpotsAtLine(int line) const; TerminalImageFilterChain::TerminalImageFilterChain() : _buffer(0) diff -r 2318531b7880 -r 22bd268429d3 libqterminal/unix/QUnixTerminalImpl.cpp --- a/libqterminal/unix/QUnixTerminalImpl.cpp Fri Jul 20 09:37:44 2012 -0400 +++ b/libqterminal/unix/QUnixTerminalImpl.cpp Fri Jul 20 11:55:56 2012 -0400 @@ -34,6 +34,7 @@ { m_terminalView = new TerminalView(this); m_terminalView->setKeyboardCursorShape(TerminalView::UnderlineCursor); + m_terminalView->setBlinkingCursor(true); m_terminalView->setBellMode(TerminalView::NotifyBell); m_terminalView->setTerminalSizeHint(true); m_terminalView->setContextMenuPolicy(Qt::CustomContextMenu); diff -r 2318531b7880 -r 22bd268429d3 libqterminal/unix/TerminalView.cpp --- a/libqterminal/unix/TerminalView.cpp Fri Jul 20 09:37:44 2012 -0400 +++ b/libqterminal/unix/TerminalView.cpp Fri Jul 20 11:55:56 2012 -0400 @@ -63,7 +63,6 @@ // static bool TerminalView::_antialiasText = true; -bool TerminalView::HAVE_TRANSPARENCY = false; /* ------------------------------------------------------------------------- */ /* */ @@ -246,7 +245,6 @@ ,_resizing(false) ,_terminalSizeHint(false) ,_terminalSizeStartup(true) - ,_bidiEnabled(false) ,_actSel(0) ,_wordSelectionMode(false) ,_lineSelectionMode(false) @@ -500,26 +498,7 @@ return _cursorColor; } -void TerminalView::setOpacity(qreal opacity) -{ - QColor color(_blendColor); - color.setAlphaF(opacity); - - // enable automatic background filling to prevent the display - // flickering if there is no transparency - if ( color.alpha() == 255 ) - { - setAutoFillBackground(true); - } - else - { - setAutoFillBackground(false); - } - - _blendColor = color.rgba(); -} - -void TerminalView::drawBackground(QPainter& painter, const QRect& rect, const QColor& backgroundColor, bool useOpacitySetting ) +void TerminalView::drawBackground(QPainter& painter, const QRect& rect, const QColor& backgroundColor) { // the area of the widget showing the contents of the terminal display is drawn // using the background color from the color scheme set with setColorTable() @@ -532,23 +511,11 @@ QRect scrollBarArea = _scrollBar->isVisible() ? rect.intersected(_scrollBar->geometry()) : QRect(); + QRegion contentsRegion = QRegion(rect).subtracted(scrollBarArea); QRect contentsRect = contentsRegion.boundingRect(); - if ( HAVE_TRANSPARENCY && qAlpha(_blendColor) < 0xff && useOpacitySetting ) - { - QColor color(backgroundColor); - color.setAlpha(qAlpha(_blendColor)); - - painter.save(); - painter.setCompositionMode(QPainter::CompositionMode_Source); - painter.fillRect(contentsRect, color); - painter.restore(); - } - else { - painter.fillRect(contentsRect, backgroundColor); - } - + painter.fillRect(contentsRect, backgroundColor); painter.fillRect(scrollBarArea,_scrollBar->palette().background()); } @@ -665,7 +632,7 @@ // draw background if different from the display's background color if ( backgroundColor != palette().background().color() ) - drawBackground(painter,rect,backgroundColor, false /* do not use transparency */); + drawBackground(painter,rect,backgroundColor); // draw cursor shape if the current character is the cursor // this may alter the foreground and background colors @@ -1074,14 +1041,13 @@ foreach (QRect rect, (pe->region() & contentsRect()).rects()) { - drawBackground(paint,rect,palette().background().color(), true /* use opacity setting */); + drawBackground(paint,rect,palette().background().color()); drawContents(paint, rect); } // drawBackground(paint,contentsRect(),palette().background().color(), true /* use opacity setting */); // drawContents(paint, contentsRect()); - //drawInputMethodPreeditString(paint,preeditRect()); - //paintFilters(paint); - + drawInputMethodPreeditString(paint,preeditRect()); + paintFilters(paint); paint.end(); } @@ -1118,7 +1084,7 @@ const QColor foreground = _colorTable[DEFAULT_FORE_COLOR].color; const Character* style = &_image[loc(cursorPos.x(),cursorPos.y())]; - drawBackground(painter,rect,background,true); + drawBackground(painter,rect,background); drawCursor(painter,rect,foreground,background,invertColors); drawCharacters(painter,rect,_inputMethodData.preeditString,style,invertColors); diff -r 2318531b7880 -r 22bd268429d3 libqterminal/unix/TerminalView.h --- a/libqterminal/unix/TerminalView.h Fri Jul 20 09:37:44 2012 -0400 +++ b/libqterminal/unix/TerminalView.h Fri Jul 20 11:55:56 2012 -0400 @@ -84,8 +84,6 @@ */ uint randomSeed() const; - /** Sets the opacity of the terminal display. */ - void setOpacity(qreal opacity); /** * This enum describes the location where the scroll bar is positioned in the display widget. @@ -377,9 +375,6 @@ */ void setTerminalSizeStartup(bool on) { _terminalSizeStartup=on; } - void setBidiEnabled(bool set) { _bidiEnabled=set; } - bool isBidiEnabled() { return _bidiEnabled; } - /** * Sets the terminal screen section which is displayed in this widget. * When updateImage() is called, the display fetches the latest character image from the @@ -392,8 +387,6 @@ /** Returns the terminal screen section which is displayed in this widget. See setScreenWindow() */ ScreenWindow* screenWindow() const; - static bool HAVE_TRANSPARENCY; - public slots: /** @@ -568,8 +561,7 @@ // if useOpacitySetting is true then the color's alpha value will be set to // the display's transparency (set with setOpacity()), otherwise the background // will be drawn fully opaque - void drawBackground(QPainter& painter, const QRect& rect, const QColor& color, - bool useOpacitySetting); + void drawBackground(QPainter& painter, const QRect& rect, const QColor& color); // draws the cursor character void drawCursor(QPainter& painter, const QRect& rect , const QColor& foregroundColor, const QColor& backgroundColor , bool& invertColors); @@ -662,7 +654,6 @@ bool _resizing; bool _terminalSizeHint; bool _terminalSizeStartup; - bool _bidiEnabled; bool _mouseMarks; QPoint _iPntSel; // initial selection point @@ -742,12 +733,6 @@ static const int DEFAULT_TOP_MARGIN = 2; bool _readonly; - -public: - static void setTransparencyEnabled(bool enable) - { - HAVE_TRANSPARENCY = enable; - } }; #endif // TERMINALVIEW_H