summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-10-18 18:33:03 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2013-10-18 18:33:03 +0200
commit53f163537c034d102a33471a8ce01565c184312d (patch)
tree0ec2468705f51655c8c9b6e01f25644077752497
parentb17b3c93780156a5f3fbdaf836413f21f668d9f2 (diff)
downloadkmscon-53f163537c034d102a33471a8ce01565c184312d.tar.gz
kmscon-53f163537c034d102a33471a8ce01565c184312d.tar.bz2
kmscon-53f163537c034d102a33471a8ce01565c184312d.zip
seat: forward UTERM_REFRESH events to sessions
On UTERM_REFRESH events we now forward the event to all sessions on the bound seat. Sessions can then react to it and repaint the screen. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r--src/kmscon_main.c5
-rw-r--r--src/kmscon_seat.c41
-rw-r--r--src/kmscon_seat.h3
3 files changed, 49 insertions, 0 deletions
diff --git a/src/kmscon_main.c b/src/kmscon_main.c
index c3c94ca..cc7f3ed 100644
--- a/src/kmscon_main.c
+++ b/src/kmscon_main.c
@@ -265,6 +265,11 @@ static void app_seat_video_event(struct uterm_video *video,
case UTERM_GONE:
kmscon_seat_remove_display(vid->seat->seat, ev->display);
break;
+ case UTERM_REFRESH:
+ if (!vid->seat->app->exiting)
+ kmscon_seat_refresh_display(vid->seat->seat,
+ ev->display);
+ break;
}
}
diff --git a/src/kmscon_seat.c b/src/kmscon_seat.c
index 9565f49..5efa17b 100644
--- a/src/kmscon_seat.c
+++ b/src/kmscon_seat.c
@@ -139,6 +139,12 @@ static void session_call_display_gone(struct kmscon_session *sess,
session_call(sess, KMSCON_SESSION_DISPLAY_GONE, disp);
}
+static void session_call_display_refresh(struct kmscon_session *sess,
+ struct uterm_display *disp)
+{
+ session_call(sess, KMSCON_SESSION_DISPLAY_REFRESH, disp);
+}
+
static void activate_display(struct kmscon_display *d)
{
int ret;
@@ -513,6 +519,22 @@ static void seat_remove_display(struct kmscon_seat *seat,
free(d);
}
+static void seat_refresh_display(struct kmscon_seat *seat,
+ struct kmscon_display *d)
+{
+ struct shl_dlist *iter;
+ struct kmscon_session *s;
+
+ log_debug("refresh display %p from seat %s", d->disp, seat->name);
+
+ if (d->activated) {
+ shl_dlist_for_each(iter, &seat->sessions) {
+ s = shl_dlist_entry(iter, struct kmscon_session, list);
+ session_call_display_refresh(s, d->disp);
+ }
+ }
+}
+
static int seat_vt_event(struct uterm_vt *vt, struct uterm_vt_event *ev,
void *data)
{
@@ -843,6 +865,25 @@ void kmscon_seat_remove_display(struct kmscon_seat *seat,
}
}
+void kmscon_seat_refresh_display(struct kmscon_seat *seat,
+ struct uterm_display *disp)
+{
+ struct shl_dlist *iter;
+ struct kmscon_display *d;
+
+ if (!seat || !disp)
+ return;
+
+ shl_dlist_for_each(iter, &seat->displays) {
+ d = shl_dlist_entry(iter, struct kmscon_display, list);
+ if (d->disp != disp)
+ continue;
+
+ seat_refresh_display(seat, d);
+ break;
+ }
+}
+
int kmscon_seat_add_input(struct kmscon_seat *seat, const char *node)
{
if (!seat || !node)
diff --git a/src/kmscon_seat.h b/src/kmscon_seat.h
index 9c20eef..8116968 100644
--- a/src/kmscon_seat.h
+++ b/src/kmscon_seat.h
@@ -58,6 +58,7 @@ typedef int (*kmscon_seat_cb_t) (struct kmscon_seat *seat,
enum kmscon_session_event_type {
KMSCON_SESSION_DISPLAY_NEW,
KMSCON_SESSION_DISPLAY_GONE,
+ KMSCON_SESSION_DISPLAY_REFRESH,
KMSCON_SESSION_ACTIVATE,
KMSCON_SESSION_DEACTIVATE,
KMSCON_SESSION_UNREGISTER,
@@ -87,6 +88,8 @@ int kmscon_seat_add_display(struct kmscon_seat *seat,
struct uterm_display *disp);
void kmscon_seat_remove_display(struct kmscon_seat *seat,
struct uterm_display *disp);
+void kmscon_seat_refresh_display(struct kmscon_seat *seat,
+ struct uterm_display *disp);
int kmscon_seat_add_input(struct kmscon_seat *seat, const char *node);
void kmscon_seat_remove_input(struct kmscon_seat *seat, const char *node);