Implement issue #1219: Update the marker line when quassel loses focus
[quassel.git] / src / qtui / mainwin.cpp
index 1798256..b984e56 100644 (file)
@@ -1395,10 +1395,19 @@ void MainWin::onFullScreenToggled()
 
 bool MainWin::event(QEvent *event)
 {
-    if (event->type() == QEvent::WindowActivate) {
-        BufferId buffer = Client::bufferModel()->currentBuffer();
-        if (buffer.isValid())
-            Client::instance()->markBufferAsRead(buffer);
+    switch(event->type()) {
+    case QEvent::WindowActivate: {
+        BufferId bufferId = Client::bufferModel()->currentBuffer();
+        if (bufferId.isValid())
+            Client::instance()->markBufferAsRead(bufferId);
+        break;
+    }
+    case QEvent::WindowDeactivate:
+        if (bufferWidget()->autoMarkerLineOnLostFocus())
+            bufferWidget()->setMarkerLine();
+        break;
+    default:
+        break;
     }
     return QMainWindow::event(event);
 }