migration/rdma: Silence qemu_rdma_reg_control()
[qemu/armbru.git] / include / ui / gtk.h
blobaa3d637029931d1323088f28ba7c2bef9f9cbe3e
1 #ifndef UI_GTK_H
2 #define UI_GTK_H
4 /* Work around an -Wstrict-prototypes warning in GTK headers */
5 #pragma GCC diagnostic push
6 #pragma GCC diagnostic ignored "-Wstrict-prototypes"
7 #include <gtk/gtk.h>
8 #pragma GCC diagnostic pop
10 #include <gdk/gdkkeysyms.h>
12 #ifdef GDK_WINDOWING_X11
13 #include <gdk/gdkx.h>
14 #include <X11/XKBlib.h>
15 #endif
17 #ifdef GDK_WINDOWING_WAYLAND
18 #include <gdk/gdkwayland.h>
19 #endif
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"
27 #endif
28 #ifdef CONFIG_VTE
29 #include "qemu/fifo8.h"
30 #endif
32 #define MAX_VCS 10
34 typedef struct GtkDisplayState GtkDisplayState;
36 typedef struct VirtualGfxConsole {
37 GtkWidget *drawing_area;
38 DisplayGLCtx dgc;
39 DisplayChangeListener dcl;
40 QKbdState *kbd;
41 DisplaySurface *ds;
42 pixman_image_t *convert;
43 cairo_surface_t *surface;
44 double scale_x;
45 double scale_y;
46 #if defined(CONFIG_OPENGL)
47 QemuGLShader *gls;
48 EGLContext ectx;
49 EGLSurface esurface;
50 int glupdates;
51 int x, y, w, h;
52 egl_fb guest_fb;
53 egl_fb win_fb;
54 egl_fb cursor_fb;
55 int cursor_x;
56 int cursor_y;
57 bool y0_top;
58 bool scanout_mode;
59 bool has_dmabuf;
60 #endif
61 } VirtualGfxConsole;
63 #if defined(CONFIG_VTE)
64 typedef struct VirtualVteConsole {
65 GtkWidget *box;
66 GtkWidget *scrollbar;
67 GtkWidget *terminal;
68 Chardev *chr;
69 Fifo8 out_fifo;
70 bool echo;
71 } VirtualVteConsole;
72 #endif
74 typedef enum VirtualConsoleType {
75 GD_VC_GFX,
76 GD_VC_VTE,
77 } VirtualConsoleType;
79 typedef struct VirtualConsole {
80 GtkDisplayState *s;
81 char *label;
82 GtkWidget *window;
83 GtkWidget *menu_item;
84 GtkWidget *tab_item;
85 GtkWidget *focus;
86 VirtualConsoleType type;
87 union {
88 VirtualGfxConsole gfx;
89 #if defined(CONFIG_VTE)
90 VirtualVteConsole vte;
91 #endif
93 } VirtualConsole;
95 struct GtkDisplayState {
96 GtkWidget *window;
98 GtkWidget *menu_bar;
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;
120 int nb_vcs;
121 VirtualConsole vc[MAX_VCS];
123 GtkWidget *show_tabs_item;
124 GtkWidget *untabify_item;
125 GtkWidget *show_menubar_item;
127 GtkWidget *vbox;
128 GtkWidget *notebook;
129 int button_mask;
130 gboolean last_set;
131 int last_x;
132 int last_y;
133 int grab_x_root;
134 int grab_y_root;
135 VirtualConsole *kbd_owner;
136 VirtualConsole *ptr_owner;
138 gboolean full_screen;
140 GdkCursor *null_cursor;
141 Notifier mouse_mode_notifier;
142 gboolean free_scale;
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;
156 /* ui/gtk.c */
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);
161 /* ui/gtk-egl.c */
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,
173 uint32_t backing_id,
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 *d3d_tex2d);
180 void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl,
181 QemuDmaBuf *dmabuf);
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,
193 QEMUGLContext ctx);
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,
206 QEMUGLContext ctx);
207 void gd_gl_area_scanout_dmabuf(DisplayChangeListener *dcl,
208 QemuDmaBuf *dmabuf);
209 void gd_gl_area_scanout_texture(DisplayChangeListener *dcl,
210 uint32_t backing_id,
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,
216 void *d3d_tex2d);
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,
222 QEMUGLContext ctx);
224 /* gtk-clipboard.c */
225 void gd_clipboard_init(GtkDisplayState *gd);
227 #endif /* UI_GTK_H */