1/* Copyright (C) 2010 The Android Open Source Project
2**
3** This software is licensed under the terms of the GNU General Public
4** License version 2, as published by the Free Software Foundation, and
5** may be copied, distributed, and modified under those terms.
6**
7** This program is distributed in the hope that it will be useful,
8** but WITHOUT ANY WARRANTY; without even the implied warranty of
9** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10** GNU General Public License for more details.
11*/
12
13/*
14 * Contains extension to android display (see android/display.h|c) that is used
15 * by the core to communicate display changes to the attached UI
16 */
17
18#include "android/display-core.h"
19#include "qemu-common.h"
20
21/* This callback is call periodically by the GUI timer.
22 * Its purpose is to ensure that hw framebuffer updates are properly
23 * detected. Call the normal QEMU function for this here.
24 */
25static void
26coredisplay_refresh(DisplayState* ds)
27{
28    (void)ds;
29    vga_hw_update();
30}
31
32/* Don't do anything here because this callback can't differentiate
33 * between several listeners. This will be handled by a DisplayUpdateListener
34 * instead. See Android-specific changes in console.h
35 *
36 * In the core, the DisplayUpdateListener is registered by the ProxyFramebuffer
37 * object. See android/protocol/fb-updates-proxy.c.
38 */
39static void
40coredisplay_update(DisplayState* ds, int x, int y, int w, int h)
41{
42    (void)ds;
43    (void)x;
44    (void)y;
45    (void)w;
46    (void)h;
47}
48
49/* This callback is normally used to indicate that the display resolution
50 * was changed by the guest (e.g. when a Windows PC changes the display from
51 * 1024x768 to 800x600. Since this doesn't happen in Android, ignore it.
52 */
53static void
54coredisplay_resize(DisplayState* ds)
55{
56    (void)ds;
57}
58
59void
60coredisplay_init(DisplayState* ds)
61{
62    static DisplayChangeListener dcl[1];
63
64    dcl->dpy_update  = coredisplay_update;
65    dcl->dpy_refresh = coredisplay_refresh;
66    dcl->dpy_resize  = coredisplay_resize;
67    register_displaychangelistener(ds, dcl);
68}
69