ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
Blob Blame History Raw
From 3ec19e5d91d3d705682fee62a509801737c56c1e Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Sat, 20 Sep 2014 11:11:07 +0200
Subject: [PATCH] terminal: grdev: raise frame event after DISPLAY_ADD/CHANGE

Whenever a display is added or changed, we suppressed any frame events.
Make sure to raise them manually so we can avoid rendering when handling
anything but FRAME events.
---
 src/libsystemd-terminal/grdev.c   | 11 +++++++----
 src/libsystemd-terminal/modeset.c |  2 --
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/libsystemd-terminal/grdev.c b/src/libsystemd-terminal/grdev.c
index 3e3833fc95..397da1b205 100644
--- a/src/libsystemd-terminal/grdev.c
+++ b/src/libsystemd-terminal/grdev.c
@@ -921,14 +921,17 @@ static void session_change_display(grdev_session *session, grdev_display *displa
 
         changed = display_cache(display);
 
-        if (display->n_leafs == 0)
+        if (display->n_leafs == 0) {
                 session_remove_display(session, display);
-        else if (!display->public)
+        } else if (!display->public) {
                 session_add_display(session, display);
-        else if (changed)
+                session_frame(session, display);
+        } else if (changed) {
                 session_raise_display_change(session, display);
-        else if (display->framed)
                 session_frame(session, display);
+        } else if (display->framed) {
+                session_frame(session, display);
+        }
 }
 
 static void session_frame(grdev_session *session, grdev_display *display) {
diff --git a/src/libsystemd-terminal/modeset.c b/src/libsystemd-terminal/modeset.c
index 57bf299df5..33c79a2036 100644
--- a/src/libsystemd-terminal/modeset.c
+++ b/src/libsystemd-terminal/modeset.c
@@ -270,12 +270,10 @@ static void modeset_grdev_fn(grdev_session *session, void *userdata, grdev_event
         switch (ev->type) {
         case GRDEV_EVENT_DISPLAY_ADD:
                 grdev_display_enable(ev->display_add.display);
-                modeset_render(m, ev->display_add.display);
                 break;
         case GRDEV_EVENT_DISPLAY_REMOVE:
                 break;
         case GRDEV_EVENT_DISPLAY_CHANGE:
-                modeset_render(m, ev->display_change.display);
                 break;
         case GRDEV_EVENT_DISPLAY_FRAME:
                 modeset_render(m, ev->display_frame.display);