aboutsummaryrefslogtreecommitdiffstats
path: root/android/display-core.c
blob: 80b7665bfb3dbee0657776dbc9931b963e331e13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* Copyright (C) 2010 The Android Open Source Project
**
** This software is licensed under the terms of the GNU General Public
** License version 2, as published by the Free Software Foundation, and
** may be copied, distributed, and modified under those terms.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
*/

/*
 * Contains extension to android display (see android/display.h|c) that is used
 * by the core to communicate display changes to the attached UI
 */

#include "android/display-core.h"
#include "qemu-common.h"

/* This callback is call periodically by the GUI timer.
 * Its purpose is to ensure that hw framebuffer updates are properly
 * detected. Call the normal QEMU function for this here.
 */
static void
coredisplay_refresh(DisplayState* ds)
{
    (void)ds;
    vga_hw_update();
}

/* Don't do anything here because this callback can't differentiate
 * between several listeners. This will be handled by a DisplayUpdateListener
 * instead. See Android-specific changes in console.h
 *
 * In the core, the DisplayUpdateListener is registered by the ProxyFramebuffer
 * object. See android/protocol/fb-updates-proxy.c.
 */
static void
coredisplay_update(DisplayState* ds, int x, int y, int w, int h)
{
    (void)ds;
    (void)x;
    (void)y;
    (void)w;
    (void)h;
}

/* This callback is normally used to indicate that the display resolution
 * was changed by the guest (e.g. when a Windows PC changes the display from
 * 1024x768 to 800x600. Since this doesn't happen in Android, ignore it.
 */
static void
coredisplay_resize(DisplayState* ds)
{
    (void)ds;
}

void
coredisplay_init(DisplayState* ds)
{
    static DisplayChangeListener dcl[1];

    dcl->dpy_update  = coredisplay_update;
    dcl->dpy_refresh = coredisplay_refresh;
    dcl->dpy_resize  = coredisplay_resize;
    register_displaychangelistener(ds, dcl);
}