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"
10 #ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
11 #pragma GCC diagnostic pop
14 #include <gdk/gdkkeysyms.h>
16 #ifdef GDK_WINDOWING_X11
18 #include <X11/XKBlib.h>
21 #ifdef GDK_WINDOWING_WAYLAND
22 #include <gdk/gdkwayland.h>
25 #if defined(CONFIG_OPENGL)
26 #include "ui/egl-helpers.h"
27 #include "ui/egl-context.h"
30 /* Compatibility define to let us build on both Gtk2 and Gtk3 */
31 #if GTK_CHECK_VERSION(3, 0, 0)
32 static inline void gdk_drawable_get_size(GdkWindow *w, gint *ww, gint *wh)
34 *ww = gdk_window_get_width(w);
35 *wh = gdk_window_get_height(w);
39 typedef struct GtkDisplayState GtkDisplayState;
41 typedef struct VirtualGfxConsole {
42 GtkWidget *drawing_area;
43 DisplayChangeListener dcl;
45 pixman_image_t *convert;
46 cairo_surface_t *surface;
49 #if defined(CONFIG_OPENGL)
65 #if defined(CONFIG_VTE)
66 typedef struct VirtualVteConsole {
75 typedef enum VirtualConsoleType {
80 typedef struct VirtualConsole {
87 VirtualConsoleType type;
89 VirtualGfxConsole gfx;
90 #if defined(CONFIG_VTE)
91 VirtualVteConsole vte;
96 extern bool gtk_use_gl_area;
99 void gd_update_windowsize(VirtualConsole *vc);
102 void gd_egl_init(VirtualConsole *vc);
103 void gd_egl_draw(VirtualConsole *vc);
104 void gd_egl_update(DisplayChangeListener *dcl,
105 int x, int y, int w, int h);
106 void gd_egl_refresh(DisplayChangeListener *dcl);
107 void gd_egl_switch(DisplayChangeListener *dcl,
108 DisplaySurface *surface);
109 QEMUGLContext gd_egl_create_context(DisplayChangeListener *dcl,
110 QEMUGLParams *params);
111 void gd_egl_scanout_disable(DisplayChangeListener *dcl);
112 void gd_egl_scanout_texture(DisplayChangeListener *dcl,
114 bool backing_y_0_top,
115 uint32_t backing_width,
116 uint32_t backing_height,
117 uint32_t x, uint32_t y,
118 uint32_t w, uint32_t h);
119 void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl,
121 void gd_egl_cursor_dmabuf(DisplayChangeListener *dcl,
122 QemuDmaBuf *dmabuf, bool have_hot,
123 uint32_t hot_x, uint32_t hot_y);
124 void gd_egl_cursor_position(DisplayChangeListener *dcl,
125 uint32_t pos_x, uint32_t pos_y);
126 void gd_egl_release_dmabuf(DisplayChangeListener *dcl,
128 void gd_egl_scanout_flush(DisplayChangeListener *dcl,
129 uint32_t x, uint32_t y, uint32_t w, uint32_t h);
130 void gtk_egl_init(void);
131 int gd_egl_make_current(DisplayChangeListener *dcl,
134 /* ui/gtk-gl-area.c */
135 void gd_gl_area_init(VirtualConsole *vc);
136 void gd_gl_area_draw(VirtualConsole *vc);
137 void gd_gl_area_update(DisplayChangeListener *dcl,
138 int x, int y, int w, int h);
139 void gd_gl_area_refresh(DisplayChangeListener *dcl);
140 void gd_gl_area_switch(DisplayChangeListener *dcl,
141 DisplaySurface *surface);
142 QEMUGLContext gd_gl_area_create_context(DisplayChangeListener *dcl,
143 QEMUGLParams *params);
144 void gd_gl_area_destroy_context(DisplayChangeListener *dcl,
146 void gd_gl_area_scanout_texture(DisplayChangeListener *dcl,
148 bool backing_y_0_top,
149 uint32_t backing_width,
150 uint32_t backing_height,
151 uint32_t x, uint32_t y,
152 uint32_t w, uint32_t h);
153 void gd_gl_area_scanout_flush(DisplayChangeListener *dcl,
154 uint32_t x, uint32_t y, uint32_t w, uint32_t h);
155 void gtk_gl_area_init(void);
156 QEMUGLContext gd_gl_area_get_current_context(DisplayChangeListener *dcl);
157 int gd_gl_area_make_current(DisplayChangeListener *dcl,
160 #endif /* UI_GTK_H */