Merge branch 'master' into android

This commit is contained in:
Curi0 2017-10-03 13:39:15 +05:30
commit cbb01b6346
5 changed files with 14 additions and 13 deletions

View File

@ -152,14 +152,12 @@ void _glfwInputError(int code, const char* format, ...)
if (format) if (format)
{ {
int count;
va_list vl; va_list vl;
va_start(vl, format); va_start(vl, format);
count = vsnprintf(description, sizeof(description), format, vl); vsnprintf(description, sizeof(description), format, vl);
va_end(vl); va_end(vl);
if (count < 0)
description[sizeof(description) - 1] = '\0'; description[sizeof(description) - 1] = '\0';
} }
else else

View File

@ -306,7 +306,6 @@ GLFWbool _glfwInitJoysticksLinux(void)
closedir(dir); closedir(dir);
} }
else
// Continue with no joysticks if enumeration fails // Continue with no joysticks if enumeration fails

View File

@ -76,6 +76,7 @@ typedef struct _GLFWwindowWayland
int width, height; int width, height;
GLFWbool visible; GLFWbool visible;
GLFWbool maximized; GLFWbool maximized;
GLFWbool transparent;
struct wl_surface* surface; struct wl_surface* surface;
struct wl_egl_window* native; struct wl_egl_window* native;
struct wl_shell_surface* shellSurface; struct wl_shell_surface* shellSurface;

View File

@ -212,7 +212,7 @@ static GLFWbool createSurface(_GLFWwindow* window,
window->wl.height = wndconfig->height; window->wl.height = wndconfig->height;
window->wl.scale = 1; window->wl.scale = 1;
// TODO: make this optional once issue #197 is fixed. if (!window->wl.transparent)
setOpaqueRegion(window); setOpaqueRegion(window);
return GLFW_TRUE; return GLFW_TRUE;
@ -390,6 +390,8 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig, const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig) const _GLFWfbconfig* fbconfig)
{ {
window->wl.transparent = fbconfig->transparent;
if (!createSurface(window, wndconfig)) if (!createSurface(window, wndconfig))
return GLFW_FALSE; return GLFW_FALSE;
@ -514,6 +516,7 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
window->wl.width = width; window->wl.width = width;
window->wl.height = height; window->wl.height = height;
wl_egl_window_resize(window->wl.native, scaledWidth, scaledHeight, 0, 0); wl_egl_window_resize(window->wl.native, scaledWidth, scaledHeight, 0, 0);
if (!window->wl.transparent)
setOpaqueRegion(window); setOpaqueRegion(window);
_glfwInputFramebufferSize(window, scaledWidth, scaledHeight); _glfwInputFramebufferSize(window, scaledWidth, scaledHeight);
} }
@ -656,9 +659,7 @@ int _glfwPlatformWindowMaximized(_GLFWwindow* window)
int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, return window->wl.transparent;
"Wayland: Framebuffer transparency attribute not implemented yet");
return GLFW_FALSE;
} }
void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)

View File

@ -98,7 +98,7 @@ static void hat_widget(struct nk_context* nk, unsigned char state)
struct nk_rect area; struct nk_rect area;
struct nk_vec2 center; struct nk_vec2 center;
if (nk_widget(&area, nk) != NK_WIDGET_VALID) if (nk_widget(&area, nk) == NK_WIDGET_INVALID)
return; return;
center = nk_vec2(area.x + area.w / 2.f, area.y + area.h / 2.f); center = nk_vec2(area.x + area.w / 2.f, area.y + area.h / 2.f);
@ -269,7 +269,9 @@ int main(void)
"LT", "RT", "LT", "RT",
}; };
nk_label(nk, "Gamepad state", NK_TEXT_LEFT); nk_labelf(nk, NK_TEXT_LEFT,
"Gamepad state: %s",
glfwGetGamepadName(joysticks[i]));
nk_layout_row_dynamic(nk, 30, 2); nk_layout_row_dynamic(nk, 30, 2);