mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
Wayland: Cleanup
Make Wayland code use 'native' in the same senses as the rest of GLFW.
(cherry picked from commit 5002522f73
)
This commit is contained in:
parent
6b9087c575
commit
35fd90aff1
@ -65,7 +65,7 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR
|
|||||||
#define _glfw_dlclose(handle) dlclose(handle)
|
#define _glfw_dlclose(handle) dlclose(handle)
|
||||||
#define _glfw_dlsym(handle, name) dlsym(handle, name)
|
#define _glfw_dlsym(handle, name) dlsym(handle, name)
|
||||||
|
|
||||||
#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->wl.native)
|
#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->wl.egl.window)
|
||||||
#define _GLFW_EGL_NATIVE_DISPLAY ((EGLNativeDisplayType) _glfw.wl.display)
|
#define _GLFW_EGL_NATIVE_DISPLAY ((EGLNativeDisplayType) _glfw.wl.display)
|
||||||
|
|
||||||
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWayland wl
|
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWayland wl
|
||||||
@ -181,9 +181,12 @@ typedef struct _GLFWwindowWayland
|
|||||||
GLFWbool hovered;
|
GLFWbool hovered;
|
||||||
GLFWbool transparent;
|
GLFWbool transparent;
|
||||||
struct wl_surface* surface;
|
struct wl_surface* surface;
|
||||||
struct wl_egl_window* native;
|
|
||||||
struct wl_callback* callback;
|
struct wl_callback* callback;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct wl_egl_window* window;
|
||||||
|
} egl;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int width, height;
|
int width, height;
|
||||||
} pending;
|
} pending;
|
||||||
|
@ -347,7 +347,7 @@ static void resizeWindow(_GLFWwindow* window)
|
|||||||
int scale = window->wl.scale;
|
int scale = window->wl.scale;
|
||||||
int scaledWidth = window->wl.width * scale;
|
int scaledWidth = window->wl.width * scale;
|
||||||
int scaledHeight = window->wl.height * scale;
|
int scaledHeight = window->wl.height * scale;
|
||||||
wl_egl_window_resize(window->wl.native, scaledWidth, scaledHeight, 0, 0);
|
wl_egl_window_resize(window->wl.egl.window, scaledWidth, scaledHeight, 0, 0);
|
||||||
if (!window->wl.transparent)
|
if (!window->wl.transparent)
|
||||||
setOpaqueRegion(window);
|
setOpaqueRegion(window);
|
||||||
_glfwInputFramebufferSize(window, scaledWidth, scaledHeight);
|
_glfwInputFramebufferSize(window, scaledWidth, scaledHeight);
|
||||||
@ -709,9 +709,9 @@ static GLFWbool createXdgSurface(_GLFWwindow* window)
|
|||||||
return GLFW_TRUE;
|
return GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLFWbool createSurface(_GLFWwindow* window,
|
static GLFWbool createNativeSurface(_GLFWwindow* window,
|
||||||
const _GLFWwndconfig* wndconfig,
|
const _GLFWwndconfig* wndconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
{
|
{
|
||||||
window->wl.surface = wl_compositor_create_surface(_glfw.wl.compositor);
|
window->wl.surface = wl_compositor_create_surface(_glfw.wl.compositor);
|
||||||
if (!window->wl.surface)
|
if (!window->wl.surface)
|
||||||
@ -723,10 +723,10 @@ static GLFWbool createSurface(_GLFWwindow* window,
|
|||||||
|
|
||||||
wl_surface_set_user_data(window->wl.surface, window);
|
wl_surface_set_user_data(window->wl.surface, window);
|
||||||
|
|
||||||
window->wl.native = wl_egl_window_create(window->wl.surface,
|
window->wl.egl.window = wl_egl_window_create(window->wl.surface,
|
||||||
wndconfig->width,
|
wndconfig->width,
|
||||||
wndconfig->height);
|
wndconfig->height);
|
||||||
if (!window->wl.native)
|
if (!window->wl.egl.window)
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
|
||||||
window->wl.width = wndconfig->width;
|
window->wl.width = wndconfig->width;
|
||||||
@ -1826,7 +1826,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
const _GLFWctxconfig* ctxconfig,
|
const _GLFWctxconfig* ctxconfig,
|
||||||
const _GLFWfbconfig* fbconfig)
|
const _GLFWfbconfig* fbconfig)
|
||||||
{
|
{
|
||||||
if (!createSurface(window, wndconfig, fbconfig))
|
if (!createNativeSurface(window, wndconfig, fbconfig))
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
|
||||||
if (ctxconfig->client != GLFW_NO_API)
|
if (ctxconfig->client != GLFW_NO_API)
|
||||||
@ -1880,8 +1880,8 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
|||||||
if (window->wl.decorations.buffer)
|
if (window->wl.decorations.buffer)
|
||||||
wl_buffer_destroy(window->wl.decorations.buffer);
|
wl_buffer_destroy(window->wl.decorations.buffer);
|
||||||
|
|
||||||
if (window->wl.native)
|
if (window->wl.egl.window)
|
||||||
wl_egl_window_destroy(window->wl.native);
|
wl_egl_window_destroy(window->wl.egl.window);
|
||||||
|
|
||||||
if (window->wl.xdg.toplevel)
|
if (window->wl.xdg.toplevel)
|
||||||
xdg_toplevel_destroy(window->wl.xdg.toplevel);
|
xdg_toplevel_destroy(window->wl.xdg.toplevel);
|
||||||
|
Loading…
Reference in New Issue
Block a user