From 26788e22290a81efe6a4fcfb6beffc4b95427c76 Mon Sep 17 00:00:00 2001 From: SeokYeon Hwang Date: Sun, 9 Aug 2015 15:58:58 +0900 Subject: qt5: respect QemuConsole and DisplaySurface Change-Id: I5ae832a2ab72ab3f49aa791ba557430d2a2ab7c6 Signed-off-by: SeokYeon Hwang --- tizen/src/display/qt5.c | 32 +++++++++++++++++++++++--------- tizen/src/emul_state.c | 28 +++++++++++++++++++++------- 2 files changed, 44 insertions(+), 16 deletions(-) (limited to 'tizen') diff --git a/tizen/src/display/qt5.c b/tizen/src/display/qt5.c index f00e0e4c02..e39875847d 100644 --- a/tizen/src/display/qt5.c +++ b/tizen/src/display/qt5.c @@ -33,6 +33,10 @@ #include "qt5_supplement.h" #include "hw/pci/maru_brightness.h" +#include "util/new_debug_ch.h" + +DECLARE_DEBUG_CHANNEL(qt5_console); + /* static Notifier mouse_mode_notifier; */ static int qt5_num_outputs; @@ -63,21 +67,32 @@ int qt5_graphic_hw_display(void) static void qt5_update(DisplayChangeListener *dcl, int x, int y, int w, int h) { - DisplaySurface *surf = qemu_console_surface(dcl->con); - if (!surf) { - return; - } + struct qt5_state *con = container_of(dcl, struct qt5_state, dcl); + + assert(con->surface); - composite_brightness_image(surf->image); + composite_brightness_image(con->surface->image); - qt5_update_internal(surface_data(surf), - surface_width(surf), - surface_height(surf)); + qt5_update_internal(surface_data(con->surface), + surface_width(con->surface), + surface_height(con->surface)); } static void qt5_switch(DisplayChangeListener *dcl, DisplaySurface *new_surface) { + struct qt5_state *con = container_of(dcl, struct qt5_state, dcl); + + if (con->surface && + (surface_width(con->surface) != surface_width(new_surface) || + surface_height(con->surface) != surface_height(new_surface))) { + // TODO: we should adjust display size. + // We should warn to user since we can not adjust display size now. + LOG_WARNING("display size is changed.\n"); + } + + con->surface = new_surface; + } static void qt5_refresh(DisplayChangeListener *dcl) @@ -168,7 +183,6 @@ void maru_qt5_display_init(MaruDisplayChangeListener *mdcl, int full_screen) register_displaychangelistener(&qt5_console[i].dcl); qt5_console[i].idx = i; } - //mdcl->fini = maru_qt5_display_quit; if (full_screen) { /* TODO */ diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index a31de28b48..c064186692 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -652,8 +652,8 @@ const char *get_vm_data_path(void) } // display resolution -static int initial_resolution_width = -1; -static int initial_resolution_height = -1; +int initial_resolution_width = -1; +int initial_resolution_height = -1; #ifdef CONFIG_JAVA_UI static void set_resolution_legacy(void) @@ -685,22 +685,36 @@ void set_initial_display_resolution(int width, int height) int get_display_resolution_width(void) { -#ifdef CONFIG_JAVA_UI +#ifndef CONFIG_JAVA_UI + return qemu_console_get_width(NULL, -1); +#else + if (display_type == DT_MARU_QT_ONSCREEN || + display_type == DT_MARU_QT_OFFSCREEN) { + return qemu_console_get_width(NULL, -1); + } if (initial_resolution_width == -1) { set_resolution_legacy(); } -#endif + // for JAVA_UI return initial_resolution_width; +#endif } int get_display_resolution_height(void) { -#ifdef CONFIG_JAVA_UI - if (initial_resolution_width == -1) { +#ifndef CONFIG_JAVA_UI + return qemu_console_get_height(NULL, -1); +#else + if (display_type == DT_MARU_QT_ONSCREEN || + display_type == DT_MARU_QT_OFFSCREEN) { + return qemu_console_get_height(NULL, -1); + } + if (initial_resolution_height == -1) { set_resolution_legacy(); } -#endif + // for JAVA_UI return initial_resolution_height; +#endif } #ifdef CONFIG_JAVA_UI -- cgit v1.2.3