@@ -75,16 +75,8 @@ static void _twin_vnc_put_span(twin_coord_t left,
7575 size_t span_width = right - left ;
7676
7777 memcpy (fb_pixels , pixels , span_width * sizeof (* fb_pixels ));
78-
79- pixman_region_init_rect (& tx -> damage_region , left , top , span_width , 1 );
80-
81- if (pixman_region_not_empty (& tx -> damage_region )) {
82- nvnc_display_feed_buffer (tx -> display , tx -> current_fb ,
83- & tx -> damage_region );
84- pixman_region_clear (& tx -> damage_region );
85- }
86- aml_poll (tx -> aml , 0 );
87- aml_dispatch (tx -> aml );
78+ pixman_region_union_rect (& tx -> damage_region , & tx -> damage_region , left , top ,
79+ span_width , 1 );
8880}
8981
9082static void twin_vnc_get_screen_size (twin_vnc_t * tx , int * width , int * height )
@@ -96,9 +88,13 @@ static void twin_vnc_get_screen_size(twin_vnc_t *tx, int *width, int *height)
9688static bool _twin_vnc_work (void * closure )
9789{
9890 twin_screen_t * screen = SCREEN (closure );
99-
100- if (twin_screen_damaged (screen ))
91+ twin_vnc_t * tx = PRIV (closure );
92+ if (twin_screen_damaged (screen )) {
93+ pixman_region_clear (& tx -> damage_region );
10194 twin_screen_update (screen );
95+ nvnc_display_feed_buffer (tx -> display , tx -> current_fb ,
96+ & tx -> damage_region );
97+ }
10298 return true;
10399}
104100
@@ -262,6 +258,14 @@ twin_context_t *twin_vnc_init(int width, int height)
262258 return NULL ;
263259}
264260
261+ static bool twin_vnc_poll (twin_context_t * ctx )
262+ {
263+ twin_vnc_t * tx = PRIV (ctx );
264+ aml_poll (tx -> aml , 0 );
265+ aml_dispatch (tx -> aml );
266+ return true;
267+ }
268+
265269static void twin_vnc_configure (twin_context_t * ctx )
266270{
267271 int width , height ;
@@ -288,6 +292,7 @@ static void twin_vnc_exit(twin_context_t *ctx)
288292
289293const twin_backend_t g_twin_backend = {
290294 .init = twin_vnc_init ,
295+ .poll = twin_vnc_poll ,
291296 .configure = twin_vnc_configure ,
292297 .exit = twin_vnc_exit ,
293298};
0 commit comments