@@ -66,7 +66,6 @@ struct DisplayState {
66
66
};
67
67
68
68
static DisplayState * display_state ;
69
- static QemuConsole * active_console ;
70
69
static QTAILQ_HEAD (, QemuConsole ) consoles =
71
70
QTAILQ_HEAD_INITIALIZER (consoles );
72
71
@@ -135,7 +134,6 @@ void graphic_hw_update_done(QemuConsole *con)
135
134
void graphic_hw_update (QemuConsole * con )
136
135
{
137
136
bool async = false;
138
- con = con ? con : active_console ;
139
137
if (!con ) {
140
138
return ;
141
139
}
@@ -209,19 +207,13 @@ void qemu_console_set_window_id(QemuConsole *con, int window_id)
209
207
210
208
void graphic_hw_invalidate (QemuConsole * con )
211
209
{
212
- if (!con ) {
213
- con = active_console ;
214
- }
215
210
if (con && con -> hw_ops -> invalidate ) {
216
211
con -> hw_ops -> invalidate (con -> hw );
217
212
}
218
213
}
219
214
220
215
void graphic_hw_text_update (QemuConsole * con , console_ch_t * chardata )
221
216
{
222
- if (!con ) {
223
- con = active_console ;
224
- }
225
217
if (con && con -> hw_ops -> text_update ) {
226
218
con -> hw_ops -> text_update (con -> hw , chardata );
227
219
}
@@ -265,12 +257,12 @@ static void dpy_gfx_update_texture(QemuConsole *con, DisplaySurface *surface,
265
257
}
266
258
267
259
static void displaychangelistener_display_console (DisplayChangeListener * dcl ,
268
- QemuConsole * con ,
269
260
Error * * errp )
270
261
{
271
262
static const char nodev [] =
272
263
"This VM has no graphic display device." ;
273
264
static DisplaySurface * dummy ;
265
+ QemuConsole * con = dcl -> con ;
274
266
275
267
if (!con || !console_compatible_with (con , dcl , errp )) {
276
268
if (!dummy ) {
@@ -305,39 +297,8 @@ static void displaychangelistener_display_console(DisplayChangeListener *dcl,
305
297
}
306
298
}
307
299
308
- void console_select (unsigned int index )
309
- {
310
- DisplayChangeListener * dcl ;
311
- QemuConsole * s ;
312
-
313
- trace_console_select (index );
314
- s = qemu_console_lookup_by_index (index );
315
- if (s ) {
316
- DisplayState * ds = s -> ds ;
317
-
318
- active_console = s ;
319
- QLIST_FOREACH (dcl , & ds -> listeners , next ) {
320
- if (dcl -> con != NULL ) {
321
- continue ;
322
- }
323
- displaychangelistener_display_console (dcl , s , NULL );
324
- }
325
-
326
- if (QEMU_IS_TEXT_CONSOLE (s )) {
327
- qemu_text_console_select (QEMU_TEXT_CONSOLE (s ));
328
- }
329
- }
330
- }
331
-
332
300
void qemu_text_console_put_keysym (QemuTextConsole * s , int keysym )
333
301
{
334
- if (!s ) {
335
- if (!QEMU_IS_TEXT_CONSOLE (active_console )) {
336
- return ;
337
- }
338
- s = QEMU_TEXT_CONSOLE (active_console );
339
- }
340
-
341
302
qemu_text_console_handle_keysym (s , keysym );
342
303
}
343
304
@@ -392,11 +353,6 @@ qemu_console_register(QemuConsole *c)
392
353
{
393
354
int i ;
394
355
395
- if (!active_console || (!QEMU_IS_GRAPHIC_CONSOLE (active_console ) &&
396
- QEMU_IS_GRAPHIC_CONSOLE (c ))) {
397
- active_console = c ;
398
- }
399
-
400
356
if (QTAILQ_EMPTY (& consoles )) {
401
357
c -> index = 0 ;
402
358
QTAILQ_INSERT_TAIL (& consoles , c , next );
@@ -751,8 +707,6 @@ dcl_set_graphic_cursor(DisplayChangeListener *dcl, QemuGraphicConsole *con)
751
707
752
708
void register_displaychangelistener (DisplayChangeListener * dcl )
753
709
{
754
- QemuConsole * con ;
755
-
756
710
assert (!dcl -> ds );
757
711
758
712
trace_displaychangelistener_register (dcl , dcl -> ops -> dpy_name );
@@ -761,13 +715,12 @@ void register_displaychangelistener(DisplayChangeListener *dcl)
761
715
gui_setup_refresh (dcl -> ds );
762
716
if (dcl -> con ) {
763
717
dcl -> con -> dcls ++ ;
764
- con = dcl -> con ;
765
- } else {
766
- con = active_console ;
767
718
}
768
- displaychangelistener_display_console (dcl , con , dcl -> con ? & error_fatal : NULL );
769
- if (QEMU_IS_GRAPHIC_CONSOLE (con )) {
770
- dcl_set_graphic_cursor (dcl , QEMU_GRAPHIC_CONSOLE (con ));
719
+ displaychangelistener_display_console (dcl , & error_fatal );
720
+ if (QEMU_IS_GRAPHIC_CONSOLE (dcl -> con )) {
721
+ dcl_set_graphic_cursor (dcl , QEMU_GRAPHIC_CONSOLE (dcl -> con ));
722
+ } else if (QEMU_IS_TEXT_CONSOLE (dcl -> con )) {
723
+ qemu_text_console_update_size (QEMU_TEXT_CONSOLE (dcl -> con ));
771
724
}
772
725
qemu_text_console_update_cursor ();
773
726
}
@@ -805,9 +758,6 @@ static void dpy_set_ui_info_timer(void *opaque)
805
758
806
759
bool dpy_ui_info_supported (const QemuConsole * con )
807
760
{
808
- if (con == NULL ) {
809
- con = active_console ;
810
- }
811
761
if (con == NULL ) {
812
762
return false;
813
763
}
@@ -819,19 +769,11 @@ const QemuUIInfo *dpy_get_ui_info(const QemuConsole *con)
819
769
{
820
770
assert (dpy_ui_info_supported (con ));
821
771
822
- if (con == NULL ) {
823
- con = active_console ;
824
- }
825
-
826
772
return & con -> ui_info ;
827
773
}
828
774
829
775
int dpy_set_ui_info (QemuConsole * con , QemuUIInfo * info , bool delay )
830
776
{
831
- if (con == NULL ) {
832
- con = active_console ;
833
- }
834
-
835
777
if (!dpy_ui_info_supported (con )) {
836
778
return -1 ;
837
779
}
@@ -870,7 +812,7 @@ void dpy_gfx_update(QemuConsole *con, int x, int y, int w, int h)
870
812
}
871
813
dpy_gfx_update_texture (con , con -> surface , x , y , w , h );
872
814
QLIST_FOREACH (dcl , & s -> listeners , next ) {
873
- if (con != ( dcl -> con ? dcl -> con : active_console ) ) {
815
+ if (con != dcl -> con ) {
874
816
continue ;
875
817
}
876
818
if (dcl -> ops -> dpy_gfx_update ) {
@@ -916,7 +858,7 @@ void dpy_gfx_replace_surface(QemuConsole *con,
916
858
con -> surface = new_surface ;
917
859
dpy_gfx_create_texture (con , new_surface );
918
860
QLIST_FOREACH (dcl , & s -> listeners , next ) {
919
- if (con != ( dcl -> con ? dcl -> con : active_console ) ) {
861
+ if (con != dcl -> con ) {
920
862
continue ;
921
863
}
922
864
displaychangelistener_gfx_switch (dcl , new_surface , surface ? FALSE : TRUE);
@@ -970,7 +912,7 @@ void dpy_text_cursor(QemuConsole *con, int x, int y)
970
912
return ;
971
913
}
972
914
QLIST_FOREACH (dcl , & s -> listeners , next ) {
973
- if (con != ( dcl -> con ? dcl -> con : active_console ) ) {
915
+ if (con != dcl -> con ) {
974
916
continue ;
975
917
}
976
918
if (dcl -> ops -> dpy_text_cursor ) {
@@ -988,7 +930,7 @@ void dpy_text_update(QemuConsole *con, int x, int y, int w, int h)
988
930
return ;
989
931
}
990
932
QLIST_FOREACH (dcl , & s -> listeners , next ) {
991
- if (con != ( dcl -> con ? dcl -> con : active_console ) ) {
933
+ if (con != dcl -> con ) {
992
934
continue ;
993
935
}
994
936
if (dcl -> ops -> dpy_text_update ) {
@@ -1006,7 +948,7 @@ void dpy_text_resize(QemuConsole *con, int w, int h)
1006
948
return ;
1007
949
}
1008
950
QLIST_FOREACH (dcl , & s -> listeners , next ) {
1009
- if (con != ( dcl -> con ? dcl -> con : active_console ) ) {
951
+ if (con != dcl -> con ) {
1010
952
continue ;
1011
953
}
1012
954
if (dcl -> ops -> dpy_text_resize ) {
@@ -1028,7 +970,7 @@ void dpy_mouse_set(QemuConsole *c, int x, int y, int on)
1028
970
return ;
1029
971
}
1030
972
QLIST_FOREACH (dcl , & s -> listeners , next ) {
1031
- if (c != ( dcl -> con ? dcl -> con : active_console ) ) {
973
+ if (c != dcl -> con ) {
1032
974
continue ;
1033
975
}
1034
976
if (dcl -> ops -> dpy_mouse_set ) {
@@ -1049,7 +991,7 @@ void dpy_cursor_define(QemuConsole *c, QEMUCursor *cursor)
1049
991
return ;
1050
992
}
1051
993
QLIST_FOREACH (dcl , & s -> listeners , next ) {
1052
- if (c != ( dcl -> con ? dcl -> con : active_console ) ) {
994
+ if (c != dcl -> con ) {
1053
995
continue ;
1054
996
}
1055
997
if (dcl -> ops -> dpy_cursor_define ) {
@@ -1099,7 +1041,7 @@ void dpy_gl_scanout_disable(QemuConsole *con)
1099
1041
con -> scanout .kind = SCANOUT_NONE ;
1100
1042
}
1101
1043
QLIST_FOREACH (dcl , & s -> listeners , next ) {
1102
- if (con != ( dcl -> con ? dcl -> con : active_console ) ) {
1044
+ if (con != dcl -> con ) {
1103
1045
continue ;
1104
1046
}
1105
1047
if (dcl -> ops -> dpy_gl_scanout_disable ) {
@@ -1126,7 +1068,7 @@ void dpy_gl_scanout_texture(QemuConsole *con,
1126
1068
x , y , width , height , d3d_tex2d ,
1127
1069
};
1128
1070
QLIST_FOREACH (dcl , & s -> listeners , next ) {
1129
- if (con != ( dcl -> con ? dcl -> con : active_console ) ) {
1071
+ if (con != dcl -> con ) {
1130
1072
continue ;
1131
1073
}
1132
1074
if (dcl -> ops -> dpy_gl_scanout_texture ) {
@@ -1148,7 +1090,7 @@ void dpy_gl_scanout_dmabuf(QemuConsole *con,
1148
1090
con -> scanout .kind = SCANOUT_DMABUF ;
1149
1091
con -> scanout .dmabuf = dmabuf ;
1150
1092
QLIST_FOREACH (dcl , & s -> listeners , next ) {
1151
- if (con != ( dcl -> con ? dcl -> con : active_console ) ) {
1093
+ if (con != dcl -> con ) {
1152
1094
continue ;
1153
1095
}
1154
1096
if (dcl -> ops -> dpy_gl_scanout_dmabuf ) {
@@ -1164,7 +1106,7 @@ void dpy_gl_cursor_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf,
1164
1106
DisplayChangeListener * dcl ;
1165
1107
1166
1108
QLIST_FOREACH (dcl , & s -> listeners , next ) {
1167
- if (con != ( dcl -> con ? dcl -> con : active_console ) ) {
1109
+ if (con != dcl -> con ) {
1168
1110
continue ;
1169
1111
}
1170
1112
if (dcl -> ops -> dpy_gl_cursor_dmabuf ) {
@@ -1181,7 +1123,7 @@ void dpy_gl_cursor_position(QemuConsole *con,
1181
1123
DisplayChangeListener * dcl ;
1182
1124
1183
1125
QLIST_FOREACH (dcl , & s -> listeners , next ) {
1184
- if (con != ( dcl -> con ? dcl -> con : active_console ) ) {
1126
+ if (con != dcl -> con ) {
1185
1127
continue ;
1186
1128
}
1187
1129
if (dcl -> ops -> dpy_gl_cursor_position ) {
@@ -1197,7 +1139,7 @@ void dpy_gl_release_dmabuf(QemuConsole *con,
1197
1139
DisplayChangeListener * dcl ;
1198
1140
1199
1141
QLIST_FOREACH (dcl , & s -> listeners , next ) {
1200
- if (con != ( dcl -> con ? dcl -> con : active_console ) ) {
1142
+ if (con != dcl -> con ) {
1201
1143
continue ;
1202
1144
}
1203
1145
if (dcl -> ops -> dpy_gl_release_dmabuf ) {
@@ -1216,7 +1158,7 @@ void dpy_gl_update(QemuConsole *con,
1216
1158
1217
1159
graphic_hw_gl_block (con , true);
1218
1160
QLIST_FOREACH (dcl , & s -> listeners , next ) {
1219
- if (con != ( dcl -> con ? dcl -> con : active_console ) ) {
1161
+ if (con != dcl -> con ) {
1220
1162
continue ;
1221
1163
}
1222
1164
if (dcl -> ops -> dpy_gl_update ) {
@@ -1415,30 +1357,21 @@ static QemuConsole *qemu_graphic_console_lookup_unused(void)
1415
1357
1416
1358
QEMUCursor * qemu_console_get_cursor (QemuConsole * con )
1417
1359
{
1418
- if (con == NULL ) {
1419
- con = active_console ;
1420
- }
1421
1360
return QEMU_IS_GRAPHIC_CONSOLE (con ) ? QEMU_GRAPHIC_CONSOLE (con )-> cursor : NULL ;
1422
1361
}
1423
1362
1424
1363
bool qemu_console_is_visible (QemuConsole * con )
1425
1364
{
1426
- return ( con == active_console ) || ( con -> dcls > 0 ) ;
1365
+ return con -> dcls > 0 ;
1427
1366
}
1428
1367
1429
1368
bool qemu_console_is_graphic (QemuConsole * con )
1430
1369
{
1431
- if (con == NULL ) {
1432
- con = active_console ;
1433
- }
1434
1370
return con && QEMU_IS_GRAPHIC_CONSOLE (con );
1435
1371
}
1436
1372
1437
1373
bool qemu_console_is_fixedsize (QemuConsole * con )
1438
1374
{
1439
- if (con == NULL ) {
1440
- con = active_console ;
1441
- }
1442
1375
return con && (QEMU_IS_GRAPHIC_CONSOLE (con ) || QEMU_IS_FIXED_TEXT_CONSOLE (con ));
1443
1376
}
1444
1377
@@ -1505,17 +1438,11 @@ char *qemu_console_get_label(QemuConsole *con)
1505
1438
1506
1439
int qemu_console_get_index (QemuConsole * con )
1507
1440
{
1508
- if (con == NULL ) {
1509
- con = active_console ;
1510
- }
1511
1441
return con ? con -> index : -1 ;
1512
1442
}
1513
1443
1514
1444
uint32_t qemu_console_get_head (QemuConsole * con )
1515
1445
{
1516
- if (con == NULL ) {
1517
- con = active_console ;
1518
- }
1519
1446
if (con == NULL ) {
1520
1447
return -1 ;
1521
1448
}
@@ -1527,9 +1454,6 @@ uint32_t qemu_console_get_head(QemuConsole *con)
1527
1454
1528
1455
int qemu_console_get_width (QemuConsole * con , int fallback )
1529
1456
{
1530
- if (con == NULL ) {
1531
- con = active_console ;
1532
- }
1533
1457
if (con == NULL ) {
1534
1458
return fallback ;
1535
1459
}
@@ -1547,9 +1471,6 @@ int qemu_console_get_width(QemuConsole *con, int fallback)
1547
1471
1548
1472
int qemu_console_get_height (QemuConsole * con , int fallback )
1549
1473
{
1550
- if (con == NULL ) {
1551
- con = active_console ;
1552
- }
1553
1474
if (con == NULL ) {
1554
1475
return fallback ;
1555
1476
}
0 commit comments