Create x11_colormap_destroy
This commit is contained in:
parent
48495980ba
commit
50cd3bc185
|
@ -30,6 +30,7 @@
|
||||||
static Atom XA_NET_WM_STATE;
|
static Atom XA_NET_WM_STATE;
|
||||||
static Atom XA_NET_WM_STATE_FULLSCREEN;
|
static Atom XA_NET_WM_STATE_FULLSCREEN;
|
||||||
static Atom XA_NET_MOVERESIZE_WINDOW;
|
static Atom XA_NET_MOVERESIZE_WINDOW;
|
||||||
|
Colormap g_x11_cmap;
|
||||||
Atom g_x11_quit_atom;
|
Atom g_x11_quit_atom;
|
||||||
static volatile sig_atomic_t g_x11_quit;
|
static volatile sig_atomic_t g_x11_quit;
|
||||||
bool g_x11_has_focus;
|
bool g_x11_has_focus;
|
||||||
|
@ -555,5 +556,14 @@ void x11_window_destroy(bool fullscreen)
|
||||||
XUnmapWindow(g_x11_dpy, g_x11_win);
|
XUnmapWindow(g_x11_dpy, g_x11_win);
|
||||||
if (!fullscreen)
|
if (!fullscreen)
|
||||||
XDestroyWindow(g_x11_dpy, g_x11_win);
|
XDestroyWindow(g_x11_dpy, g_x11_win);
|
||||||
g_x11_win = 0;
|
g_x11_win = None;
|
||||||
|
}
|
||||||
|
|
||||||
|
void x11_colormap_destroy(void)
|
||||||
|
{
|
||||||
|
if (!g_x11_cmap)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XFreeColormap(g_x11_dpy, g_x11_cmap);
|
||||||
|
g_x11_cmap = None;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ extern bool g_x11_has_focus;
|
||||||
extern Window g_x11_win;
|
extern Window g_x11_win;
|
||||||
extern Display *g_x11_dpy;
|
extern Display *g_x11_dpy;
|
||||||
extern bool g_x11_true_full;
|
extern bool g_x11_true_full;
|
||||||
|
extern Colormap g_x11_cmap;
|
||||||
|
|
||||||
void x11_show_mouse(Display *dpy, Window win, bool state);
|
void x11_show_mouse(Display *dpy, Window win, bool state);
|
||||||
void x11_windowed_fullscreen(Display *dpy, Window win);
|
void x11_windowed_fullscreen(Display *dpy, Window win);
|
||||||
|
@ -87,5 +88,7 @@ void x11_input_ctx_destroy(void);
|
||||||
|
|
||||||
void x11_window_destroy(bool fullscreen);
|
void x11_window_destroy(bool fullscreen);
|
||||||
|
|
||||||
|
void x11_colormap_destroy(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
typedef struct xv
|
typedef struct xv
|
||||||
{
|
{
|
||||||
GC gc;
|
GC gc;
|
||||||
Colormap colormap;
|
|
||||||
XShmSegmentInfo shminfo;
|
XShmSegmentInfo shminfo;
|
||||||
|
|
||||||
XvPortID port;
|
XvPortID port;
|
||||||
|
@ -485,10 +484,10 @@ static void *xv_init(const video_info_t *video,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
xv->colormap = XCreateColormap(g_x11_dpy,
|
g_x11_cmap = XCreateColormap(g_x11_dpy,
|
||||||
DefaultRootWindow(g_x11_dpy), visualinfo->visual, AllocNone);
|
DefaultRootWindow(g_x11_dpy), visualinfo->visual, AllocNone);
|
||||||
|
|
||||||
attributes.colormap = xv->colormap;
|
attributes.colormap = g_x11_cmap;
|
||||||
attributes.border_pixel = 0;
|
attributes.border_pixel = 0;
|
||||||
attributes.event_mask = StructureNotifyMask | KeyPressMask |
|
attributes.event_mask = StructureNotifyMask | KeyPressMask |
|
||||||
KeyReleaseMask | ButtonReleaseMask | ButtonPressMask | DestroyNotify | ClientMessage;
|
KeyReleaseMask | ButtonReleaseMask | ButtonPressMask | DestroyNotify | ClientMessage;
|
||||||
|
@ -827,8 +826,7 @@ static void xv_free(void *data)
|
||||||
XFree(xv->image);
|
XFree(xv->image);
|
||||||
|
|
||||||
x11_window_destroy(true);
|
x11_window_destroy(true);
|
||||||
if (xv->colormap)
|
x11_colormap_destroy();
|
||||||
XFreeColormap(g_x11_dpy, xv->colormap);
|
|
||||||
|
|
||||||
XCloseDisplay(g_x11_dpy);
|
XCloseDisplay(g_x11_dpy);
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@ typedef struct gfx_ctx_glx_data
|
||||||
bool g_is_double;
|
bool g_is_double;
|
||||||
|
|
||||||
GLXWindow g_glx_win;
|
GLXWindow g_glx_win;
|
||||||
Colormap g_cmap;
|
|
||||||
|
|
||||||
unsigned g_screen;
|
unsigned g_screen;
|
||||||
unsigned g_interval;
|
unsigned g_interval;
|
||||||
|
@ -127,11 +126,7 @@ static void ctx_glx_destroy_resources(gfx_ctx_glx_data_t *glx)
|
||||||
x11_window_destroy(false);
|
x11_window_destroy(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (glx->g_cmap)
|
x11_colormap_destroy();
|
||||||
{
|
|
||||||
XFreeColormap(g_x11_dpy, glx->g_cmap);
|
|
||||||
glx->g_cmap = None;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (glx->g_should_reset_mode)
|
if (glx->g_should_reset_mode)
|
||||||
{
|
{
|
||||||
|
@ -323,7 +318,7 @@ static bool gfx_ctx_glx_set_video_mode(void *data,
|
||||||
if (!vi)
|
if (!vi)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
swa.colormap = glx->g_cmap = XCreateColormap(g_x11_dpy,
|
swa.colormap = g_x11_cmap = XCreateColormap(g_x11_dpy,
|
||||||
RootWindow(g_x11_dpy, vi->screen), vi->visual, AllocNone);
|
RootWindow(g_x11_dpy, vi->screen), vi->visual, AllocNone);
|
||||||
swa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask |
|
swa.event_mask = StructureNotifyMask | KeyPressMask | KeyReleaseMask |
|
||||||
ButtonReleaseMask | ButtonPressMask;
|
ButtonReleaseMask | ButtonPressMask;
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#define EGL_OPENGL_ES3_BIT_KHR 0x0040
|
#define EGL_OPENGL_ES3_BIT_KHR 0x0040
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static Colormap g_cmap;
|
|
||||||
static unsigned g_screen;
|
static unsigned g_screen;
|
||||||
|
|
||||||
static bool g_use_hw_ctx;
|
static bool g_use_hw_ctx;
|
||||||
|
@ -337,7 +336,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
||||||
if (!vi)
|
if (!vi)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
swa.colormap = g_cmap = XCreateColormap(g_x11_dpy, RootWindow(g_x11_dpy, vi->screen),
|
swa.colormap = g_x11_cmap = XCreateColormap(g_x11_dpy, RootWindow(g_x11_dpy, vi->screen),
|
||||||
vi->visual, AllocNone);
|
vi->visual, AllocNone);
|
||||||
swa.event_mask = StructureNotifyMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask | KeyReleaseMask;
|
swa.event_mask = StructureNotifyMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask | KeyReleaseMask;
|
||||||
swa.override_redirect = fullscreen ? True : False;
|
swa.override_redirect = fullscreen ? True : False;
|
||||||
|
@ -536,11 +535,7 @@ static void gfx_ctx_xegl_destroy(void *data)
|
||||||
x11_window_destroy(false);
|
x11_window_destroy(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_cmap)
|
x11_colormap_destroy();
|
||||||
{
|
|
||||||
XFreeColormap(g_x11_dpy, g_cmap);
|
|
||||||
g_cmap = None;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_should_reset_mode)
|
if (g_should_reset_mode)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue