Skip to content

Commit a2ef4d9

Browse files
committed
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20181001-pull-request' into staging
ui: some small fixes/improvements. # gpg: Signature made Mon 01 Oct 2018 11:42:16 BST # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>" # gpg: aka "Gerd Hoffmann <[email protected]>" # gpg: aka "Gerd Hoffmann (private) <[email protected]>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/ui-20181001-pull-request: gtk: add zoom-to-fit to gtk options. vnc: call sasl_server_init() only when required sdl2: show console #0 unconditionally Signed-off-by: Peter Maydell <[email protected]>
2 parents 24c3833 + e8b1386 commit a2ef4d9

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

qapi/ui.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,12 +1022,20 @@
10221022
# GTK display options.
10231023
#
10241024
# @grab-on-hover: Grab keyboard input on mouse hover.
1025+
# @zoom-to-fit: Zoom guest display to fit into the host window. When
1026+
# turned off the host window will be resized instead.
1027+
# In case the display device can notify the guest on
1028+
# window resizes (virtio-gpu) this will default to "on",
1029+
# assuming the guest will resize the display to match
1030+
# the window size then. Otherwise it defaults to "off".
1031+
# Since 3.1
10251032
#
10261033
# Since: 2.12
10271034
#
10281035
##
10291036
{ 'struct' : 'DisplayGTK',
1030-
'data' : { '*grab-on-hover' : 'bool' } }
1037+
'data' : { '*grab-on-hover' : 'bool',
1038+
'*zoom-to-fit' : 'bool' } }
10311039

10321040
##
10331041
# @DisplayGLMode:

ui/gtk.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,8 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
21362136
QemuConsole *con, int idx,
21372137
GSList *group, GtkWidget *view_menu)
21382138
{
2139+
bool zoom_to_fit;
2140+
21392141
vc->label = qemu_console_get_label(con);
21402142
vc->s = s;
21412143
vc->gfx.scale_x = 1.0;
@@ -2199,6 +2201,12 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
21992201
group = gd_vc_menu_init(s, vc, idx, group, view_menu);
22002202

22012203
if (dpy_ui_info_supported(vc->gfx.dcl.con)) {
2204+
zoom_to_fit = true;
2205+
}
2206+
if (s->opts->u.gtk.has_zoom_to_fit) {
2207+
zoom_to_fit = s->opts->u.gtk.zoom_to_fit;
2208+
}
2209+
if (zoom_to_fit) {
22022210
gtk_menu_item_activate(GTK_MENU_ITEM(s->zoom_fit_item));
22032211
s->free_scale = true;
22042212
}

ui/sdl2.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,8 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
806806
for (i = 0; i < sdl2_num_outputs; i++) {
807807
QemuConsole *con = qemu_console_lookup_by_index(i);
808808
assert(con != NULL);
809-
if (!qemu_console_is_graphic(con)) {
809+
if (!qemu_console_is_graphic(con) &&
810+
qemu_console_get_index(con) != 0) {
810811
sdl2_console[i].hidden = true;
811812
}
812813
sdl2_console[i].idx = i;

ui/vnc.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3821,9 +3821,6 @@ void vnc_display_open(const char *id, Error **errp)
38213821
bool reverse = false;
38223822
const char *credid;
38233823
bool sasl = false;
3824-
#ifdef CONFIG_VNC_SASL
3825-
int saslErr;
3826-
#endif
38273824
int acl = 0;
38283825
int lock_key_sync = 1;
38293826
int key_delay_ms;
@@ -3963,10 +3960,14 @@ void vnc_display_open(const char *id, Error **errp)
39633960
trace_vnc_auth_init(vd, 1, vd->ws_auth, vd->ws_subauth);
39643961

39653962
#ifdef CONFIG_VNC_SASL
3966-
if ((saslErr = sasl_server_init(NULL, "qemu")) != SASL_OK) {
3967-
error_setg(errp, "Failed to initialize SASL auth: %s",
3968-
sasl_errstring(saslErr, NULL, NULL));
3969-
goto fail;
3963+
if (sasl) {
3964+
int saslErr = sasl_server_init(NULL, "qemu");
3965+
3966+
if (saslErr != SASL_OK) {
3967+
error_setg(errp, "Failed to initialize SASL auth: %s",
3968+
sasl_errstring(saslErr, NULL, NULL));
3969+
goto fail;
3970+
}
39703971
}
39713972
#endif
39723973
vd->lock_key_sync = lock_key_sync;

0 commit comments

Comments
 (0)