]>
Commit | Line | Data |
---|---|---|
dc7ff344 GH |
1 | #ifndef UI_GTK_H |
2 | #define UI_GTK_H | |
3 | ||
dc7ff344 GH |
4 | #ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE |
5 | /* Work around an -Wstrict-prototypes warning in GTK headers */ | |
6 | #pragma GCC diagnostic push | |
7 | #pragma GCC diagnostic ignored "-Wstrict-prototypes" | |
8 | #endif | |
9 | #include <gtk/gtk.h> | |
10 | #ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE | |
11 | #pragma GCC diagnostic pop | |
12 | #endif | |
13 | ||
14 | #include <gdk/gdkkeysyms.h> | |
15 | ||
16 | #ifdef GDK_WINDOWING_X11 | |
17 | #include <gdk/gdkx.h> | |
18 | #include <X11/XKBlib.h> | |
19 | #endif | |
20 | ||
97edf3bd GH |
21 | #if defined(CONFIG_OPENGL) |
22 | #include "ui/egl-helpers.h" | |
4782aeb7 | 23 | #include "ui/egl-context.h" |
97edf3bd GH |
24 | #endif |
25 | ||
dc7ff344 GH |
26 | /* Compatibility define to let us build on both Gtk2 and Gtk3 */ |
27 | #if GTK_CHECK_VERSION(3, 0, 0) | |
28 | static inline void gdk_drawable_get_size(GdkWindow *w, gint *ww, gint *wh) | |
29 | { | |
30 | *ww = gdk_window_get_width(w); | |
31 | *wh = gdk_window_get_height(w); | |
32 | } | |
33 | #endif | |
34 | ||
35 | typedef struct GtkDisplayState GtkDisplayState; | |
36 | ||
37 | typedef struct VirtualGfxConsole { | |
38 | GtkWidget *drawing_area; | |
39 | DisplayChangeListener dcl; | |
40 | DisplaySurface *ds; | |
41 | pixman_image_t *convert; | |
42 | cairo_surface_t *surface; | |
43 | double scale_x; | |
44 | double scale_y; | |
97edf3bd GH |
45 | #if defined(CONFIG_OPENGL) |
46 | ConsoleGLState *gls; | |
47 | EGLContext ectx; | |
48 | EGLSurface esurface; | |
49 | int glupdates; | |
4782aeb7 GH |
50 | int x, y, w, h; |
51 | GLuint tex_id; | |
52 | GLuint fbo_id; | |
53 | bool y0_top; | |
54 | bool scanout_mode; | |
97edf3bd | 55 | #endif |
dc7ff344 GH |
56 | } VirtualGfxConsole; |
57 | ||
58 | #if defined(CONFIG_VTE) | |
59 | typedef struct VirtualVteConsole { | |
60 | GtkWidget *box; | |
61 | GtkWidget *scrollbar; | |
62 | GtkWidget *terminal; | |
63 | CharDriverState *chr; | |
64 | } VirtualVteConsole; | |
65 | #endif | |
66 | ||
67 | typedef enum VirtualConsoleType { | |
68 | GD_VC_GFX, | |
69 | GD_VC_VTE, | |
70 | } VirtualConsoleType; | |
71 | ||
72 | typedef struct VirtualConsole { | |
73 | GtkDisplayState *s; | |
74 | char *label; | |
75 | GtkWidget *window; | |
76 | GtkWidget *menu_item; | |
77 | GtkWidget *tab_item; | |
78 | GtkWidget *focus; | |
79 | VirtualConsoleType type; | |
80 | union { | |
81 | VirtualGfxConsole gfx; | |
82 | #if defined(CONFIG_VTE) | |
83 | VirtualVteConsole vte; | |
84 | #endif | |
85 | }; | |
86 | } VirtualConsole; | |
87 | ||
97edf3bd GH |
88 | /* ui/gtk.c */ |
89 | void gd_update_windowsize(VirtualConsole *vc); | |
90 | ||
91 | /* ui/gtk-egl.c */ | |
92 | void gd_egl_init(VirtualConsole *vc); | |
93 | void gd_egl_draw(VirtualConsole *vc); | |
94 | void gd_egl_update(DisplayChangeListener *dcl, | |
95 | int x, int y, int w, int h); | |
96 | void gd_egl_refresh(DisplayChangeListener *dcl); | |
97 | void gd_egl_switch(DisplayChangeListener *dcl, | |
98 | DisplaySurface *surface); | |
4782aeb7 GH |
99 | QEMUGLContext gd_egl_create_context(DisplayChangeListener *dcl, |
100 | QEMUGLParams *params); | |
101 | void gd_egl_scanout(DisplayChangeListener *dcl, | |
102 | uint32_t backing_id, bool backing_y_0_top, | |
103 | uint32_t x, uint32_t y, | |
104 | uint32_t w, uint32_t h); | |
105 | void gd_egl_scanout_flush(DisplayChangeListener *dcl, | |
106 | uint32_t x, uint32_t y, uint32_t w, uint32_t h); | |
97edf3bd | 107 | void gtk_egl_init(void); |
4782aeb7 GH |
108 | int gd_egl_make_current(DisplayChangeListener *dcl, |
109 | QEMUGLContext ctx); | |
97edf3bd | 110 | |
dc7ff344 | 111 | #endif /* UI_GTK_H */ |