1 #ifndef __al_included_allegro5_aintern_xdisplay_h
2 #define __al_included_allegro5_aintern_xdisplay_h
3 
4 /* XXX The Raspberry Pi port does not use GLX. It currently substitutes its own
5  * ALLEGRO_DISPLAY_RASPBERRYPI for ALLEGRO_DISPLAY_XGLX by a macro renaming
6  * hack.
7  */
8 #ifndef ALLEGRO_RASPBERRYPI
9 
10 #include <GL/glx.h>
11 
12 #include "allegro5/internal/aintern_display.h"
13 #include "allegro5/internal/aintern_x.h"
14 
15 typedef struct ALLEGRO_DISPLAY_XGLX_GTK ALLEGRO_DISPLAY_XGLX_GTK;
16 typedef struct ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE;
17 
18 /* This is our version of ALLEGRO_DISPLAY with driver specific extra data. */
19 struct ALLEGRO_DISPLAY_XGLX
20 {
21    /* This must be the first member. */
22    ALLEGRO_DISPLAY display;
23 
24    /* Driver specifics. */
25 
26    const struct ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE *overridable_vt;
27 
28    Window window;
29    int xscreen; /* X Screen ID */
30    int adapter; /* allegro virtual adapter id/index */
31    GLXWindow glxwindow;
32    GLXContext context;
33    Atom wm_delete_window_atom;
34    XVisualInfo *xvinfo; /* Used when selecting the X11 visual to use. */
35    GLXFBConfig *fbc; /* Used when creating the OpenGL context. */
36    int glx_version; /* 130 means 1 major and 3 minor, aka 1.3 */
37 
38    /* Points to a structure if this display is contained by a GTK top-level
39     * window, otherwise it is NULL.
40     */
41    ALLEGRO_DISPLAY_XGLX_GTK *gtk;
42 
43    /* If our window is embedded by the XEmbed protocol, this gives
44     * the window ID of the embedder; Otherwise None.
45     */
46    Window embedder_window;
47 
48    _AL_COND mapped; /* Condition variable to wait for mapping a window. */
49    bool is_mapped;  /* Set to true when mapped. */
50 
51    int resize_count; /* Increments when resized. */
52    bool programmatic_resize; /* Set while programmatic resize in progress. */
53 
54    /* Cursor for this window. */
55    Cursor invisible_cursor;
56    Cursor current_cursor;
57    bool cursor_hidden;
58 
59    /* Icon for this window. */
60    Pixmap icon, icon_mask;
61 
62    /* Desktop position. */
63    int x, y;
64 
65    /* al_set_mouse_xy implementation */
66    bool mouse_warp;
67 
68    _AL_COND selectioned; /* Condition variable to wait for a selection event a window. */
69    bool is_selectioned;  /* Set to true when selection event received. */
70 
71 };
72 
73 void _al_display_xglx_await_resize(ALLEGRO_DISPLAY *d, int old_resize_count, bool delay_hack);
74 void _al_xglx_display_configure(ALLEGRO_DISPLAY *d, int x, int y, int width, int height, bool setglxy);
75 void _al_xglx_display_configure_event(ALLEGRO_DISPLAY *d, XEvent *event);
76 void _al_xwin_display_switch_handler(ALLEGRO_DISPLAY *d,
77    XFocusChangeEvent *event);
78 void _al_xwin_display_switch_handler_inner(ALLEGRO_DISPLAY *d, bool focus_in);
79 void _al_xwin_display_expose(ALLEGRO_DISPLAY *display, XExposeEvent *xevent);
80 
81 
82 /* An ad-hoc interface to allow the GTK backend to override some of the
83  * normal X display interface implementation.
84  */
85 struct ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE
86 {
87    bool (*create_display_hook)(ALLEGRO_DISPLAY *d, int w, int h);
88    void (*destroy_display_hook)(ALLEGRO_DISPLAY *d, bool is_last);
89    bool (*resize_display)(ALLEGRO_DISPLAY *d, int w, int h);
90    void (*set_window_title)(ALLEGRO_DISPLAY *display, const char *title);
91    void (*set_fullscreen_window)(ALLEGRO_DISPLAY *display, bool onoff);
92    void (*set_window_position)(ALLEGRO_DISPLAY *display, int x, int y);
93    bool (*set_window_constraints)(ALLEGRO_DISPLAY *display, int min_w, int min_h, int max_w, int max_h);
94 };
95 
96 bool _al_xwin_set_gtk_display_overridable_interface(uint32_t check_version,
97    const ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE *vt);
98 
99 #endif /* !ALLEGRO_RASPBERRYPI */
100 
101 #endif
102 
103 /* vim: set sts=3 sw=3 et: */
104