static void disable_secondary_displays(SpiceMainChannel *channel, gpointer data) {
    __android_log_write(6, "android-spice", "disable_secondary_displays");

    SpiceDisplay *display = data;
    SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);

    spice_main_set_display_enabled(d->main, -1, FALSE);
    spice_main_set_display_enabled(d->main, 0, FALSE);
    spice_main_send_monitor_config(d->main);
}
void spice_display_request_resolution(SpiceDisplay *display, int w, int h) {
    SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);

    spice_main_update_display(d->main, get_display_id(display), 0, 0,
                              w, h, TRUE);
    spice_main_set_display_enabled(d->main, -1, TRUE);
    // TODO: Sending the monitor config right away may be causing guest OS to shut down.
    /*
    if (spice_main_send_monitor_config(d->main)) {
        __android_log_write(ANDROID_LOG_DEBUG, TAG, "Successfully sent monitor config");
    } else {
        __android_log_write(ANDROID_LOG_WARN, TAG, "Failed to send monitor config");
    }*/
}
JNIEXPORT void JNICALL
Java_com_iiordanov_aSPICE_SpiceCommunicator_SpiceRequestResolution(JNIEnv* env, jobject obj, jint x, jint y) {
    SpiceDisplay* display = global_display;
    SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);

    spice_main_update_display(d->main, get_display_id(display), 0, 0, x, y, TRUE);
    spice_main_set_display_enabled(d->main, -1, TRUE);
    // TODO: Sending the monitor config right away may be causing guest OS to shut down.
	/*
    if (spice_main_send_monitor_config(d->main)) {
        __android_log_write(6, "android-io", "Successfully sent monitor config");
    } else {
        __android_log_write(6, "android-io", "Failed to send monitor config");
    }*/
}
static void
show_hint_changed(VirtViewerDisplay *self)
{
    SpiceMainChannel *main_channel = get_main(self);
    guint enabled = TRUE;
    guint nth, hint = virt_viewer_display_get_show_hint(self);

    /* this may happen when finalizing */
    if (!main_channel)
        return;

    g_object_get(self, "nth-display", &nth, NULL);
    if (!(hint & VIRT_VIEWER_DISPLAY_SHOW_HINT_SET) ||
        hint & VIRT_VIEWER_DISPLAY_SHOW_HINT_DISABLED)
        enabled = FALSE;

    spice_main_set_display_enabled(main_channel, nth, enabled);
}