On 11/18/21 23:51, Dongwon Kim wrote:
+# @mon-num: Indicate monitor where Qemu window is lauched. mon-num +# could be any number from -1 to (total num of monitors - 1). +# (default: -1: use default monitor) +# since 6.2
There is no need to accept -1; the opts->u.gtk struct uses a separate boolean field to indicate the default. Instead, the parameter should be an unsigned integer ("uint32").
Also please use "monitor", not "mon-num". We usually avoid abbreviations.
+ if (opts->u.gtk.has_mon_num && opts->u.gtk.mon_num && + opts->u.gtk.mon_num >= 0) {
Rejecting 0 ("opts->u.gtk.mon_num") is incorrect. If you declare it as unsigned, you can just use "if (opts->u.gtk.has_mon_num").
Thanks, Paolo
+ GdkRectangle mon_dest; + if (opts->u.gtk.mon_num < gdk_display_get_n_monitors(window_display)) { + gdk_monitor_get_geometry( + gdk_display_get_monitor(window_display, opts->u.gtk.mon_num), + &mon_dest); + gtk_window_move(GTK_WINDOW(s->window), mon_dest.x, mon_dest.y); + } + } if (opts->has_full_screen && opts->full_screen) { gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item)); --