4 /* Work around an -Wstrict-prototypes warning in GTK headers */
5 #pragma GCC diagnostic push
6 #pragma GCC diagnostic ignored "-Wstrict-prototypes"
8 #pragma GCC diagnostic pop
10 #include <gdk/gdkkeysyms.h>
12 #ifdef GDK_WINDOWING_X11
14 #include <X11/XKBlib.h>
17 #ifdef GDK_WINDOWING_WAYLAND
18 #include <gdk/gdkwayland.h>
21 #include "ui/clipboard.h"
22 #include "ui/console.h"
23 #include "ui/kbd-state.h"
24 #if defined(CONFIG_OPENGL)
25 #include "ui/egl-helpers.h"
26 #include "ui/egl-context.h"
29 #include "qemu/fifo8.h"
34 typedef struct GtkDisplayState GtkDisplayState
;
36 typedef struct VirtualGfxConsole
{
37 GtkWidget
*drawing_area
;
39 DisplayChangeListener dcl
;
42 pixman_image_t
*convert
;
43 cairo_surface_t
*surface
;
46 #if defined(CONFIG_OPENGL)
63 #if defined(CONFIG_VTE)
64 typedef struct VirtualVteConsole
{
74 typedef enum VirtualConsoleType
{
79 typedef struct VirtualConsole
{
86 VirtualConsoleType type
;
88 VirtualGfxConsole gfx
;
89 #if defined(CONFIG_VTE)
90 VirtualVteConsole vte
;
95 struct GtkDisplayState
{
100 GtkAccelGroup
*accel_group
;
102 GtkWidget
*machine_menu_item
;
103 GtkWidget
*machine_menu
;
104 GtkWidget
*pause_item
;
105 GtkWidget
*reset_item
;
106 GtkWidget
*powerdown_item
;
107 GtkWidget
*quit_item
;
109 GtkWidget
*view_menu_item
;
110 GtkWidget
*view_menu
;
111 GtkWidget
*full_screen_item
;
112 GtkWidget
*copy_item
;
113 GtkWidget
*zoom_in_item
;
114 GtkWidget
*zoom_out_item
;
115 GtkWidget
*zoom_fixed_item
;
116 GtkWidget
*zoom_fit_item
;
117 GtkWidget
*grab_item
;
118 GtkWidget
*grab_on_hover_item
;
121 VirtualConsole vc
[MAX_VCS
];
123 GtkWidget
*show_tabs_item
;
124 GtkWidget
*untabify_item
;
125 GtkWidget
*show_menubar_item
;
135 VirtualConsole
*kbd_owner
;
136 VirtualConsole
*ptr_owner
;
138 gboolean full_screen
;
140 GdkCursor
*null_cursor
;
141 Notifier mouse_mode_notifier
;
144 bool external_pause_update
;
146 QemuClipboardPeer cbpeer
;
147 uint32_t cbpending
[QEMU_CLIPBOARD_SELECTION__COUNT
];
148 GtkClipboard
*gtkcb
[QEMU_CLIPBOARD_SELECTION__COUNT
];
149 bool cbowner
[QEMU_CLIPBOARD_SELECTION__COUNT
];
151 DisplayOptions
*opts
;
154 extern bool gtk_use_gl_area
;
157 void gd_update_windowsize(VirtualConsole
*vc
);
158 void gd_update_monitor_refresh_rate(VirtualConsole
*vc
, GtkWidget
*widget
);
159 void gd_hw_gl_flushed(void *vc
);
162 void gd_egl_init(VirtualConsole
*vc
);
163 void gd_egl_draw(VirtualConsole
*vc
);
164 void gd_egl_update(DisplayChangeListener
*dcl
,
165 int x
, int y
, int w
, int h
);
166 void gd_egl_refresh(DisplayChangeListener
*dcl
);
167 void gd_egl_switch(DisplayChangeListener
*dcl
,
168 DisplaySurface
*surface
);
169 QEMUGLContext
gd_egl_create_context(DisplayGLCtx
*dgc
,
170 QEMUGLParams
*params
);
171 void gd_egl_scanout_disable(DisplayChangeListener
*dcl
);
172 void gd_egl_scanout_texture(DisplayChangeListener
*dcl
,
174 bool backing_y_0_top
,
175 uint32_t backing_width
,
176 uint32_t backing_height
,
177 uint32_t x
, uint32_t y
,
178 uint32_t w
, uint32_t h
,
180 void gd_egl_scanout_dmabuf(DisplayChangeListener
*dcl
,
182 void gd_egl_cursor_dmabuf(DisplayChangeListener
*dcl
,
183 QemuDmaBuf
*dmabuf
, bool have_hot
,
184 uint32_t hot_x
, uint32_t hot_y
);
185 void gd_egl_cursor_position(DisplayChangeListener
*dcl
,
186 uint32_t pos_x
, uint32_t pos_y
);
187 void gd_egl_flush(DisplayChangeListener
*dcl
,
188 uint32_t x
, uint32_t y
, uint32_t w
, uint32_t h
);
189 void gd_egl_scanout_flush(DisplayChangeListener
*dcl
,
190 uint32_t x
, uint32_t y
, uint32_t w
, uint32_t h
);
191 void gtk_egl_init(DisplayGLMode mode
);
192 int gd_egl_make_current(DisplayGLCtx
*dgc
,
195 /* ui/gtk-gl-area.c */
196 void gd_gl_area_init(VirtualConsole
*vc
);
197 void gd_gl_area_draw(VirtualConsole
*vc
);
198 void gd_gl_area_update(DisplayChangeListener
*dcl
,
199 int x
, int y
, int w
, int h
);
200 void gd_gl_area_refresh(DisplayChangeListener
*dcl
);
201 void gd_gl_area_switch(DisplayChangeListener
*dcl
,
202 DisplaySurface
*surface
);
203 QEMUGLContext
gd_gl_area_create_context(DisplayGLCtx
*dgc
,
204 QEMUGLParams
*params
);
205 void gd_gl_area_destroy_context(DisplayGLCtx
*dgc
,
207 void gd_gl_area_scanout_dmabuf(DisplayChangeListener
*dcl
,
209 void gd_gl_area_scanout_texture(DisplayChangeListener
*dcl
,
211 bool backing_y_0_top
,
212 uint32_t backing_width
,
213 uint32_t backing_height
,
214 uint32_t x
, uint32_t y
,
215 uint32_t w
, uint32_t h
,
217 void gd_gl_area_scanout_disable(DisplayChangeListener
*dcl
);
218 void gd_gl_area_scanout_flush(DisplayChangeListener
*dcl
,
219 uint32_t x
, uint32_t y
, uint32_t w
, uint32_t h
);
220 void gtk_gl_area_init(void);
221 int gd_gl_area_make_current(DisplayGLCtx
*dgc
,
224 /* gtk-clipboard.c */
225 void gd_clipboard_init(GtkDisplayState
*gd
);
227 #endif /* UI_GTK_H */