@@ -75,16 +75,8 @@ static void _twin_vnc_put_span(twin_coord_t left,
75
75
size_t span_width = right - left ;
76
76
77
77
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 );
88
80
}
89
81
90
82
static 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)
96
88
static bool _twin_vnc_work (void * closure )
97
89
{
98
90
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 );
101
94
twin_screen_update (screen );
95
+ nvnc_display_feed_buffer (tx -> display , tx -> current_fb ,
96
+ & tx -> damage_region );
97
+ }
102
98
return true;
103
99
}
104
100
@@ -262,6 +258,14 @@ twin_context_t *twin_vnc_init(int width, int height)
262
258
return NULL ;
263
259
}
264
260
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
+
265
269
static void twin_vnc_configure (twin_context_t * ctx )
266
270
{
267
271
int width , height ;
@@ -288,6 +292,7 @@ static void twin_vnc_exit(twin_context_t *ctx)
288
292
289
293
const twin_backend_t g_twin_backend = {
290
294
.init = twin_vnc_init ,
295
+ .poll = twin_vnc_poll ,
291
296
.configure = twin_vnc_configure ,
292
297
.exit = twin_vnc_exit ,
293
298
};
0 commit comments