#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;
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)
register_displaychangelistener(&qt5_console[i].dcl);
qt5_console[i].idx = i;
}
- //mdcl->fini = maru_qt5_display_quit;
if (full_screen) {
/* TODO */
}
// 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)
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
#include "trace.h"
#include "exec/memory.h"
-#ifdef SDL_THREAD
+#ifdef CONFIG_MARU
+extern int initial_resolution_width;
+extern int initial_resolution_height;
+# ifdef SDL_THREAD
extern QemuMutex sdl_mutex;
+# endif
#endif
#define DEFAULT_BACKSCROLL 512
"Guest has not initialized the display (yet).";
int width = 640;
int height = 480;
+#ifdef CONFIG_MARU
+ if (initial_resolution_width > 0 &&
+ initial_resolution_height > 0) {
+ width = initial_resolution_width;
+ height = initial_resolution_height;
+ }
+#endif
QemuConsole *s;
DisplayState *ds;