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
);
179 void gd_egl_scanout_dmabuf(DisplayChangeListener
*dcl
,
181 void gd_egl_cursor_dmabuf(DisplayChangeListener
*dcl
,
182 QemuDmaBuf
*dmabuf
, bool have_hot
,
183 uint32_t hot_x
, uint32_t hot_y
);
184 void gd_egl_cursor_position(DisplayChangeListener
*dcl
,
185 uint32_t pos_x
, uint32_t pos_y
);
186 void gd_egl_flush(DisplayChangeListener
*dcl
,
187 uint32_t x
, uint32_t y
, uint32_t w
, uint32_t h
);
188 void gd_egl_scanout_flush(DisplayChangeListener
*dcl
,
189 uint32_t x
, uint32_t y
, uint32_t w
, uint32_t h
);
190 void gtk_egl_init(DisplayGLMode mode
);
191 int gd_egl_make_current(DisplayGLCtx
*dgc
,
194 /* ui/gtk-gl-area.c */
195 void gd_gl_area_init(VirtualConsole
*vc
);
196 void gd_gl_area_draw(VirtualConsole
*vc
);
197 void gd_gl_area_update(DisplayChangeListener
*dcl
,
198 int x
, int y
, int w
, int h
);
199 void gd_gl_area_refresh(DisplayChangeListener
*dcl
);
200 void gd_gl_area_switch(DisplayChangeListener
*dcl
,
201 DisplaySurface
*surface
);
202 QEMUGLContext
gd_gl_area_create_context(DisplayGLCtx
*dgc
,
203 QEMUGLParams
*params
);
204 void gd_gl_area_destroy_context(DisplayGLCtx
*dgc
,
206 void gd_gl_area_scanout_dmabuf(DisplayChangeListener
*dcl
,
208 void gd_gl_area_scanout_texture(DisplayChangeListener
*dcl
,
210 bool backing_y_0_top
,
211 uint32_t backing_width
,
212 uint32_t backing_height
,
213 uint32_t x
, uint32_t y
,
214 uint32_t w
, uint32_t h
);
215 void gd_gl_area_scanout_disable(DisplayChangeListener
*dcl
);
216 void gd_gl_area_scanout_flush(DisplayChangeListener
*dcl
,
217 uint32_t x
, uint32_t y
, uint32_t w
, uint32_t h
);
218 void gtk_gl_area_init(void);
219 int gd_gl_area_make_current(DisplayGLCtx
*dgc
,
222 /* gtk-clipboard.c */
223 void gd_clipboard_init(GtkDisplayState
*gd
);
225 #endif /* UI_GTK_H */