From fac7d531ec218a72312edb3cf5e1ba25f5c23a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 26 Sep 2018 18:09:18 +0200 Subject: [PATCH 01/59] Update changelog --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 6d4e67846..a5b66b367 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,8 @@ information on what to include when reporting a bug. (#749,#842) - Added `GLFW_FOCUS_ON_SHOW` window hint and attribute to control input focus on calling show window (#1189) +- Added `GLFW_SCALE_TO_MONITOR` window hint for automatic window resizing + (#676,#1115) - Added `GLFW_JOYSTICK_HAT_BUTTONS` init hint (#889) - Added `GLFW_LOCK_KEY_MODS` input mode and `GLFW_MOD_*_LOCK` mod bits (#946) - Added macOS specific `GLFW_COCOA_RETINA_FRAMEBUFFER` window hint From 6bd264244a9efbcf89dcb19541ad47d6c7f11041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 9 Oct 2018 20:06:03 +0200 Subject: [PATCH 02/59] WGL: Cleanup --- src/wgl_context.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/wgl_context.c b/src/wgl_context.c index 9a370b7ea..06ba8b55a 100644 --- a/src/wgl_context.c +++ b/src/wgl_context.c @@ -300,29 +300,17 @@ static void swapIntervalWGL(int interval) static int extensionSupportedWGL(const char* extension) { - const char* extensions; - - if (_glfw.wgl.GetExtensionsStringEXT) - { - extensions = _glfw.wgl.GetExtensionsStringEXT(); - if (extensions) - { - if (_glfwStringInExtensionString(extension, extensions)) - return GLFW_TRUE; - } - } + const char* extensions = NULL; if (_glfw.wgl.GetExtensionsStringARB) - { extensions = _glfw.wgl.GetExtensionsStringARB(wglGetCurrentDC()); - if (extensions) - { - if (_glfwStringInExtensionString(extension, extensions)) - return GLFW_TRUE; - } - } + else if (_glfw.wgl.GetExtensionsStringEXT) + extensions = _glfw.wgl.GetExtensionsStringEXT(); - return GLFW_FALSE; + if (!extensions) + return GLFW_FALSE; + + return _glfwStringInExtensionString(extension, extensions); } static GLFWglproc getProcAddressWGL(const char* procname) From 1725d1c4f5b37c7ccd50dd42a8794b9f6900d12b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 26 Sep 2018 18:04:53 +0200 Subject: [PATCH 03/59] Win32: Fix build on early Windows 10 SDKs Related to #1320. --- src/win32_platform.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/win32_platform.h b/src/win32_platform.h index fa9f041c6..712de7f1e 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -147,8 +147,7 @@ typedef enum #endif /*DPI_ENUMS_DECLARED*/ #ifndef DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 -DECLARE_HANDLE(DPI_AWARENESS_CONTEXT); -#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT) -4) +#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((HANDLE) -4) #endif /*DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2*/ // HACK: Define versionhelpers.h functions manually as MinGW lacks the header @@ -225,7 +224,7 @@ typedef HRESULT (WINAPI * PFN_DirectInput8Create)(HINSTANCE,DWORD,REFIID,LPVOID* typedef BOOL (WINAPI * PFN_SetProcessDPIAware)(void); typedef BOOL (WINAPI * PFN_ChangeWindowMessageFilterEx)(HWND,UINT,DWORD,CHANGEFILTERSTRUCT*); typedef BOOL (WINAPI * PFN_EnableNonClientDpiScaling)(HWND); -typedef BOOL (WINAPI * PFN_SetProcessDpiAwarenessContext)(DPI_AWARENESS_CONTEXT); +typedef BOOL (WINAPI * PFN_SetProcessDpiAwarenessContext)(HANDLE); typedef UINT (WINAPI * PFN_GetDpiForWindow)(HWND); typedef BOOL (WINAPI * PFN_AdjustWindowRectExForDpi)(LPRECT,DWORD,BOOL,DWORD,UINT); #define SetProcessDPIAware _glfw.win32.user32.SetProcessDPIAware_ From e779280802b9d7563538cc60a970c1b5b75ce001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 21 Oct 2018 14:35:48 +0200 Subject: [PATCH 04/59] Win32: Fix invalid calls to GetDpiForWindow The check for Windows 10 Anniversary Edition or later was not always performed before calling GetDpiForWindow. Fixes #1335. Closes #1363. --- src/win32_window.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/win32_window.c b/src/win32_window.c index 858931bca..796ae150e 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -209,11 +209,14 @@ static void getFullWindowSize(DWORD style, DWORD exStyle, static void applyAspectRatio(_GLFWwindow* window, int edge, RECT* area) { int xoff, yoff; + UINT dpi = USER_DEFAULT_SCREEN_DPI; const float ratio = (float) window->numer / (float) window->denom; + if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) + dpi = GetDpiForWindow(window->win32.handle); + getFullWindowSize(getWindowStyle(window), getWindowExStyle(window), - 0, 0, &xoff, &yoff, - GetDpiForWindow(window->win32.handle)); + 0, 0, &xoff, &yoff, dpi); if (edge == WMSZ_LEFT || edge == WMSZ_BOTTOMLEFT || edge == WMSZ_RIGHT || edge == WMSZ_BOTTOMRIGHT) @@ -1001,14 +1004,17 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, case WM_GETMINMAXINFO: { int xoff, yoff; + UINT dpi = USER_DEFAULT_SCREEN_DPI; MINMAXINFO* mmi = (MINMAXINFO*) lParam; if (window->monitor) break; + if (_glfwIsWindows10AnniversaryUpdateOrGreaterWin32()) + dpi = GetDpiForWindow(window->win32.handle); + getFullWindowSize(getWindowStyle(window), getWindowExStyle(window), - 0, 0, &xoff, &yoff, - GetDpiForWindow(window->win32.handle)); + 0, 0, &xoff, &yoff, dpi); if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE) From 868f1e7bfc4a4ab4050a09330f2c66c3370aae90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 21 Oct 2018 14:58:32 +0200 Subject: [PATCH 05/59] Remove language requiring linking against opengl32 This has not been a requirement since 3.2. Fixes 1347. --- docs/build.dox | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/build.dox b/docs/build.dox index 6304d4254..ca2460eac 100644 --- a/docs/build.dox +++ b/docs/build.dox @@ -161,11 +161,12 @@ David Drysdale. The static version of the GLFW library is named `glfw3`. When using this version, it is also necessary to link with some libraries that GLFW uses. -When linking an application under Windows that uses the static version of GLFW, -you must link with `opengl32`. On some versions of MinGW, you must also -explicitly link with `gdi32`, while other versions of MinGW include it in the -set of default libraries along with other dependencies like `user32` and -`kernel32`. If you are using GLU, you must also link with `glu32`. +When using MinGW to link an application with the static version of GLFW, you +must also explicitly link with `gdi32`. Other toolchains including MinGW-w64 +include it in the set of default libraries along with other dependencies like +`user32` and `kernel32`. + +If you are using GLU, you must also link with `glu32`. The link library for the GLFW DLL is named `glfw3dll`. When compiling an application that uses the DLL version of GLFW, you need to define the @ref @@ -173,8 +174,7 @@ GLFW_DLL macro _before_ any inclusion of the GLFW header. This can be done either with a compiler switch or by defining it in your source code. An application using the GLFW DLL does not need to link against any of its -dependencies, but you still have to link against `opengl32` if your application -uses OpenGL and `glu32` if it uses GLU. +dependencies, but you still have to link against `glu32` if it uses GLU. @subsection build_link_cmake_source With CMake and GLFW source From 0b3677c2b1554ac2a082990a8a3f276b64559e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 21 Oct 2018 15:01:19 +0200 Subject: [PATCH 06/59] X11: Clarify comment --- src/x11_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/x11_init.c b/src/x11_init.c index c949916d3..e3e3ad518 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -780,8 +780,9 @@ static GLFWbool initExtensions(void) // static void getSystemContentScale(float* xscale, float* yscale) { - // NOTE: Default to the display-wide DPI as we don't currently have a policy - // for which monitor a window is considered to be on + // NOTE: Fall back to the display-wide DPI instead of RandR monitor DPI if + // Xft.dpi retrieval below fails as we don't currently have an exact + // policy for which monitor a window is considered to "be on" float xdpi = DisplayWidth(_glfw.x11.display, _glfw.x11.screen) * 25.4f / DisplayWidthMM(_glfw.x11.display, _glfw.x11.screen); float ydpi = DisplayHeight(_glfw.x11.display, _glfw.x11.screen) * From 2de2589f910b1a85905f425be4d32f33cec092df Mon Sep 17 00:00:00 2001 From: Siavash Eliasi Date: Mon, 22 Oct 2018 17:45:11 +0330 Subject: [PATCH 07/59] Documentation work. (#1328) Using GLFW_TRUE where applicable. --- docs/input.dox | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/input.dox b/docs/input.dox index 095481c36..169d8d13b 100644 --- a/docs/input.dox +++ b/docs/input.dox @@ -162,7 +162,7 @@ missed the key press. The recommended solution for this is to use a key callback, but there is also the `GLFW_STICKY_KEYS` input mode. @code -glfwSetInputMode(window, GLFW_STICKY_KEYS, 1); +glfwSetInputMode(window, GLFW_STICKY_KEYS, GLFW_TRUE); @endcode When sticky keys mode is enabled, the pollable state of a key will remain @@ -175,7 +175,7 @@ If you wish to know what the state of the Caps Lock and Num Lock keys was when input events were generated, set the `GLFW_LOCK_KEY_MODS` input mode. @code -glfwSetInputMode(window, GLFW_LOCK_KEY_MODS, 1); +glfwSetInputMode(window, GLFW_LOCK_KEY_MODS, GLFW_TRUE); @endcode When this input mode is enabled, any callback that receives @@ -475,7 +475,7 @@ mouse button callback, but there is also the `GLFW_STICKY_MOUSE_BUTTONS` input mode. @code -glfwSetInputMode(window, GLFW_STICKY_MOUSE_BUTTONS, 1); +glfwSetInputMode(window, GLFW_STICKY_MOUSE_BUTTONS, GLFW_TRUE); @endcode When sticky mouse buttons mode is enabled, the pollable state of a mouse button From 92b3fd02e58c5422c60f4f52499189e727969564 Mon Sep 17 00:00:00 2001 From: Ricardo Vieira Date: Tue, 23 Sep 2014 18:24:33 +0100 Subject: [PATCH 08/59] wayland: save serial from all input sources --- src/wl_init.c | 13 +++++++++---- src/wl_platform.h | 2 +- src/wl_window.c | 7 +++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/wl_init.c b/src/wl_init.c index 4a51f38cd..6a10e14a8 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -99,7 +99,7 @@ static void pointerHandleEnter(void* data, } window->wl.decorations.focus = focus; - _glfw.wl.pointerSerial = serial; + _glfw.wl.serial = serial; _glfw.wl.pointerFocus = window; window->wl.hovered = GLFW_TRUE; @@ -120,7 +120,7 @@ static void pointerHandleLeave(void* data, window->wl.hovered = GLFW_FALSE; - _glfw.wl.pointerSerial = serial; + _glfw.wl.serial = serial; _glfw.wl.pointerFocus = NULL; _glfwInputCursorEnter(window, GLFW_FALSE); } @@ -158,7 +158,7 @@ static void setCursor(_GLFWwindow* window, const char* name) buffer = wl_cursor_image_get_buffer(image); if (!buffer) return; - wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial, + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, surface, image->hotspot_x / scale, image->hotspot_y / scale); @@ -309,7 +309,7 @@ static void pointerHandleButton(void* data, if (window->wl.decorations.focus != mainWindow) return; - _glfw.wl.pointerSerial = serial; + _glfw.wl.serial = serial; /* Makes left, right and middle 0, 1 and 2. Overall order follows evdev * codes. */ @@ -478,6 +478,7 @@ static void keyboardHandleEnter(void* data, return; } + _glfw.wl.serial = serial; _glfw.wl.keyboardFocus = window; _glfwInputWindowFocus(window, GLFW_TRUE); } @@ -492,6 +493,7 @@ static void keyboardHandleLeave(void* data, if (!window) return; + _glfw.wl.serial = serial; _glfw.wl.keyboardFocus = NULL; _glfwInputWindowFocus(window, GLFW_FALSE); } @@ -575,6 +577,7 @@ static void keyboardHandleKey(void* data, action = state == WL_KEYBOARD_KEY_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE; + _glfw.wl.serial = serial; _glfwInputKey(window, keyCode, key, action, _glfw.wl.xkb.modifiers); @@ -606,6 +609,8 @@ static void keyboardHandleModifiers(void* data, xkb_mod_mask_t mask; unsigned int modifiers = 0; + _glfw.wl.serial = serial; + if (!_glfw.wl.xkb.keymap) return; diff --git a/src/wl_platform.h b/src/wl_platform.h index 2cf649693..973013e24 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -247,7 +247,7 @@ typedef struct _GLFWlibraryWayland struct wl_cursor_theme* cursorThemeHiDPI; struct wl_surface* cursorSurface; int cursorTimerfd; - uint32_t pointerSerial; + uint32_t serial; int32_t keyboardRepeatRate; int32_t keyboardRepeatDelay; diff --git a/src/wl_window.c b/src/wl_window.c index c1d24f231..3cfc9f7f4 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -779,7 +779,7 @@ static void setCursorImage(_GLFWwindow* window, cursorWayland->yhot = image->hotspot_y; } - wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial, + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, surface, cursorWayland->xhot / scale, cursorWayland->yhot / scale); @@ -1501,7 +1501,7 @@ static void lockPointer(_GLFWwindow* window) window->wl.pointerLock.relativePointer = relativePointer; window->wl.pointerLock.lockedPointer = lockedPointer; - wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial, + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, NULL, 0, 0); } @@ -1565,8 +1565,7 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) } else if (window->cursorMode == GLFW_CURSOR_HIDDEN) { - wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerSerial, - NULL, 0, 0); + wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial, NULL, 0, 0); } } From 3c4b9a7eef9a5cfddd6a2c293dabcfac9e818a0c Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 10 Oct 2018 19:06:11 +0200 Subject: [PATCH 09/59] Wayland: Add boilerplate for clipboard handling --- src/wl_init.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++ src/wl_platform.h | 3 ++ 2 files changed, 90 insertions(+) diff --git a/src/wl_init.c b/src/wl_init.c index 6a10e14a8..6f7c128b5 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -705,6 +705,70 @@ static const struct wl_seat_listener seatListener = { seatHandleName, }; +static void dataOfferHandleOffer(void* data, + struct wl_data_offer* dataOffer, + const char* mimeType) +{ +} + +static const struct wl_data_offer_listener dataOfferListener = { + dataOfferHandleOffer, +}; + +static void dataDeviceHandleDataOffer(void* data, + struct wl_data_device* dataDevice, + struct wl_data_offer* id) +{ + if (_glfw.wl.dataOffer) + wl_data_offer_destroy(_glfw.wl.dataOffer); + + _glfw.wl.dataOffer = id; + wl_data_offer_add_listener(_glfw.wl.dataOffer, &dataOfferListener, NULL); +} + +static void dataDeviceHandleEnter(void* data, + struct wl_data_device* dataDevice, + uint32_t serial, + struct wl_surface *surface, + wl_fixed_t x, + wl_fixed_t y, + struct wl_data_offer *id) +{ +} + +static void dataDeviceHandleLeave(void* data, + struct wl_data_device* dataDevice) +{ +} + +static void dataDeviceHandleMotion(void* data, + struct wl_data_device* dataDevice, + uint32_t time, + wl_fixed_t x, + wl_fixed_t y) +{ +} + +static void dataDeviceHandleDrop(void* data, + struct wl_data_device* dataDevice) +{ +} + +static void dataDeviceHandleSelection(void* data, + struct wl_data_device* dataDevice, + struct wl_data_offer* id) +{ +} + +static const struct wl_data_device_listener dataDeviceListener = { + dataDeviceHandleDataOffer, + dataDeviceHandleEnter, + dataDeviceHandleLeave, + dataDeviceHandleMotion, + dataDeviceHandleDrop, + dataDeviceHandleSelection, +}; + static void wmBaseHandlePing(void* data, struct xdg_wm_base* wmBase, uint32_t serial) @@ -759,6 +823,15 @@ static void registryHandleGlobal(void* data, wl_seat_add_listener(_glfw.wl.seat, &seatListener, NULL); } } + else if (strcmp(interface, "wl_data_device_manager") == 0) + { + if (!_glfw.wl.dataDeviceManager) + { + _glfw.wl.dataDeviceManager = + wl_registry_bind(registry, name, + &wl_data_device_manager_interface, 1); + } + } else if (strcmp(interface, "xdg_wm_base") == 0) { _glfw.wl.wmBase = @@ -1117,6 +1190,14 @@ int _glfwPlatformInit(void) _glfw.wl.cursorTimerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); } + if (_glfw.wl.seat && _glfw.wl.dataDeviceManager) + { + _glfw.wl.dataDevice = + wl_data_device_manager_get_data_device(_glfw.wl.dataDeviceManager, + _glfw.wl.seat); + wl_data_device_add_listener(_glfw.wl.dataDevice, &dataDeviceListener, NULL); + } + return GLFW_TRUE; } @@ -1174,6 +1255,12 @@ void _glfwPlatformTerminate(void) zxdg_decoration_manager_v1_destroy(_glfw.wl.decorationManager); if (_glfw.wl.wmBase) xdg_wm_base_destroy(_glfw.wl.wmBase); + if (_glfw.wl.dataDevice) + wl_data_device_destroy(_glfw.wl.dataDevice); + if (_glfw.wl.dataOffer) + wl_data_offer_destroy(_glfw.wl.dataOffer); + if (_glfw.wl.dataDeviceManager) + wl_data_device_manager_destroy(_glfw.wl.dataDeviceManager); if (_glfw.wl.pointer) wl_pointer_destroy(_glfw.wl.pointer); if (_glfw.wl.keyboard) diff --git a/src/wl_platform.h b/src/wl_platform.h index 973013e24..264eae830 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -233,6 +233,9 @@ typedef struct _GLFWlibraryWayland struct wl_seat* seat; struct wl_pointer* pointer; struct wl_keyboard* keyboard; + struct wl_data_device_manager* dataDeviceManager; + struct wl_data_device* dataDevice; + struct wl_data_offer* dataOffer; struct xdg_wm_base* wmBase; struct zxdg_decoration_manager_v1* decorationManager; struct wp_viewporter* viewporter; From 8b54e28c4ea4df8f0f38bb02f8540522b136e826 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 10 Oct 2018 19:21:26 +0200 Subject: [PATCH 10/59] Wayland: Implement clipboard paste --- src/wl_init.c | 11 +++++++ src/wl_platform.h | 2 ++ src/wl_window.c | 83 ++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 92 insertions(+), 4 deletions(-) diff --git a/src/wl_init.c b/src/wl_init.c index 6f7c128b5..30d0eca5f 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -1196,6 +1196,14 @@ int _glfwPlatformInit(void) wl_data_device_manager_get_data_device(_glfw.wl.dataDeviceManager, _glfw.wl.seat); wl_data_device_add_listener(_glfw.wl.dataDevice, &dataDeviceListener, NULL); + _glfw.wl.clipboardString = malloc(4096); + if (!_glfw.wl.clipboardString) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Unable to allocate clipboard memory"); + return GLFW_FALSE; + } + _glfw.wl.clipboardSize = 4096; } return GLFW_TRUE; @@ -1285,6 +1293,9 @@ void _glfwPlatformTerminate(void) close(_glfw.wl.timerfd); if (_glfw.wl.cursorTimerfd >= 0) close(_glfw.wl.cursorTimerfd); + + if (_glfw.wl.clipboardString) + free(_glfw.wl.clipboardString); } const char* _glfwPlatformGetVersionString(void) diff --git a/src/wl_platform.h b/src/wl_platform.h index 264eae830..11c2f91e5 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -256,6 +256,8 @@ typedef struct _GLFWlibraryWayland int32_t keyboardRepeatDelay; int keyboardLastKey; int keyboardLastScancode; + char* clipboardString; + size_t clipboardSize; int timerfd; short int keycodes[256]; short int scancodes[GLFW_KEY_LAST + 1]; diff --git a/src/wl_window.c b/src/wl_window.c index 3cfc9f7f4..817e2f0ca 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1576,12 +1576,87 @@ void _glfwPlatformSetClipboardString(const char* string) "Wayland: Clipboard setting not implemented yet"); } +static GLFWbool growClipboardString(void) +{ + char* clipboard = _glfw.wl.clipboardString; + + clipboard = realloc(clipboard, _glfw.wl.clipboardSize * 2); + if (!clipboard) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Impossible to grow clipboard string"); + return GLFW_FALSE; + } + _glfw.wl.clipboardString = clipboard; + _glfw.wl.clipboardSize = _glfw.wl.clipboardSize * 2; + return GLFW_TRUE; +} + const char* _glfwPlatformGetClipboardString(void) { - // TODO - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Clipboard getting not implemented yet"); - return NULL; + int fds[2]; + int ret; + size_t len = 0; + + if (!_glfw.wl.dataOffer) + { + _glfwInputError(GLFW_FORMAT_UNAVAILABLE, + "No clipboard data has been sent yet"); + return NULL; + } + + ret = pipe2(fds, O_CLOEXEC); + if (ret < 0) + { + // TODO: also report errno maybe? + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Impossible to create clipboard pipe fds"); + return NULL; + } + + wl_data_offer_receive(_glfw.wl.dataOffer, "text/plain;charset=utf-8", fds[1]); + close(fds[1]); + + // XXX: this is a huge hack, this function shouldn’t be synchronous! + handleEvents(-1); + + while (1) + { + // Grow the clipboard if we need to paste something bigger, there is no + // shrink operation yet. + if (len + 4096 > _glfw.wl.clipboardSize) + { + if (!growClipboardString()) + { + close(fds[0]); + return NULL; + } + } + + // Then read from the fd to the clipboard, handling all known errors. + ret = read(fds[0], _glfw.wl.clipboardString + len, 4096); + if (ret == 0) + break; + if (ret == -1 && errno == EINTR) + continue; + if (ret == -1) + { + // TODO: also report errno maybe. + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Impossible to read from clipboard fd"); + close(fds[0]); + return NULL; + } + len += ret; + } + close(fds[0]); + if (len + 1 > _glfw.wl.clipboardSize) + { + if (!growClipboardString()) + return NULL; + } + _glfw.wl.clipboardString[len] = '\0'; + return _glfw.wl.clipboardString; } void _glfwPlatformGetRequiredInstanceExtensions(char** extensions) From c08abffc50f06f5f41e1d62f8341da8342429317 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 10 Oct 2018 20:31:26 +0200 Subject: [PATCH 11/59] Wayland: Implement clipboard copy --- src/wl_init.c | 4 ++ src/wl_platform.h | 3 ++ src/wl_window.c | 121 ++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 125 insertions(+), 3 deletions(-) diff --git a/src/wl_init.c b/src/wl_init.c index 30d0eca5f..c6b209bc7 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -1263,6 +1263,8 @@ void _glfwPlatformTerminate(void) zxdg_decoration_manager_v1_destroy(_glfw.wl.decorationManager); if (_glfw.wl.wmBase) xdg_wm_base_destroy(_glfw.wl.wmBase); + if (_glfw.wl.dataSource) + wl_data_source_destroy(_glfw.wl.dataSource); if (_glfw.wl.dataDevice) wl_data_device_destroy(_glfw.wl.dataDevice); if (_glfw.wl.dataOffer) @@ -1296,6 +1298,8 @@ void _glfwPlatformTerminate(void) if (_glfw.wl.clipboardString) free(_glfw.wl.clipboardString); + if (_glfw.wl.clipboardSendString) + free(_glfw.wl.clipboardSendString); } const char* _glfwPlatformGetVersionString(void) diff --git a/src/wl_platform.h b/src/wl_platform.h index 11c2f91e5..c17ebe88b 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -236,6 +236,7 @@ typedef struct _GLFWlibraryWayland struct wl_data_device_manager* dataDeviceManager; struct wl_data_device* dataDevice; struct wl_data_offer* dataOffer; + struct wl_data_source* dataSource; struct xdg_wm_base* wmBase; struct zxdg_decoration_manager_v1* decorationManager; struct wp_viewporter* viewporter; @@ -258,6 +259,8 @@ typedef struct _GLFWlibraryWayland int keyboardLastScancode; char* clipboardString; size_t clipboardSize; + char* clipboardSendString; + size_t clipboardSendSize; int timerfd; short int keycodes[256]; short int scancodes[GLFW_KEY_LAST + 1]; diff --git a/src/wl_window.c b/src/wl_window.c index 817e2f0ca..98a646590 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1569,11 +1569,126 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) } } +static void dataSourceHandleTarget(void* data, + struct wl_data_source* dataSource, + const char* mimeType) +{ + if (_glfw.wl.dataSource != dataSource) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Unknown clipboard data source"); + return; + } +} + +static void dataSourceHandleSend(void* data, + struct wl_data_source* dataSource, + const char* mimeType, + int fd) +{ + const char* string = _glfw.wl.clipboardSendString; + size_t len = _glfw.wl.clipboardSendSize; + int ret; + + if (_glfw.wl.dataSource != dataSource) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Unknown clipboard data source"); + return; + } + + if (!string) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Copy requested from an invalid string"); + return; + } + + if (strcmp(mimeType, "text/plain;charset=utf-8") != 0) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Wrong MIME type asked from clipboard"); + close(fd); + return; + } + + while (len > 0) + { + ret = write(fd, string, len); + if (ret == -1 && errno == EINTR) + continue; + if (ret == -1) + { + // TODO: also report errno maybe. + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Error while writing the clipboard"); + close(fd); + return; + } + len -= ret; + } + close(fd); +} + +static void dataSourceHandleCancelled(void* data, + struct wl_data_source* dataSource) +{ + wl_data_source_destroy(dataSource); + + if (_glfw.wl.dataSource != dataSource) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Unknown clipboard data source"); + return; + } + + _glfw.wl.dataSource = NULL; +} + +static const struct wl_data_source_listener dataSourceListener = { + dataSourceHandleTarget, + dataSourceHandleSend, + dataSourceHandleCancelled, +}; + void _glfwPlatformSetClipboardString(const char* string) { - // TODO - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Clipboard setting not implemented yet"); + if (_glfw.wl.dataSource) + { + wl_data_source_destroy(_glfw.wl.dataSource); + _glfw.wl.dataSource = NULL; + } + + if (_glfw.wl.clipboardSendString) + { + free(_glfw.wl.clipboardSendString); + _glfw.wl.clipboardSendString = NULL; + } + + _glfw.wl.clipboardSendString = strdup(string); + if (!_glfw.wl.clipboardSendString) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Impossible to allocate clipboard string"); + return; + } + _glfw.wl.clipboardSendSize = strlen(string); + _glfw.wl.dataSource = + wl_data_device_manager_create_data_source(_glfw.wl.dataDeviceManager); + if (!_glfw.wl.dataSource) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Impossible to create clipboard source"); + free(_glfw.wl.clipboardSendString); + return; + } + wl_data_source_add_listener(_glfw.wl.dataSource, + &dataSourceListener, + NULL); + wl_data_source_offer(_glfw.wl.dataSource, "text/plain;charset=utf-8"); + wl_data_device_set_selection(_glfw.wl.dataDevice, + _glfw.wl.dataSource, + _glfw.wl.serial); } static GLFWbool growClipboardString(void) From 64c034edfb17067ae25239f8fe3ea8ec49fad215 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 10 Oct 2018 20:38:47 +0200 Subject: [PATCH 12/59] Documentation work --- include/GLFW/glfw3.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 1fc8fe556..a511b94fc 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -4928,8 +4928,6 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * - * @remark @wayland Clipboard is currently unimplemented. - * * @pointer_lifetime The specified string is copied before this function * returns. * @@ -4958,8 +4956,6 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * - * @remark @wayland Clipboard is currently unimplemented. - * * @pointer_lifetime The returned string is allocated and freed by GLFW. You * should not free it yourself. It is valid until the next call to @ref * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library From 6a199c1f5e4c320c73ce28be6480c7a9b6a13692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 22 Oct 2018 17:47:28 +0200 Subject: [PATCH 13/59] Allow exposing only native context APIs Fixes 1349. --- include/GLFW/glfw3native.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/GLFW/glfw3native.h b/include/GLFW/glfw3native.h index 83d3ca44b..6bddc432f 100644 --- a/include/GLFW/glfw3native.h +++ b/include/GLFW/glfw3native.h @@ -81,7 +81,7 @@ extern "C" { * System headers and types *************************************************************************/ -#if defined(GLFW_EXPOSE_NATIVE_WIN32) +#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL) // This is a workaround for the fact that glfw3.h needs to export APIENTRY (for // example to allow applications to correctly declare a GL_ARB_debug_output // callback) but windows.h assumes no one will define APIENTRY before it does @@ -90,14 +90,14 @@ extern "C" { #undef GLFW_APIENTRY_DEFINED #endif #include -#elif defined(GLFW_EXPOSE_NATIVE_COCOA) - #include +#elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL) #if defined(__OBJC__) #import #else + #include typedef void* id; #endif -#elif defined(GLFW_EXPOSE_NATIVE_X11) +#elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX) #include #include #elif defined(GLFW_EXPOSE_NATIVE_WAYLAND) From 031a8f95833635db8b1ad1734b3f00a0681a399a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 24 Oct 2018 14:30:02 +0200 Subject: [PATCH 14/59] Cocoa: Cleanup --- src/cocoa_platform.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/cocoa_platform.h b/src/cocoa_platform.h index cf6ca9f5c..282f7cc8b 100644 --- a/src/cocoa_platform.h +++ b/src/cocoa_platform.h @@ -27,12 +27,10 @@ #include #include +#include #if defined(__OBJC__) -#import #import #else -#include -#include typedef void* id; #endif From 245461eb86541be33494fd81befee4553b2f12e9 Mon Sep 17 00:00:00 2001 From: tnixeu <4436784+tnixeu@users.noreply.github.com> Date: Mon, 22 Oct 2018 20:46:40 +0200 Subject: [PATCH 15/59] Fix guide example callback name mismatch The cursor position callback is named differently in example usage and example declaration. Closes #1364. --- docs/input.dox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/input.dox b/docs/input.dox index 169d8d13b..8cd37917c 100644 --- a/docs/input.dox +++ b/docs/input.dox @@ -245,7 +245,7 @@ If you wish to be notified when the cursor moves over the window, set a cursor position callback. @code -glfwSetCursorPosCallback(window, cursor_pos_callback); +glfwSetCursorPosCallback(window, cursor_position_callback); @endcode The callback functions receives the cursor position, measured in screen From 6dfc12a43906ad4acf669499e2a25761318a1fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 26 Oct 2018 12:56:02 +0200 Subject: [PATCH 16/59] Cocoa: Fix some macOS 10.14 deprecation warnings --- src/cocoa_window.m | 20 ++++++++++++-------- src/nsgl_context.m | 9 +++++++-- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 7cf4a593d..308b5d849 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -32,7 +32,6 @@ // Needed for _NSGetProgname #include -// HACK: The 10.12 SDK adds new symbols and immediately deprecates the old ones #if MAC_OS_X_VERSION_MAX_ALLOWED < 101200 #define NSWindowStyleMaskBorderless NSBorderlessWindowMask #define NSWindowStyleMaskClosable NSClosableWindowMask @@ -48,8 +47,13 @@ #define NSEventMaskAny NSAnyEventMask #define NSEventTypeApplicationDefined NSApplicationDefined #define NSEventTypeKeyUp NSKeyUp + #define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat #endif +#if MAC_OS_X_VERSION_MAX_ALLOWED < 101300 + #define NSPasteboardTypeFileURL NSFilenamesPboardType + #define NSPasteboardTypeString NSStringPboardType +#endif // Returns the style mask corresponding to the window settings // @@ -439,7 +443,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; [self updateTrackingAreas]; [self registerForDraggedTypes:[NSArray arrayWithObjects: - NSFilenamesPboardType, nil]]; + NSPasteboardTypeFileURL, nil]]; } return self; @@ -720,7 +724,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; - (BOOL)performDragOperation:(id )sender { NSPasteboard* pasteboard = [sender draggingPasteboard]; - NSArray* files = [pasteboard propertyListForType:NSFilenamesPboardType]; + NSArray* files = [pasteboard propertyListForType:NSPasteboardTypeFileURL]; const NSRect contentRect = [window->ns.view frame]; _glfwInputCursorPos(window, @@ -1728,7 +1732,7 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor, hasAlpha:YES isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace - bitmapFormat:NSAlphaNonpremultipliedBitmapFormat + bitmapFormat:NSBitmapFormatAlphaNonpremultiplied bytesPerRow:image->width * 4 bitsPerPixel:32]; @@ -1795,26 +1799,26 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) void _glfwPlatformSetClipboardString(const char* string) { - NSArray* types = [NSArray arrayWithObjects:NSStringPboardType, nil]; + NSArray* types = [NSArray arrayWithObjects:NSPasteboardTypeString, nil]; NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; [pasteboard declareTypes:types owner:nil]; [pasteboard setString:[NSString stringWithUTF8String:string] - forType:NSStringPboardType]; + forType:NSPasteboardTypeString]; } const char* _glfwPlatformGetClipboardString(void) { NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; - if (![[pasteboard types] containsObject:NSStringPboardType]) + if (![[pasteboard types] containsObject:NSPasteboardTypeString]) { _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "Cocoa: Failed to retrieve string from pasteboard"); return NULL; } - NSString* object = [pasteboard stringForType:NSStringPboardType]; + NSString* object = [pasteboard stringForType:NSPasteboardTypeString]; if (!object) { _glfwInputError(GLFW_PLATFORM_ERROR, diff --git a/src/nsgl_context.m b/src/nsgl_context.m index 82af90636..ec1012e9d 100644 --- a/src/nsgl_context.m +++ b/src/nsgl_context.m @@ -26,6 +26,10 @@ #include "internal.h" +#if MAC_OS_X_VERSION_MAX_ALLOWED < 101400 + #define NSOpenGLContextParameterSwapInterval NSOpenGLCPSwapInterval + #define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity +#endif static void makeContextCurrentNSGL(_GLFWwindow* window) { @@ -49,7 +53,7 @@ static void swapIntervalNSGL(int interval) GLint sync = interval; [window->context.nsgl.object setValues:&sync - forParameter:NSOpenGLCPSwapInterval]; + forParameter:NSOpenGLContextParameterSwapInterval]; } static int extensionSupportedNSGL(const char* extension) @@ -299,7 +303,8 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window, if (fbconfig->transparent) { GLint opaque = 0; - [window->context.nsgl.object setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity]; + [window->context.nsgl.object setValues:&opaque + forParameter:NSOpenGLContextParameterSurfaceOpacity]; } [window->context.nsgl.object setView:window->ns.view]; From 5595fa3ae60386bdb6ae4caf8f488779e3c342a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 26 Oct 2018 13:21:14 +0200 Subject: [PATCH 17/59] Cocoa: Fix OpenGL rendering not being displayed Fix based on information provided by @rcgordon. Fixes #1334. Closes #1346. --- README.md | 2 ++ src/cocoa_window.m | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index a5b66b367..33b031a86 100644 --- a/README.md +++ b/README.md @@ -271,6 +271,8 @@ information on what to include when reporting a bug. - [Cocoa] Bugfix: Window was resized twice when entering full screen (#1085) - [Cocoa] Bugfix: Duplicate size events were not filtered (#1085) - [Cocoa] Bugfix: Event polling did not initialize AppKit if necessary (#1218) +- [Cocoa] Bugfix: OpenGL rendering was not initially visible on 10.14 + (#1334,#1346) - [WGL] Added support for `WGL_EXT_colorspace` for OpenGL ES contexts - [WGL] Added support for `WGL_ARB_create_context_no_error` - [GLX] Added support for `GLX_ARB_create_context_no_error` diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 308b5d849..43a38ddad 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -476,6 +476,14 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; return YES; } +- (void)updateLayer +{ + if (window->context.client != GLFW_NO_API) + [window->context.nsgl.object update]; + + _glfwInputWindowDamage(window); +} + - (id)makeBackingLayer { if (window->ns.layer) From d9466050d9f61699f3ecba5ab2ca8a0a774dff53 Mon Sep 17 00:00:00 2001 From: meditator Date: Sat, 13 Oct 2018 01:54:50 -0400 Subject: [PATCH 18/59] X11: Fix missing check for NET_WM_STATE Closes #1356. --- README.md | 1 + src/x11_window.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 33b031a86..f77f7b428 100644 --- a/README.md +++ b/README.md @@ -239,6 +239,7 @@ information on what to include when reporting a bug. - [X11] Bugfix: Selection I/O reported but did not support `COMPOUND_TEXT` - [X11] Bugfix: Latin-1 text read from selections was not converted to UTF-8 - [X11] Bugfix: NVidia EGL would segfault if unloaded before closing the display +- [X11] Bugfix: Checking window maximized attrib could crash some WMs (#1356) - [Linux] Added workaround for missing `SYN_DROPPED` in pre-2.6.39 kernel headers (#1196) - [Linux] Moved to evdev for joystick input (#906,#1005) diff --git a/src/x11_window.c b/src/x11_window.c index c01cf17ec..0ae3b4c8f 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -2450,6 +2450,14 @@ int _glfwPlatformWindowMaximized(_GLFWwindow* window) Atom* states; unsigned long i; GLFWbool maximized = GLFW_FALSE; + + if (!_glfw.x11.NET_WM_STATE || + !_glfw.x11.NET_WM_STATE_MAXIMIZED_VERT || + !_glfw.x11.NET_WM_STATE_MAXIMIZED_HORZ) + { + return maximized; + } + const unsigned long count = _glfwGetWindowPropertyX11(window->x11.handle, _glfw.x11.NET_WM_STATE, From 769f727e473dee894bf41704a60d7f9e000dfb78 Mon Sep 17 00:00:00 2001 From: MrVallentin Date: Fri, 2 Nov 2018 21:07:24 +0100 Subject: [PATCH 19/59] Fixed repeated words --- docs/CONTRIBUTING.md | 2 +- docs/Doxyfile.in | 2 +- docs/input.dox | 2 +- docs/monitor.dox | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 6d85f5cd5..bd80c187f 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -299,7 +299,7 @@ the source to the output or vice versa. ### Reporting a website bug If the bug is in the documentation (anything under `/docs/`) then please see the -section above. Bugs in the rest of the site are reported to to the [website +section above. Bugs in the rest of the site are reported to the [website source repository](https://github.com/glfw/website/issues). diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index 51f2b093a..ec1c382e3 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -264,7 +264,7 @@ MARKDOWN_SUPPORT = YES # When enabled doxygen tries to link words that correspond to documented classes, # or namespaces to their corresponding documentation. Such a link can be -# prevented in individual cases by by putting a % sign in front of the word or +# prevented in individual cases by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. AUTOLINK_SUPPORT = YES diff --git a/docs/input.dox b/docs/input.dox index 8cd37917c..8f069a7ee 100644 --- a/docs/input.dox +++ b/docs/input.dox @@ -523,7 +523,7 @@ int present = glfwJoystickPresent(GLFW_JOYSTICK_1); Each joystick has zero or more axes, zero or more buttons, zero or more hats, a human-readable name, a user pointer and an SDL compatible GUID. -When GLFW is initialized, detected joysticks are added to to the beginning of +When GLFW is initialized, detected joysticks are added to the beginning of the array. Once a joystick is detected, it keeps its assigned ID until it is disconnected or the library is terminated, so as joysticks are connected and disconnected, there may appear gaps in the IDs. diff --git a/docs/monitor.dox b/docs/monitor.dox index 08c119336..b23482b6e 100644 --- a/docs/monitor.dox +++ b/docs/monitor.dox @@ -101,7 +101,7 @@ size and a gamma ramp. @subsection monitor_modes Video modes GLFW generally does a good job selecting a suitable video mode when you create -a full screen window, change its video mode or or make a windowed one full +a full screen window, change its video mode or make a windowed one full screen, but it is sometimes useful to know exactly which video modes are supported. From 85fd5aa6c4deb93c487dcfe2d54d9f6d92f3100a Mon Sep 17 00:00:00 2001 From: MrVallentin Date: Fri, 2 Nov 2018 20:55:02 +0100 Subject: [PATCH 20/59] Use HTTPS when possible --- docs/build.dox | 4 ++-- docs/compat.dox | 8 ++++---- docs/compile.dox | 6 +++--- docs/context.dox | 6 +++--- docs/header.html | 8 ++++---- docs/main.dox | 6 +++--- docs/moving.dox | 8 ++++---- docs/news.dox | 6 +++--- docs/quick.dox | 2 +- src/glfw3.pc.in | 2 +- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/docs/build.dox b/docs/build.dox index ca2460eac..b4502c732 100644 --- a/docs/build.dox +++ b/docs/build.dox @@ -152,7 +152,7 @@ environment below. On Linux and other Unix-like operating systems, the list varies but can be retrieved in various ways as described below. A good general introduction to linking is -[Beginner's Guide to Linkers](http://www.lurklurk.org/linkers/linkers.html) by +[Beginner's Guide to Linkers](https://www.lurklurk.org/linkers/linkers.html) by David Drysdale. @@ -298,7 +298,7 @@ transition guide for suggested replacements. @subsection build_link_pkgconfig With makefiles and pkg-config on Unix -GLFW supports [pkg-config](http://www.freedesktop.org/wiki/Software/pkg-config/), +GLFW supports [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/), and the `glfw3.pc` pkg-config file is generated when the GLFW library is built and is installed along with it. A pkg-config file describes all necessary compile-time and link-time flags and dependencies needed to use a library. When diff --git a/docs/compat.dox b/docs/compat.dox index ade24ec8e..98e045cb6 100644 --- a/docs/compat.dox +++ b/docs/compat.dox @@ -23,9 +23,9 @@ varied window managers in use on Unix-like systems. In order for applications and window managers to work well together, a number of standards and conventions have been developed that regulate behavior outside the scope of the X11 API; most importantly the -[Inter-Client Communication Conventions Manual](http://www.tronche.com/gui/x/icccm/) +[Inter-Client Communication Conventions Manual](https://www.tronche.com/gui/x/icccm/) (ICCCM) and -[Extended Window Manager Hints](http://standards.freedesktop.org/wm-spec/wm-spec-latest.html) +[Extended Window Manager Hints](https://standards.freedesktop.org/wm-spec/wm-spec-latest.html) (EWMH) standards. GLFW uses the `_MOTIF_WM_HINTS` window property to support borderless windows. @@ -53,13 +53,13 @@ running window manager uses compositing but does not support this property then additional copying may be performed for each buffer swap of full screen windows. GLFW uses the -[clipboard manager protocol](http://www.freedesktop.org/wiki/ClipboardManager/) +[clipboard manager protocol](https://www.freedesktop.org/wiki/ClipboardManager/) to push a clipboard string (i.e. selection) owned by a GLFW window about to be destroyed to the clipboard manager. If there is no running clipboard manager, the clipboard string will be unavailable once the window has been destroyed. GLFW uses the -[X drag-and-drop protocol](http://www.freedesktop.org/wiki/Specifications/XDND/) +[X drag-and-drop protocol](https://www.freedesktop.org/wiki/Specifications/XDND/) to provide file drop events. If the application originating the drag does not support this protocol, drag and drop will not work. diff --git a/docs/compile.dox b/docs/compile.dox index 762143a20..f9766e8c7 100644 --- a/docs/compile.dox +++ b/docs/compile.dox @@ -10,12 +10,12 @@ build applications that use GLFW, see @ref build_guide. @section compile_cmake Using CMake -GLFW uses [CMake](http://www.cmake.org/) to generate project files or makefiles +GLFW uses [CMake](https://www.cmake.org/) to generate project files or makefiles for a particular development environment. If you are on a Unix-like system such as Linux or FreeBSD or have a package system like Fink, MacPorts, Cygwin or Homebrew, you can install its CMake package. If not, you can download installers for Windows and macOS from the -[CMake website](http://www.cmake.org/). +[CMake website](https://www.cmake.org/). @note CMake only generates project files or makefiles. It does not compile the actual GLFW library. To compile GLFW, first generate these files for your @@ -71,7 +71,7 @@ cmake -DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake . @endcode For more details see the article -[CMake Cross Compiling](http://www.paraview.org/Wiki/CMake_Cross_Compiling) on +[CMake Cross Compiling](https://www.paraview.org/Wiki/CMake_Cross_Compiling) on the CMake wiki. Once you have this set up, move on to @ref compile_generate. diff --git a/docs/context.dox b/docs/context.dox index 5e1eb25c1..69b8fa7fd 100644 --- a/docs/context.dox +++ b/docs/context.dox @@ -56,7 +56,7 @@ platforms where it is possible to choose which types of objects are shared, GLFW requests that all types are shared. See the relevant chapter of the [OpenGL](https://www.opengl.org/registry/) or -[OpenGL ES](http://www.khronos.org/opengles/) reference documents for more +[OpenGL ES](https://www.khronos.org/opengles/) reference documents for more information. The name and number of this chapter unfortunately varies between versions and APIs, but has at times been named _Shared Objects and Multiple Contexts_. @@ -151,7 +151,7 @@ for official extensions. The extension above was created by the ARB, but there are many different affixes, like `NV` for Nvidia and `AMD` for, well, AMD. Any group may also use the generic `EXT` affix. Lists of extensions, together with their specifications, can be found at the -[OpenGL Registry](http://www.opengl.org/registry/) and +[OpenGL Registry](https://www.opengl.org/registry/) and [OpenGL ES Registry](https://www.khronos.org/registry/gles/). @@ -255,7 +255,7 @@ of OpenGL ES extensions is identical except for the name of the extension header The `glext.h` extension header is a continually updated file that defines the interfaces for all OpenGL extensions. The latest version of this can always be -found at the [OpenGL Registry](http://www.opengl.org/registry/). There are also +found at the [OpenGL Registry](https://www.opengl.org/registry/). There are also extension headers for the various versions of OpenGL ES at the [OpenGL ES Registry](https://www.khronos.org/registry/gles/). It it strongly recommended that you use your own copy of the extension header, as the one diff --git a/docs/header.html b/docs/header.html index 16b09a721..f42f49ee4 100644 --- a/docs/header.html +++ b/docs/header.html @@ -21,11 +21,11 @@ $extrastylesheet diff --git a/docs/main.dox b/docs/main.dox index a1a093f56..9dcbcdc83 100644 --- a/docs/main.dox +++ b/docs/main.dox @@ -9,7 +9,7 @@ Vulkan application development. It provides a simple, platform-independent API for creating windows, contexts and surfaces, reading input, handling events, etc. See @ref news_33 for highlights or the -[version history](http://www.glfw.org/changelog.html) for details. +[version history](https://www.glfw.org/changelog.html) for details. @ref quick_guide is a guide for users new to GLFW. It takes you through how to write a small but complete program. @@ -34,14 +34,14 @@ use the new API. There is a section on @ref guarantees_limitations for pointer lifetimes, reentrancy, thread safety, event order and backward and forward compatibility. -The [FAQ](http://www.glfw.org/faq.html) answers many common questions about the +The [FAQ](https://www.glfw.org/faq.html) answers many common questions about the design, implementation and use of GLFW. Finally, @ref compat_guide explains what APIs, standards and protocols GLFW uses and what happens when they are not present on a given machine. This documentation was generated with Doxygen. The sources for it are available -in both the [source distribution](http://www.glfw.org/download.html) and +in both the [source distribution](https://www.glfw.org/download.html) and [GitHub repository](https://github.com/glfw/glfw). */ diff --git a/docs/moving.dox b/docs/moving.dox index 08ef7f24c..85ba0a70c 100644 --- a/docs/moving.dox +++ b/docs/moving.dox @@ -38,8 +38,8 @@ The threading functions have been removed, including the per-thread sleep function. They were fairly primitive, under-used, poorly integrated and took time away from the focus of GLFW (i.e. context, input and window). There are better threading libraries available and native threading support is available -in both [C++11](http://en.cppreference.com/w/cpp/thread) and -[C11](http://en.cppreference.com/w/c/thread), both of which are gaining +in both [C++11](https://en.cppreference.com/w/cpp/thread) and +[C11](https://en.cppreference.com/w/c/thread), both of which are gaining traction. If you wish to use the C++11 or C11 facilities but your compiler doesn't yet @@ -87,7 +87,7 @@ platform-independent, as both OpenGL and stdio are available wherever GLFW is. @subsection moving_stdcall Removal of GLFWCALL macro The `GLFWCALL` macro, which made callback functions use -[__stdcall](http://msdn.microsoft.com/en-us/library/zxk0tw93.aspx) on Windows, +[__stdcall](https://msdn.microsoft.com/en-us/library/zxk0tw93.aspx) on Windows, has been removed. GLFW is written in C, not Pascal. Removing this macro means there's one less thing for application programmers to remember, i.e. the requirement to mark all callback functions with `GLFWCALL`. It also simplifies @@ -379,7 +379,7 @@ glfwGetJoystickAxes and @ref glfwGetJoystickButtons functions. @subsection moving_mbcs Win32 MBCS support The Win32 port of GLFW 3 will not compile in -[MBCS mode](http://msdn.microsoft.com/en-us/library/5z097dxa.aspx). +[MBCS mode](https://msdn.microsoft.com/en-us/library/5z097dxa.aspx). However, because the use of the Unicode version of the Win32 API doesn't affect the process as a whole, but only those windows created using it, it's perfectly possible to call MBCS functions from other parts of the same application. diff --git a/docs/news.dox b/docs/news.dox index d751f13a6..0cdec0055 100644 --- a/docs/news.dox +++ b/docs/news.dox @@ -275,7 +275,7 @@ easy linking with the library and its dependencies. @section news_31 Release notes for 3.1 These are the release highlights. For a full list of changes see the -[version history](http://www.glfw.org/changelog.html). +[version history](https://www.glfw.org/changelog.html). @subsection news_31_cursor Custom mouse cursor images @@ -386,7 +386,7 @@ on Linux with a CMake option. @section news_30 Release notes for 3.0 These are the release highlights. For a full list of changes see the -[version history](http://www.glfw.org/changelog.html). +[version history](https://www.glfw.org/changelog.html). @subsection news_30_cmake CMake build system @@ -397,7 +397,7 @@ supported by GLFW, is present in most package systems and can generate makefiles and/or project files for most popular development environments. For more information on how to use CMake, see the -[CMake manual](http://cmake.org/cmake/help/documentation.html). +[CMake manual](https://cmake.org/cmake/help/documentation.html). @subsection news_30_multiwnd Multi-window support diff --git a/docs/quick.dox b/docs/quick.dox index d8c338220..b67ae3578 100644 --- a/docs/quick.dox +++ b/docs/quick.dox @@ -335,7 +335,7 @@ presses _Escape_ or closes the window. @snippet simple.c code The program above can be found in the -[source package](http://www.glfw.org/download.html) as `examples/simple.c` +[source package](https://www.glfw.org/download.html) as `examples/simple.c` and is compiled along with all other examples when you build GLFW. If you built GLFW from the source package then already have this as `simple.exe` on Windows, `simple` on Linux or `simple.app` on macOS. diff --git a/src/glfw3.pc.in b/src/glfw3.pc.in index f2e4d9769..9feaa80e6 100644 --- a/src/glfw3.pc.in +++ b/src/glfw3.pc.in @@ -6,7 +6,7 @@ libdir=${exec_prefix}/lib@LIB_SUFFIX@ Name: GLFW Description: A multi-platform library for OpenGL, window and input Version: @GLFW_VERSION_FULL@ -URL: http://www.glfw.org/ +URL: https://www.glfw.org/ Requires.private: @GLFW_PKG_DEPS@ Libs: -L${libdir} -l@GLFW_LIB_NAME@ Libs.private: @GLFW_PKG_LIBS@ From da8f3bc174a38198529792defb5d3b5faf3719f9 Mon Sep 17 00:00:00 2001 From: MrVallentin Date: Sat, 3 Nov 2018 08:23:58 +0100 Subject: [PATCH 21/59] Updated URLs --- docs/compile.dox | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/compile.dox b/docs/compile.dox index f9766e8c7..d2133e948 100644 --- a/docs/compile.dox +++ b/docs/compile.dox @@ -10,12 +10,12 @@ build applications that use GLFW, see @ref build_guide. @section compile_cmake Using CMake -GLFW uses [CMake](https://www.cmake.org/) to generate project files or makefiles +GLFW uses [CMake](https://cmake.org/) to generate project files or makefiles for a particular development environment. If you are on a Unix-like system such as Linux or FreeBSD or have a package system like Fink, MacPorts, Cygwin or Homebrew, you can install its CMake package. If not, you can download installers for Windows and macOS from the -[CMake website](https://www.cmake.org/). +[CMake website](https://cmake.org/). @note CMake only generates project files or makefiles. It does not compile the actual GLFW library. To compile GLFW, first generate these files for your @@ -71,7 +71,7 @@ cmake -DCMAKE_TOOLCHAIN_FILE=CMake/x86_64-w64-mingw32.cmake . @endcode For more details see the article -[CMake Cross Compiling](https://www.paraview.org/Wiki/CMake_Cross_Compiling) on +[CMake Cross Compiling](https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/CrossCompiling) on the CMake wiki. Once you have this set up, move on to @ref compile_generate. From 62993d9391469e87c3c69592d436122d73db8b07 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Fri, 26 Oct 2018 13:22:10 +0900 Subject: [PATCH 22/59] x11 window: update cursor position on enter event click events would have an incorrect position after changing workspace, if the mouse didn't move in between. (Another example where this matters is a new window, if it appears under the cursor, clicking would lead the application to think the user clicked at 0,0) --- src/x11_window.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/x11_window.c b/src/x11_window.c index 0ae3b4c8f..5e9161072 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -1455,12 +1455,20 @@ static void processEvent(XEvent *event) case EnterNotify: { + // XEnterWindowEvent is XCrossingEvent + const int x = event->xcrossing.x; + const int y = event->xcrossing.y; + // HACK: This is a workaround for WMs (KWM, Fluxbox) that otherwise // ignore the defined cursor for hidden cursor mode if (window->cursorMode == GLFW_CURSOR_HIDDEN) updateCursorImage(window); _glfwInputCursorEnter(window, GLFW_TRUE); + _glfwInputCursorPos(window, x, y); + + window->x11.lastCursorPosX = x; + window->x11.lastCursorPosY = y; return; } From cc3552465de96118d2fae3c80c5f38dbc89d3d52 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 3 Nov 2018 14:20:16 +0100 Subject: [PATCH 23/59] x11: Add a mention of #1366 in the ChangeLog. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f77f7b428..d2b25d061 100644 --- a/README.md +++ b/README.md @@ -240,6 +240,7 @@ information on what to include when reporting a bug. - [X11] Bugfix: Latin-1 text read from selections was not converted to UTF-8 - [X11] Bugfix: NVidia EGL would segfault if unloaded before closing the display - [X11] Bugfix: Checking window maximized attrib could crash some WMs (#1356) +- [X11] Bugfix: Update cursor position on enter event (#1366) - [Linux] Added workaround for missing `SYN_DROPPED` in pre-2.6.39 kernel headers (#1196) - [Linux] Moved to evdev for joystick input (#906,#1005) From 9bb50db6dde88c9df1646fac48d8c33bc907adcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 4 Nov 2018 21:52:33 +0100 Subject: [PATCH 24/59] Use HTTPS when possible --- docs/CONTRIBUTING.md | 24 ++++++++++++------------ docs/extra.css | 2 +- docs/extra.less | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index bd80c187f..3bee43b95 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -35,7 +35,7 @@ questions without first checking with a maintainer. ## Reporting a bug If GLFW is behaving unexpectedly at run-time, start by setting an [error -callback](http://www.glfw.org/docs/latest/intro_guide.html#error_handling). +callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling). GLFW will often tell you the cause of an error via this callback. If it doesn't, that might be a separate bug. @@ -87,8 +87,8 @@ means linking to many system libraries. If you are using GLFW as a static library, that means your application needs to link to these in addition to GLFW. __Note:__ Check the [Compiling -GLFW](http://www.glfw.org/docs/latest/compile.html) guide and or [Building -applications](http://www.glfw.org/docs/latest/build.html) guide for before +GLFW](https://www.glfw.org/docs/latest/compile.html) guide and or [Building +applications](https://www.glfw.org/docs/latest/build.html) guide for before opening an issue of this kind. Most issues are caused by a missing package or linker flag. @@ -121,7 +121,7 @@ __GLFW commit ID__ (e.g. `3795d78b14ef06008889cc422a1fb8d642597751`) from Git. Please also include any __error messages__ provided to your application via the [error -callback](http://www.glfw.org/docs/latest/intro_guide.html#error_handling) and +callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling) and the __full call stack__ of the crash, or if the crash does not occur in debug mode, mention that instead. @@ -141,13 +141,13 @@ Call stack: __Note:__ Windows ships with graphics drivers that do not support OpenGL. If GLFW says that your machine lacks support for OpenGL, it very likely does. Install drivers from the computer manufacturer or graphics card manufacturer -([Nvidia](http://www.geforce.com/drivers), -[AMD](http://support.amd.com/en-us/download), +([Nvidia](https://www.geforce.com/drivers), +[AMD](https://www.amd.com/en/support), [Intel](https://www-ssl.intel.com/content/www/us/en/support/detect.html)) to fix this. __Note:__ AMD only supports OpenGL ES on Windows via EGL. See the -[GLFW\_CONTEXT\_CREATION\_API](http://www.glfw.org/docs/latest/window_guide.html#window_hints_ctx) +[GLFW\_CONTEXT\_CREATION\_API](https://www.glfw.org/docs/latest/window_guide.html#window_hints_ctx) hint for how to select EGL. Please verify that context creation also fails with the `glfwinfo` tool before @@ -165,7 +165,7 @@ include the __VM name and version__ (e.g. `VirtualBox 5.1`). Please also include the __GLFW version string__ (`3.2.0 X11 EGL clock_gettime /dev/js`), as described -[here](http://www.glfw.org/docs/latest/intro.html#intro_version_string), the +[here](https://www.glfw.org/docs/latest/intro.html#intro_version_string), the __GPU model and driver version__ (e.g. `GeForce GTX660 with 352.79`), and the __output of `glfwinfo`__ (with switches matching any hints you set in your code) when reporting this kind of bug. If this tool doesn't run on the machine, @@ -207,7 +207,7 @@ include the __VM name and version__ (e.g. `VirtualBox 5.1`). Please also include any __error messages__ provided to your application via the [error -callback](http://www.glfw.org/docs/latest/intro_guide.html#error_handling) and +callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling) and the __output of `monitors`__ when reporting this kind of bug. If this tool doesn't run on the machine, mention this instead. @@ -228,7 +228,7 @@ __Note:__ The exact ordering of related window events will sometimes differ. __Note:__ Window moving and resizing (by the user) will block the main thread on some platforms. This is not a bug. Set a [refresh -callback](http://www.glfw.org/docs/latest/window.html#window_refresh) if you +callback](https://www.glfw.org/docs/latest/window.html#window_refresh) if you want to keep the window contents updated during a move or size operation. The `events` tool is included in the GLFW source tree as `tests/events.c` and is @@ -247,7 +247,7 @@ include the __VM name and version__ (e.g. `VirtualBox 5.1`). Please also include any __error messages__ provided to your application via the [error -callback](http://www.glfw.org/docs/latest/intro_guide.html#error_handling) and +callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling) and if relevant, the __output of `events`__ when reporting this kind of bug. If this tool doesn't run on the machine, mention this instead. @@ -276,7 +276,7 @@ __GLFW commit ID__ (e.g. `3795d78b14ef06008889cc422a1fb8d642597751`) from Git. Please also include any __error messages__ provided to your application via the [error -callback](http://www.glfw.org/docs/latest/intro_guide.html#error_handling), if +callback](https://www.glfw.org/docs/latest/intro_guide.html#error_handling), if relevant. diff --git a/docs/extra.css b/docs/extra.css index 42091cd10..e35c77c5b 100644 --- a/docs/extra.css +++ b/docs/extra.css @@ -1 +1 @@ -.sm-dox,.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted,.sm-dox ul a:hover{background:none;text-shadow:none}.sm-dox a span.sub-arrow{border-color:#f2f2f2 transparent transparent transparent}.sm-dox a span.sub-arrow:active,.sm-dox a span.sub-arrow:focus,.sm-dox a span.sub-arrow:hover,.sm-dox a:hover span.sub-arrow{border-color:#f60 transparent transparent transparent}.sm-dox ul a span.sub-arrow:active,.sm-dox ul a span.sub-arrow:focus,.sm-dox ul a span.sub-arrow:hover,.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent #f60}.sm-dox ul a:hover{background:#666;text-shadow:none}.sm-dox ul.sm-nowrap a{color:#4d4d4d;text-shadow:none}#main-nav,#main-menu,#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.memdoc,dl.reflist dd,div.toc li,.ah,span.lineno,span.lineno a,span.lineno a:hover,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,.doxtable code{background:none}#titlearea,.footer,.contents,div.header,.memdoc,table.doxtable td,table.doxtable th,hr,.memSeparator{border:none}#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.reflist dt a.el,.levels span,.directory .levels span{text-shadow:none}.memdoc,dl.reflist dd{box-shadow:none}div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,table.doxtable code{padding:0}#nav-path,.directory .levels,span.lineno{display:none}html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code{background:#f2f2f2}body{color:#4d4d4d}h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em{color:#1a1a1a;border-bottom:none}h1{padding-top:.5em;font-size:180%}h2{padding-top:.5em;margin-bottom:0;font-size:140%}h3{padding-top:.5em;margin-bottom:0;font-size:110%}.glfwheader{font-size:16px;height:64px;max-width:920px;min-width:800px;padding:0 32px;margin:0 auto}#glfwhome{line-height:64px;padding-right:48px;color:#666;font-size:2.5em;background:url("http://www.glfw.org/css/arrow.png") no-repeat right}.glfwnavbar{list-style-type:none;margin:0 auto;float:right}#glfwhome,.glfwnavbar li{float:left}.glfwnavbar a,.glfwnavbar a:visited{line-height:64px;margin-left:2em;display:block;color:#666}#glfwhome,.glfwnavbar a,.glfwnavbar a:visited{transition:.35s ease}#titlearea,.footer{color:#666}address.footer{text-align:center;padding:2em;margin-top:3em}#top{background:#666}#main-nav{max-width:960px;min-width:800px;margin:0 auto;font-size:13px}#main-menu{max-width:920px;min-width:800px;margin:0 auto;font-size:13px}.memtitle{display:none}.memproto,.memname{font-weight:bold;text-shadow:none}#main-menu{height:36px;display:block;position:relative}#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li{color:#f2f2f2}#main-menu li ul.sm-nowrap li a{color:#4d4d4d}#main-menu li ul.sm-nowrap li a:hover{color:#f60}.contents{min-height:590px}div.contents,div.header{max-width:920px;margin:0 auto;padding:0 32px;background:#fff none}table.doxtable th,dl.reflist dt{background:linear-gradient(to bottom, #ffa733 0, #f60 100%);box-shadow:inset 0 0 32px #f60;text-shadow:0 -1px 1px #b34700;text-align:left;color:#fff}dl.reflist dt a.el{color:#f60;padding:.2em;border-radius:4px;background-color:#ffe0cc}div.toc{float:none;width:auto}div.toc h3{font-size:1.17em}div.toc ul{padding-left:1.5em}div.toc li{font-size:1em;padding-left:0;list-style-type:disc}div.toc,.memproto,div.qindex,div.ah{background:linear-gradient(to bottom, #f2f2f2 0, #e6e6e6 100%);box-shadow:inset 0 0 32px #e6e6e6;text-shadow:0 1px 1px #fff;color:#1a1a1a;border:2px solid #e6e6e6;border-radius:4px}.paramname{color:#803300}dl.reflist dt{border:2px solid #f60;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom:none}dl.reflist dd{border:2px solid #f60;border-bottom-right-radius:4px;border-bottom-left-radius:4px;border-top:none}table.doxtable{border-collapse:inherit;border-spacing:0;border:2px solid #f60;border-radius:4px}a,a:hover,a:visited,a:visited:hover,.contents a:visited,.el,a.el:visited,#glfwhome:hover,#main-menu a:hover,span.lineno a:hover{color:#f60;text-decoration:none}div.directory{border-collapse:inherit;border-spacing:0;border:2px solid #f60;border-radius:4px}hr,.memSeparator{height:2px;background:linear-gradient(to right, #f2f2f2 0, #d9d9d9 50%, #f2f2f2 100%)}dl.note,dl.pre,dl.post,dl.invariant{background:linear-gradient(to bottom, #ddfad1 0, #cbf7ba 100%);box-shadow:inset 0 0 32px #baf5a3;color:#1e5309;border:2px solid #afe599}dl.warning,dl.attention{background:linear-gradient(to bottom, #fae8d1 0, #f7ddba 100%);box-shadow:inset 0 0 32px #f5d1a3;color:#533309;border:2px solid #e5c499}dl.deprecated,dl.bug{background:linear-gradient(to bottom, #fad1e3 0, #f7bad6 100%);box-shadow:inset 0 0 32px #f5a3c8;color:#53092a;border:2px solid #e599bb}dl.todo,dl.test{background:linear-gradient(to bottom, #d1ecfa 0, #bae3f7 100%);box-shadow:inset 0 0 32px #a3daf5;color:#093a53;border:2px solid #99cce5}dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test{border-radius:4px;padding:1em;text-shadow:0 1px 1px #fff;margin:1em 0}.note a,.pre a,.post a,.invariant a,.warning a,.attention a,.deprecated a,.bug a,.todo a,.test a,.note a:visited,.pre a:visited,.post a:visited,.invariant a:visited,.warning a:visited,.attention a:visited,.deprecated a:visited,.bug a:visited,.todo a:visited,.test a:visited{color:inherit}div.line{line-height:inherit}div.fragment,pre.fragment{background:#f2f2f2;border-radius:4px;border:none;padding:1em;overflow:auto;border-left:4px solid #ccc;margin:1em 0}.lineno a,.lineno a:visited,.line,pre.fragment{color:#4d4d4d}span.preprocessor,span.comment{color:#007899}a.code,a.code:visited{color:#e64500}span.keyword,span.keywordtype,span.keywordflow{color:#404040;font-weight:bold}span.stringliteral{color:#360099}code{padding:.1em;border-radius:4px} +.sm-dox,.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted,.sm-dox ul a:hover{background:none;text-shadow:none}.sm-dox a span.sub-arrow{border-color:#f2f2f2 transparent transparent transparent}.sm-dox a span.sub-arrow:active,.sm-dox a span.sub-arrow:focus,.sm-dox a span.sub-arrow:hover,.sm-dox a:hover span.sub-arrow{border-color:#f60 transparent transparent transparent}.sm-dox ul a span.sub-arrow:active,.sm-dox ul a span.sub-arrow:focus,.sm-dox ul a span.sub-arrow:hover,.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent #f60}.sm-dox ul a:hover{background:#666;text-shadow:none}.sm-dox ul.sm-nowrap a{color:#4d4d4d;text-shadow:none}#main-nav,#main-menu,#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.memdoc,dl.reflist dd,div.toc li,.ah,span.lineno,span.lineno a,span.lineno a:hover,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,.doxtable code{background:none}#titlearea,.footer,.contents,div.header,.memdoc,table.doxtable td,table.doxtable th,hr,.memSeparator{border:none}#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.reflist dt a.el,.levels span,.directory .levels span{text-shadow:none}.memdoc,dl.reflist dd{box-shadow:none}div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,table.doxtable code{padding:0}#nav-path,.directory .levels,span.lineno{display:none}html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code{background:#f2f2f2}body{color:#4d4d4d}h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em{color:#1a1a1a;border-bottom:none}h1{padding-top:.5em;font-size:180%}h2{padding-top:.5em;margin-bottom:0;font-size:140%}h3{padding-top:.5em;margin-bottom:0;font-size:110%}.glfwheader{font-size:16px;height:64px;max-width:920px;min-width:800px;padding:0 32px;margin:0 auto}#glfwhome{line-height:64px;padding-right:48px;color:#666;font-size:2.5em;background:url("https://www.glfw.org/css/arrow.png") no-repeat right}.glfwnavbar{list-style-type:none;margin:0 auto;float:right}#glfwhome,.glfwnavbar li{float:left}.glfwnavbar a,.glfwnavbar a:visited{line-height:64px;margin-left:2em;display:block;color:#666}#glfwhome,.glfwnavbar a,.glfwnavbar a:visited{transition:.35s ease}#titlearea,.footer{color:#666}address.footer{text-align:center;padding:2em;margin-top:3em}#top{background:#666}#main-nav{max-width:960px;min-width:800px;margin:0 auto;font-size:13px}#main-menu{max-width:920px;min-width:800px;margin:0 auto;font-size:13px}.memtitle{display:none}.memproto,.memname{font-weight:bold;text-shadow:none}#main-menu{height:36px;display:block;position:relative}#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li{color:#f2f2f2}#main-menu li ul.sm-nowrap li a{color:#4d4d4d}#main-menu li ul.sm-nowrap li a:hover{color:#f60}.contents{min-height:590px}div.contents,div.header{max-width:920px;margin:0 auto;padding:0 32px;background:#fff none}table.doxtable th,dl.reflist dt{background:linear-gradient(to bottom, #ffa733 0, #f60 100%);box-shadow:inset 0 0 32px #f60;text-shadow:0 -1px 1px #b34700;text-align:left;color:#fff}dl.reflist dt a.el{color:#f60;padding:.2em;border-radius:4px;background-color:#ffe0cc}div.toc{float:none;width:auto}div.toc h3{font-size:1.17em}div.toc ul{padding-left:1.5em}div.toc li{font-size:1em;padding-left:0;list-style-type:disc}div.toc,.memproto,div.qindex,div.ah{background:linear-gradient(to bottom, #f2f2f2 0, #e6e6e6 100%);box-shadow:inset 0 0 32px #e6e6e6;text-shadow:0 1px 1px #fff;color:#1a1a1a;border:2px solid #e6e6e6;border-radius:4px}.paramname{color:#803300}dl.reflist dt{border:2px solid #f60;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom:none}dl.reflist dd{border:2px solid #f60;border-bottom-right-radius:4px;border-bottom-left-radius:4px;border-top:none}table.doxtable{border-collapse:inherit;border-spacing:0;border:2px solid #f60;border-radius:4px}a,a:hover,a:visited,a:visited:hover,.contents a:visited,.el,a.el:visited,#glfwhome:hover,#main-menu a:hover,span.lineno a:hover{color:#f60;text-decoration:none}div.directory{border-collapse:inherit;border-spacing:0;border:2px solid #f60;border-radius:4px}hr,.memSeparator{height:2px;background:linear-gradient(to right, #f2f2f2 0, #d9d9d9 50%, #f2f2f2 100%)}dl.note,dl.pre,dl.post,dl.invariant{background:linear-gradient(to bottom, #ddfad1 0, #cbf7ba 100%);box-shadow:inset 0 0 32px #baf5a3;color:#1e5309;border:2px solid #afe599}dl.warning,dl.attention{background:linear-gradient(to bottom, #fae8d1 0, #f7ddba 100%);box-shadow:inset 0 0 32px #f5d1a3;color:#533309;border:2px solid #e5c499}dl.deprecated,dl.bug{background:linear-gradient(to bottom, #fad1e3 0, #f7bad6 100%);box-shadow:inset 0 0 32px #f5a3c8;color:#53092a;border:2px solid #e599bb}dl.todo,dl.test{background:linear-gradient(to bottom, #d1ecfa 0, #bae3f7 100%);box-shadow:inset 0 0 32px #a3daf5;color:#093a53;border:2px solid #99cce5}dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test{border-radius:4px;padding:1em;text-shadow:0 1px 1px #fff;margin:1em 0}.note a,.pre a,.post a,.invariant a,.warning a,.attention a,.deprecated a,.bug a,.todo a,.test a,.note a:visited,.pre a:visited,.post a:visited,.invariant a:visited,.warning a:visited,.attention a:visited,.deprecated a:visited,.bug a:visited,.todo a:visited,.test a:visited{color:inherit}div.line{line-height:inherit}div.fragment,pre.fragment{background:#f2f2f2;border-radius:4px;border:none;padding:1em;overflow:auto;border-left:4px solid #ccc;margin:1em 0}.lineno a,.lineno a:visited,.line,pre.fragment{color:#4d4d4d}span.preprocessor,span.comment{color:#007899}a.code,a.code:visited{color:#e64500}span.keyword,span.keywordtype,span.keywordflow{color:#404040;font-weight:bold}span.stringliteral{color:#360099}code{padding:.1em;border-radius:4px} diff --git a/docs/extra.less b/docs/extra.less index 53e94f751..2ea9d2889 100644 --- a/docs/extra.less +++ b/docs/extra.less @@ -171,7 +171,7 @@ h3 { padding-right:48px; color:@header-footer-link-color; font-size:2.5em; - background:url("http://www.glfw.org/css/arrow.png") no-repeat right; + background:url("https://www.glfw.org/css/arrow.png") no-repeat right; } .glfwnavbar { From 53c8c72c676ca97c10aedfe3d0eb4271c5b23dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 4 Nov 2018 23:23:55 +0100 Subject: [PATCH 25/59] Fix CSS for Doxygen Markdown tables Doxygen changed the CSS classes for table-related elements. --- docs/extra.css | 2 +- docs/extra.less | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/extra.css b/docs/extra.css index e35c77c5b..032b7c2fa 100644 --- a/docs/extra.css +++ b/docs/extra.css @@ -1 +1 @@ -.sm-dox,.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted,.sm-dox ul a:hover{background:none;text-shadow:none}.sm-dox a span.sub-arrow{border-color:#f2f2f2 transparent transparent transparent}.sm-dox a span.sub-arrow:active,.sm-dox a span.sub-arrow:focus,.sm-dox a span.sub-arrow:hover,.sm-dox a:hover span.sub-arrow{border-color:#f60 transparent transparent transparent}.sm-dox ul a span.sub-arrow:active,.sm-dox ul a span.sub-arrow:focus,.sm-dox ul a span.sub-arrow:hover,.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent #f60}.sm-dox ul a:hover{background:#666;text-shadow:none}.sm-dox ul.sm-nowrap a{color:#4d4d4d;text-shadow:none}#main-nav,#main-menu,#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.memdoc,dl.reflist dd,div.toc li,.ah,span.lineno,span.lineno a,span.lineno a:hover,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,.doxtable code{background:none}#titlearea,.footer,.contents,div.header,.memdoc,table.doxtable td,table.doxtable th,hr,.memSeparator{border:none}#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.reflist dt a.el,.levels span,.directory .levels span{text-shadow:none}.memdoc,dl.reflist dd{box-shadow:none}div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,table.doxtable code{padding:0}#nav-path,.directory .levels,span.lineno{display:none}html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code{background:#f2f2f2}body{color:#4d4d4d}h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em{color:#1a1a1a;border-bottom:none}h1{padding-top:.5em;font-size:180%}h2{padding-top:.5em;margin-bottom:0;font-size:140%}h3{padding-top:.5em;margin-bottom:0;font-size:110%}.glfwheader{font-size:16px;height:64px;max-width:920px;min-width:800px;padding:0 32px;margin:0 auto}#glfwhome{line-height:64px;padding-right:48px;color:#666;font-size:2.5em;background:url("https://www.glfw.org/css/arrow.png") no-repeat right}.glfwnavbar{list-style-type:none;margin:0 auto;float:right}#glfwhome,.glfwnavbar li{float:left}.glfwnavbar a,.glfwnavbar a:visited{line-height:64px;margin-left:2em;display:block;color:#666}#glfwhome,.glfwnavbar a,.glfwnavbar a:visited{transition:.35s ease}#titlearea,.footer{color:#666}address.footer{text-align:center;padding:2em;margin-top:3em}#top{background:#666}#main-nav{max-width:960px;min-width:800px;margin:0 auto;font-size:13px}#main-menu{max-width:920px;min-width:800px;margin:0 auto;font-size:13px}.memtitle{display:none}.memproto,.memname{font-weight:bold;text-shadow:none}#main-menu{height:36px;display:block;position:relative}#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li{color:#f2f2f2}#main-menu li ul.sm-nowrap li a{color:#4d4d4d}#main-menu li ul.sm-nowrap li a:hover{color:#f60}.contents{min-height:590px}div.contents,div.header{max-width:920px;margin:0 auto;padding:0 32px;background:#fff none}table.doxtable th,dl.reflist dt{background:linear-gradient(to bottom, #ffa733 0, #f60 100%);box-shadow:inset 0 0 32px #f60;text-shadow:0 -1px 1px #b34700;text-align:left;color:#fff}dl.reflist dt a.el{color:#f60;padding:.2em;border-radius:4px;background-color:#ffe0cc}div.toc{float:none;width:auto}div.toc h3{font-size:1.17em}div.toc ul{padding-left:1.5em}div.toc li{font-size:1em;padding-left:0;list-style-type:disc}div.toc,.memproto,div.qindex,div.ah{background:linear-gradient(to bottom, #f2f2f2 0, #e6e6e6 100%);box-shadow:inset 0 0 32px #e6e6e6;text-shadow:0 1px 1px #fff;color:#1a1a1a;border:2px solid #e6e6e6;border-radius:4px}.paramname{color:#803300}dl.reflist dt{border:2px solid #f60;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom:none}dl.reflist dd{border:2px solid #f60;border-bottom-right-radius:4px;border-bottom-left-radius:4px;border-top:none}table.doxtable{border-collapse:inherit;border-spacing:0;border:2px solid #f60;border-radius:4px}a,a:hover,a:visited,a:visited:hover,.contents a:visited,.el,a.el:visited,#glfwhome:hover,#main-menu a:hover,span.lineno a:hover{color:#f60;text-decoration:none}div.directory{border-collapse:inherit;border-spacing:0;border:2px solid #f60;border-radius:4px}hr,.memSeparator{height:2px;background:linear-gradient(to right, #f2f2f2 0, #d9d9d9 50%, #f2f2f2 100%)}dl.note,dl.pre,dl.post,dl.invariant{background:linear-gradient(to bottom, #ddfad1 0, #cbf7ba 100%);box-shadow:inset 0 0 32px #baf5a3;color:#1e5309;border:2px solid #afe599}dl.warning,dl.attention{background:linear-gradient(to bottom, #fae8d1 0, #f7ddba 100%);box-shadow:inset 0 0 32px #f5d1a3;color:#533309;border:2px solid #e5c499}dl.deprecated,dl.bug{background:linear-gradient(to bottom, #fad1e3 0, #f7bad6 100%);box-shadow:inset 0 0 32px #f5a3c8;color:#53092a;border:2px solid #e599bb}dl.todo,dl.test{background:linear-gradient(to bottom, #d1ecfa 0, #bae3f7 100%);box-shadow:inset 0 0 32px #a3daf5;color:#093a53;border:2px solid #99cce5}dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test{border-radius:4px;padding:1em;text-shadow:0 1px 1px #fff;margin:1em 0}.note a,.pre a,.post a,.invariant a,.warning a,.attention a,.deprecated a,.bug a,.todo a,.test a,.note a:visited,.pre a:visited,.post a:visited,.invariant a:visited,.warning a:visited,.attention a:visited,.deprecated a:visited,.bug a:visited,.todo a:visited,.test a:visited{color:inherit}div.line{line-height:inherit}div.fragment,pre.fragment{background:#f2f2f2;border-radius:4px;border:none;padding:1em;overflow:auto;border-left:4px solid #ccc;margin:1em 0}.lineno a,.lineno a:visited,.line,pre.fragment{color:#4d4d4d}span.preprocessor,span.comment{color:#007899}a.code,a.code:visited{color:#e64500}span.keyword,span.keywordtype,span.keywordflow{color:#404040;font-weight:bold}span.stringliteral{color:#360099}code{padding:.1em;border-radius:4px} +.sm-dox,.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted,.sm-dox ul a:hover{background:none;text-shadow:none}.sm-dox a span.sub-arrow{border-color:#f2f2f2 transparent transparent transparent}.sm-dox a span.sub-arrow:active,.sm-dox a span.sub-arrow:focus,.sm-dox a span.sub-arrow:hover,.sm-dox a:hover span.sub-arrow{border-color:#f60 transparent transparent transparent}.sm-dox ul a span.sub-arrow:active,.sm-dox ul a span.sub-arrow:focus,.sm-dox ul a span.sub-arrow:hover,.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent #f60}.sm-dox ul a:hover{background:#666;text-shadow:none}.sm-dox ul.sm-nowrap a{color:#4d4d4d;text-shadow:none}#main-nav,#main-menu,#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.memdoc,dl.reflist dd,div.toc li,.ah,span.lineno,span.lineno a,span.lineno a:hover,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,.doxtable code,.markdownTable code{background:none}#titlearea,.footer,.contents,div.header,.memdoc,table.doxtable td,table.doxtable th,table.markdownTable td,table.markdownTable th,hr,.memSeparator{border:none}#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.reflist dt a.el,.levels span,.directory .levels span{text-shadow:none}.memdoc,dl.reflist dd{box-shadow:none}div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,table.doxtable code,table.markdownTable code{padding:0}#nav-path,.directory .levels,span.lineno{display:none}html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),tr.markdownTableBody:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code{background:#f2f2f2}body{color:#4d4d4d}h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em{color:#1a1a1a;border-bottom:none}h1{padding-top:0.5em;font-size:180%}h2{padding-top:0.5em;margin-bottom:0;font-size:140%}h3{padding-top:0.5em;margin-bottom:0;font-size:110%}.glfwheader{font-size:16px;height:64px;max-width:920px;min-width:800px;padding:0 32px;margin:0 auto}#glfwhome{line-height:64px;padding-right:48px;color:#666;font-size:2.5em;background:url("https://www.glfw.org/css/arrow.png") no-repeat right}.glfwnavbar{list-style-type:none;margin:0 auto;float:right}#glfwhome,.glfwnavbar li{float:left}.glfwnavbar a,.glfwnavbar a:visited{line-height:64px;margin-left:2em;display:block;color:#666}#glfwhome,.glfwnavbar a,.glfwnavbar a:visited{transition:.35s ease}#titlearea,.footer{color:#666}address.footer{text-align:center;padding:2em;margin-top:3em}#top{background:#666}#main-nav{max-width:960px;min-width:800px;margin:0 auto;font-size:13px}#main-menu{max-width:920px;min-width:800px;margin:0 auto;font-size:13px}.memtitle{display:none}.memproto,.memname{font-weight:bold;text-shadow:none}#main-menu{height:36px;display:block;position:relative}#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li{color:#f2f2f2}#main-menu li ul.sm-nowrap li a{color:#4d4d4d}#main-menu li ul.sm-nowrap li a:hover{color:#f60}.contents{min-height:590px}div.contents,div.header{max-width:920px;margin:0 auto;padding:0 32px;background:#fff none}table.doxtable th,table.markdownTable th,dl.reflist dt{background:linear-gradient(to bottom, #ffa733 0, #f60 100%);box-shadow:inset 0 0 32px #f60;text-shadow:0 -1px 1px #b34700;text-align:left;color:#fff}dl.reflist dt a.el{color:#f60;padding:.2em;border-radius:4px;background-color:#ffe0cc}div.toc{float:none;width:auto}div.toc h3{font-size:1.17em}div.toc ul{padding-left:1.5em}div.toc li{font-size:1em;padding-left:0;list-style-type:disc}div.toc,.memproto,div.qindex,div.ah{background:linear-gradient(to bottom, #f2f2f2 0, #e6e6e6 100%);box-shadow:inset 0 0 32px #e6e6e6;text-shadow:0 1px 1px #fff;color:#1a1a1a;border:2px solid #e6e6e6;border-radius:4px}.paramname{color:#803300}dl.reflist dt{border:2px solid #f60;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom:none}dl.reflist dd{border:2px solid #f60;border-bottom-right-radius:4px;border-bottom-left-radius:4px;border-top:none}table.doxtable,table.markdownTable{border-collapse:inherit;border-spacing:0;border:2px solid #f60;border-radius:4px}a,a:hover,a:visited,a:visited:hover,.contents a:visited,.el,a.el:visited,#glfwhome:hover,#main-menu a:hover,span.lineno a:hover{color:#f60;text-decoration:none}div.directory{border-collapse:inherit;border-spacing:0;border:2px solid #f60;border-radius:4px}hr,.memSeparator{height:2px;background:linear-gradient(to right, #f2f2f2 0, #d9d9d9 50%, #f2f2f2 100%)}dl.note,dl.pre,dl.post,dl.invariant{background:linear-gradient(to bottom, #ddfad1 0, #cbf7ba 100%);box-shadow:inset 0 0 32px #baf5a3;color:#1e5309;border:2px solid #afe599}dl.warning,dl.attention{background:linear-gradient(to bottom, #fae8d1 0, #f7ddba 100%);box-shadow:inset 0 0 32px #f5d1a3;color:#533309;border:2px solid #e5c499}dl.deprecated,dl.bug{background:linear-gradient(to bottom, #fad1e3 0, #f7bad6 100%);box-shadow:inset 0 0 32px #f5a3c8;color:#53092a;border:2px solid #e599bb}dl.todo,dl.test{background:linear-gradient(to bottom, #d1ecfa 0, #bae3f7 100%);box-shadow:inset 0 0 32px #a3daf5;color:#093a53;border:2px solid #99cce5}dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test{border-radius:4px;padding:1em;text-shadow:0 1px 1px #fff;margin:1em 0}.note a,.pre a,.post a,.invariant a,.warning a,.attention a,.deprecated a,.bug a,.todo a,.test a,.note a:visited,.pre a:visited,.post a:visited,.invariant a:visited,.warning a:visited,.attention a:visited,.deprecated a:visited,.bug a:visited,.todo a:visited,.test a:visited{color:inherit}div.line{line-height:inherit}div.fragment,pre.fragment{background:#f2f2f2;border-radius:4px;border:none;padding:1em;overflow:auto;border-left:4px solid #ccc;margin:1em 0}.lineno a,.lineno a:visited,.line,pre.fragment{color:#4d4d4d}span.preprocessor,span.comment{color:#007899}a.code,a.code:visited{color:#e64500}span.keyword,span.keywordtype,span.keywordflow{color:#404040;font-weight:bold}span.stringliteral{color:#360099}code{padding:.1em;border-radius:4px} diff --git a/docs/extra.less b/docs/extra.less index 2ea9d2889..ff1dd69e3 100644 --- a/docs/extra.less +++ b/docs/extra.less @@ -103,11 +103,11 @@ text-shadow:none; } -#main-nav,#main-menu,#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.memdoc,dl.reflist dd,div.toc li,.ah,span.lineno,span.lineno a,span.lineno a:hover,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,.doxtable code { +#main-nav,#main-menu,#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.memdoc,dl.reflist dd,div.toc li,.ah,span.lineno,span.lineno a,span.lineno a:hover,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,.doxtable code,.markdownTable code { background:none; } -#titlearea,.footer,.contents,div.header,.memdoc,table.doxtable td,table.doxtable th,hr,.memSeparator { +#titlearea,.footer,.contents,div.header,.memdoc,table.doxtable td,table.doxtable th,table.markdownTable td,table.markdownTable th,hr,.memSeparator { border:none; } @@ -119,7 +119,7 @@ box-shadow:none; } -div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,table.doxtable code { +div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,table.doxtable code,table.markdownTable code { padding:0; } @@ -127,7 +127,7 @@ div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.a display:none; } -html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code { +html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),tr.markdownTableBody:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code { background:@header-footer-background-color; } @@ -261,7 +261,7 @@ div.contents,div.header { background:@content-background-color none; } -table.doxtable th,dl.reflist dt { +table.doxtable th,table.markdownTable th,dl.reflist dt { background:linear-gradient(to bottom,@table-background-color2 0%,@table-background-color1 100%); box-shadow:inset 0 0 32px @table-background-color1; text-shadow:0 -1px 1px darken(@table-background-color1, 15%); @@ -322,7 +322,7 @@ dl.reflist dd { border-top:none; } -table.doxtable { +table.doxtable,table.markdownTable { border-collapse:inherit; border-spacing:0; border:2px solid @default-border-color; From 1fe340982fc6cfbd70eac13a4d438c3bd02fd5fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 5 Nov 2018 14:57:15 +0100 Subject: [PATCH 26/59] Revert accidental Nuklear edit --- deps/nuklear.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/nuklear.h b/deps/nuklear.h index 05b9b3df2..6c873535b 100644 --- a/deps/nuklear.h +++ b/deps/nuklear.h @@ -13644,7 +13644,7 @@ nk_font_atlas_bake(struct nk_font_atlas *atlas, int *width, int *height, #ifdef NK_INCLUDE_DEFAULT_FONT /* no font added so just use default font */ if (!atlas->font_num) - atlas->default_font = nk_font_atlas_add_default(atlas, 20.0f, 0); + atlas->default_font = nk_font_atlas_add_default(atlas, 13.0f, 0); #endif NK_ASSERT(atlas->font_num); if (!atlas->font_num) return 0; From bc5a24fee65df537226a70b623693f80e0823be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 5 Nov 2018 16:55:52 +0100 Subject: [PATCH 27/59] Fix newlines in Doxygen aliases --- docs/Doxyfile.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index ec1c382e3..361a09bb4 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -195,12 +195,12 @@ TAB_SIZE = 8 # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. -ALIASES = "thread_safety=@par Thread safety\n" \ - "pointer_lifetime=@par Pointer lifetime\n" \ - "analysis=@par Analysis\n" \ - "reentrancy=@par Reentrancy\n" \ - "errors=@par Errors\n" \ - "glfw3=@par\n__GLFW 3:__" \ +ALIASES = "thread_safety=@par Thread safety^^" \ + "pointer_lifetime=@par Pointer lifetime^^" \ + "analysis=@par Analysis^^" \ + "reentrancy=@par Reentrancy^^" \ + "errors=@par Errors^^" \ + "glfw3=__GLFW 3:__" \ "x11=__X11:__" \ "wayland=__Wayland:__" \ "win32=__Windows:__" \ From fb01b16b94a9d1624cbf54b13875ce81e087ff5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 5 Nov 2018 17:37:09 +0100 Subject: [PATCH 28/59] Use Doxygen layout file --- docs/Doxyfile.in | 2 +- docs/DoxygenLayout.xml | 126 ++--------------------------------------- 2 files changed, 5 insertions(+), 123 deletions(-) diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index 361a09bb4..27ed92c4b 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -589,7 +589,7 @@ FILE_VERSION_FILTER = # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. -LAYOUT_FILE = +LAYOUT_FILE = "@GLFW_SOURCE_DIR@/docs/DoxygenLayout.xml" # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The diff --git a/docs/DoxygenLayout.xml b/docs/DoxygenLayout.xml index a7e175306..2fda544ec 100644 --- a/docs/DoxygenLayout.xml +++ b/docs/DoxygenLayout.xml @@ -1,115 +1,20 @@ - + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + @@ -117,9 +22,7 @@ - - @@ -131,46 +34,26 @@ - - - - - - - - - - - - - - - - - - - - @@ -178,7 +61,6 @@ - From 041167895d338b01da9ad82af37caa58a92e0069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 5 Nov 2018 17:37:49 +0100 Subject: [PATCH 29/59] Documentation work --- include/GLFW/glfw3.h | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index a511b94fc..d674cd63e 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -269,23 +269,22 @@ extern "C" { #define GLFW_VERSION_REVISION 0 /*! @} */ -/*! @name Boolean values - * @{ */ /*! @brief One. * - * One. Seriously. You don't _need_ to use this symbol in your code. It's - * semantic sugar for the number 1. You can also use `1` or `true` or `_True` - * or `GL_TRUE` or whatever you want. + * This is only semantic sugar for the number 1. You can instead use `1` or + * `true` or `_True` or `GL_TRUE` or anything else that is equal to one. + * + * @ingroup init */ #define GLFW_TRUE 1 /*! @brief Zero. * - * Zero. Seriously. You don't _need_ to use this symbol in your code. It's - * semantic sugar for the number 0. You can also use `0` or `false` or - * `_False` or `GL_FALSE` or whatever you want. + * This is only semantic sugar for the number 0. You can instead use `0` or + * `false` or `_False` or `GL_FALSE` or anything else that is equal to zero. + * + * @ingroup init */ #define GLFW_FALSE 0 -/*! @} */ /*! @name Key and button actions * @{ */ @@ -313,6 +312,7 @@ extern "C" { /*! @} */ /*! @defgroup hat_state Joystick hat states + * @brief Joystick hat states. * * See [joystick hat input](@ref joystick_hat) for how these are used. * @@ -1060,9 +1060,20 @@ extern "C" { /*! @addtogroup init * @{ */ +/*! @brief Joystick hat buttons init hint. + * + * Joystick hat buttons [init hint](@ref GLFW_JOYSTICK_HAT_BUTTONS) + */ #define GLFW_JOYSTICK_HAT_BUTTONS 0x00050001 - +/*! @brief macOS specific init hint. + * + * macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES) + */ #define GLFW_COCOA_CHDIR_RESOURCES 0x00051001 +/*! @brief macOS specific init hint. + * + * macOS specific [init hint](@ref GLFW_COCOA_MENUBAR) + */ #define GLFW_COCOA_MENUBAR 0x00051002 /*! @} */ @@ -1133,7 +1144,7 @@ typedef struct GLFWwindow GLFWwindow; * * @since Added in version 3.1. * - * @ingroup cursor + * @ingroup input */ typedef struct GLFWcursor GLFWcursor; @@ -1571,6 +1582,8 @@ typedef struct GLFWgammaramp * * @since Added in version 2.1. * @glfw3 Removed format and bytes-per-pixel members. + * + * @ingroup window */ typedef struct GLFWimage { @@ -1593,6 +1606,8 @@ typedef struct GLFWimage * @sa @ref glfwGetGamepadState * * @since Added in version 3.3. + * + * @ingroup input */ typedef struct GLFWgamepadstate { From a9892acb94a1b47911cfc5a89ea18f781412d159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 5 Nov 2018 17:41:51 +0100 Subject: [PATCH 30/59] Add tutorial to Doxygen menu --- docs/DoxygenLayout.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/DoxygenLayout.xml b/docs/DoxygenLayout.xml index 2fda544ec..ab9717218 100644 --- a/docs/DoxygenLayout.xml +++ b/docs/DoxygenLayout.xml @@ -3,6 +3,7 @@ + From 9bfdd218fb96c90667923ad2b20c67041aa010e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 11 Nov 2018 18:49:47 +0100 Subject: [PATCH 31/59] Fix Markdown table heads --- docs/input.dox | 2 +- docs/window.dox | 2 +- include/GLFW/glfw3.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/input.dox b/docs/input.dox index 8f069a7ee..84978bd09 100644 --- a/docs/input.dox +++ b/docs/input.dox @@ -583,7 +583,7 @@ const unsigned char* hats = glfwGetJoystickHats(GLFW_JOYSTICK_7, &count); Each element in the returned array is one of the following: Name | Value ---------------------- | -------------------------------- +---- | ----- `GLFW_HAT_CENTERED` | 0 `GLFW_HAT_UP` | 1 `GLFW_HAT_RIGHT` | 2 diff --git a/docs/window.dox b/docs/window.dox index 355a74e83..f30127847 100644 --- a/docs/window.dox +++ b/docs/window.dox @@ -68,7 +68,7 @@ set for the chosen monitor as long as the window has input focus. For more information about retrieving video modes, see @ref monitor_modes. Video mode field | Corresponds to ------------------------ | ------------------------ +---------------- | -------------- GLFWvidmode.width | `width` parameter GLFWvidmode.height | `height` parameter GLFWvidmode.redBits | @ref GLFW_RED_BITS hint diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index d674cd63e..993222ffe 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -4600,7 +4600,7 @@ GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count); * Each element in the array is one of the following values: * * Name | Value - * --------------------- | -------------------------------- + * ---- | ----- * `GLFW_HAT_CENTERED` | 0 * `GLFW_HAT_UP` | 1 * `GLFW_HAT_RIGHT` | 2 From 18145a7f3dc4e7831801680b29f14adec9b36b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 19 Nov 2018 22:27:51 +0100 Subject: [PATCH 32/59] Cocoa: Use NSURLs for drag and drop Fixes #1377. --- src/cocoa_window.m | 45 ++++++++++++++------------------------------- 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 43a38ddad..cede088c0 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -51,7 +51,6 @@ #endif #if MAC_OS_X_VERSION_MAX_ALLOWED < 101300 - #define NSPasteboardTypeFileURL NSFilenamesPboardType #define NSPasteboardTypeString NSStringPboardType #endif @@ -442,8 +441,9 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; markedText = [[NSMutableAttributedString alloc] init]; [self updateTrackingAreas]; - [self registerForDraggedTypes:[NSArray arrayWithObjects: - NSPasteboardTypeFileURL, nil]]; + // NOTE: kUTTypeURL corresponds to NSPasteboardTypeURL but is available + // on 10.7 without having been deprecated yet + [self registerForDraggedTypes:@[(__bridge NSString*) kUTTypeURL]]; } return self; @@ -713,45 +713,33 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; - (NSDragOperation)draggingEntered:(id )sender { - if ((NSDragOperationGeneric & [sender draggingSourceOperationMask]) - == NSDragOperationGeneric) - { - [self setNeedsDisplay:YES]; - return NSDragOperationGeneric; - } - - return NSDragOperationNone; -} - -- (BOOL)prepareForDragOperation:(id )sender -{ - [self setNeedsDisplay:YES]; - return YES; + // HACK: We don't know what to say here because we don't know what the + // application wants to do with the paths + return NSDragOperationGeneric; } - (BOOL)performDragOperation:(id )sender { - NSPasteboard* pasteboard = [sender draggingPasteboard]; - NSArray* files = [pasteboard propertyListForType:NSPasteboardTypeFileURL]; - const NSRect contentRect = [window->ns.view frame]; _glfwInputCursorPos(window, [sender draggingLocation].x, contentRect.size.height - [sender draggingLocation].y); - const NSUInteger count = [files count]; + NSPasteboard* pasteboard = [sender draggingPasteboard]; + NSDictionary* options = @{NSPasteboardURLReadingFileURLsOnlyKey:@YES}; + NSArray* urls = [pasteboard readObjectsForClasses:@[[NSURL class]] + options:options]; + const NSUInteger count = [urls count]; if (count) { - NSEnumerator* e = [files objectEnumerator]; char** paths = calloc(count, sizeof(char*)); - NSUInteger i; - for (i = 0; i < count; i++) - paths[i] = _glfw_strdup([[e nextObject] UTF8String]); + for (NSUInteger i = 0; i < count; i++) + paths[i] = _glfw_strdup([[urls objectAtIndex:i] fileSystemRepresentation]); _glfwInputDrop(window, (int) count, (const char**) paths); - for (i = 0; i < count; i++) + for (NSUInteger i = 0; i < count; i++) free(paths[i]); free(paths); } @@ -759,11 +747,6 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; return YES; } -- (void)concludeDragOperation:(id )sender -{ - [self setNeedsDisplay:YES]; -} - - (BOOL)hasMarkedText { return [markedText length] > 0; From f680001b95f337e4a2e859cda06c8f8dbd2c8bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 27 Nov 2018 21:32:40 +0100 Subject: [PATCH 33/59] Cocoa: Remove superfluous compatibility macro --- src/cocoa_window.m | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index cede088c0..9c018eb8b 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -50,10 +50,6 @@ #define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat #endif -#if MAC_OS_X_VERSION_MAX_ALLOWED < 101300 - #define NSPasteboardTypeString NSStringPboardType -#endif - // Returns the style mask corresponding to the window settings // static NSUInteger getStyleMask(_GLFWwindow* window) From bb2ca1da1337dece652332cddb9f13067cd92a03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 27 Nov 2018 21:49:19 +0100 Subject: [PATCH 34/59] Remove trailing whitespace --- include/GLFW/glfw3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 993222ffe..2c0a3c272 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -4600,7 +4600,7 @@ GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count); * Each element in the array is one of the following values: * * Name | Value - * ---- | ----- + * ---- | ----- * `GLFW_HAT_CENTERED` | 0 * `GLFW_HAT_UP` | 1 * `GLFW_HAT_RIGHT` | 2 From df7f36a316dee7fa043f53947f478490129b7dbb Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 30 Oct 2018 13:23:39 +0100 Subject: [PATCH 35/59] Simplify check for CMake policy CMP0054 Related to #1367. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fcd6da117..3f40852e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ project(GLFW C) set(CMAKE_LEGACY_CYGWIN_WIN32 OFF) -if (NOT CMAKE_VERSION VERSION_LESS "3.1") +if (POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() From f9923e90958e726aaabc86d83fb3681216d76067 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 30 Oct 2018 13:30:44 +0100 Subject: [PATCH 36/59] Use GNUInstallDirs for install destinations This has the advantage that the user may override e.g. the include location, and the correct libdir (lib, lib64, lib/something) is automatically determined. Closes #1367. --- CMakeLists.txt | 9 +++++---- docs/compile.dox | 5 ----- src/CMakeLists.txt | 10 +++++----- src/glfw3.pc.in | 4 ++-- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f40852e8..414162969 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,6 @@ set(GLFW_VERSION_PATCH "0") set(GLFW_VERSION_EXTRA "") set(GLFW_VERSION "${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}") set(GLFW_VERSION_FULL "${GLFW_VERSION}.${GLFW_VERSION_PATCH}${GLFW_VERSION_EXTRA}") -set(LIB_SUFFIX "" CACHE STRING "Takes an empty string or 64. Directory where lib will be installed: lib or lib64") set_property(GLOBAL PROPERTY USE_FOLDERS ON) @@ -25,6 +24,8 @@ option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON) option(GLFW_INSTALL "Generate installation target" ON) option(GLFW_VULKAN_STATIC "Use the Vulkan loader statically linked into application" OFF) +include(GNUInstallDirs) + if (UNIX) option(GLFW_USE_OSMESA "Use OSMesa for offscreen context creation" OFF) endif() @@ -320,7 +321,7 @@ endforeach() #-------------------------------------------------------------------- include(CMakePackageConfigHelpers) -set(GLFW_CONFIG_PATH "lib${LIB_SUFFIX}/cmake/glfw3") +set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_LIBDIR}/cmake/glfw3") configure_package_config_file(src/glfw3Config.cmake.in src/glfw3Config.cmake @@ -357,7 +358,7 @@ endif() # The library is installed by src/CMakeLists.txt #-------------------------------------------------------------------- if (GLFW_INSTALL) - install(DIRECTORY include/GLFW DESTINATION include + install(DIRECTORY include/GLFW DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h) install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake" @@ -368,7 +369,7 @@ if (GLFW_INSTALL) EXPORT_LINK_INTERFACE_LIBRARIES DESTINATION "${GLFW_CONFIG_PATH}") install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc" - DESTINATION "lib${LIB_SUFFIX}/pkgconfig") + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") # Only generate this target if no higher-level project already has if (NOT TARGET uninstall) diff --git a/docs/compile.dox b/docs/compile.dox index d2133e948..e03b74aad 100644 --- a/docs/compile.dox +++ b/docs/compile.dox @@ -210,11 +210,6 @@ cmake -DBUILD_SHARED_LIBS=ON . __BUILD_SHARED_LIBS__ determines whether GLFW is built as a static library or as a DLL / shared library / dynamic library. -@anchor LIB_SUFFIX -__LIB_SUFFIX__ affects where the GLFW shared /dynamic library is installed. If -it is empty, it is installed to `${CMAKE_INSTALL_PREFIX}/lib`. If it is set to -`64`, it is installed to `${CMAKE_INSTALL_PREFIX}/lib64`. - @anchor GLFW_BUILD_EXAMPLES __GLFW_BUILD_EXAMPLES__ determines whether the GLFW examples are built along with the library. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ecce17069..6bf4ff0d7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -100,7 +100,7 @@ set_target_properties(glfw PROPERTIES target_compile_definitions(glfw PRIVATE _GLFW_USE_CONFIG_H) target_include_directories(glfw PUBLIC "$" - "$/include>") + "$") target_include_directories(glfw PRIVATE "${GLFW_SOURCE_DIR}/src" "${GLFW_BINARY_DIR}/src" @@ -121,7 +121,7 @@ target_compile_options(glfw PRIVATE if (BUILD_SHARED_LIBS) if (WIN32) if (MINGW) - # Remove the lib prefix on the DLL (but not the import library + # Remove the lib prefix on the DLL (but not the import library) set_target_properties(glfw PROPERTIES PREFIX "") # Add a suffix to the import library to avoid naming conflicts @@ -135,7 +135,7 @@ if (BUILD_SHARED_LIBS) target_compile_options(glfw PRIVATE "-fno-common") set_target_properties(glfw PROPERTIES - INSTALL_NAME_DIR "lib${LIB_SUFFIX}") + INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}") elseif (UNIX) # Hide symbols not explicitly tagged for export from the shared library target_compile_options(glfw PRIVATE "-fvisibility=hidden") @@ -155,7 +155,7 @@ if (GLFW_INSTALL) install(TARGETS glfw EXPORT glfwTargets RUNTIME DESTINATION "bin" - ARCHIVE DESTINATION "lib${LIB_SUFFIX}" - LIBRARY DESTINATION "lib${LIB_SUFFIX}") + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") endif() diff --git a/src/glfw3.pc.in b/src/glfw3.pc.in index 9feaa80e6..87423e1a6 100644 --- a/src/glfw3.pc.in +++ b/src/glfw3.pc.in @@ -1,7 +1,7 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -includedir=${prefix}/include -libdir=${exec_prefix}/lib@LIB_SUFFIX@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ Name: GLFW Description: A multi-platform library for OpenGL, window and input From 88c5edb40925bc0c987e8cfc7d306174f8094453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 24 Dec 2018 23:31:58 +0100 Subject: [PATCH 37/59] Cocoa: Remove subclassing of NSApplication This removes the GLFW NSApplication subclass as a step towards better coexistence with other libraries that touch Cocoa. This moves application object creation to platform init to allow event processing before window creation. Related to #1317. --- src/cocoa_init.m | 49 +++++++++++++++----- src/cocoa_platform.h | 4 +- src/cocoa_window.m | 105 +++++++++++-------------------------------- 3 files changed, 67 insertions(+), 91 deletions(-) diff --git a/src/cocoa_init.m b/src/cocoa_init.m index 01a746bae..f3c479578 100644 --- a/src/cocoa_init.m +++ b/src/cocoa_init.m @@ -27,6 +27,10 @@ #include "internal.h" #include // For MAXPATHLEN +#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200 + #define NSEventMaskKeyUp NSKeyUpMask + #define NSEventModifierFlagCommand NSCommandKeyMask +#endif // Change to our application bundle's resources directory, if present // @@ -271,17 +275,21 @@ static GLFWbool initializeTIS(void) return updateUnicodeDataNS(); } -@interface GLFWLayoutListener : NSObject +@interface GLFWHelper : NSObject @end -@implementation GLFWLayoutListener +@implementation GLFWHelper - (void)selectedKeyboardInputSourceChanged:(NSObject* )object { updateUnicodeDataNS(); } -@end +- (void)doNothing:(id)object +{ +} + +@end // GLFWHelper ////////////////////////////////////////////////////////////////////////// @@ -291,13 +299,31 @@ static GLFWbool initializeTIS(void) int _glfwPlatformInit(void) { _glfw.ns.autoreleasePool = [[NSAutoreleasePool alloc] init]; + _glfw.ns.helper = [[GLFWHelper alloc] init]; + + [NSThread detachNewThreadSelector:@selector(doNothing:) + toTarget:_glfw.ns.helper + withObject:nil]; + + [NSApplication sharedApplication]; + + NSEvent* (^block)(NSEvent*) = ^ NSEvent* (NSEvent* event) + { + if ([event modifierFlags] & NSEventModifierFlagCommand) + [[NSApp keyWindow] sendEvent:event]; + + return event; + }; + + _glfw.ns.keyUpMonitor = + [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskKeyUp + handler:block]; if (_glfw.hints.init.ns.chdir) changeToResourcesDirectory(); - _glfw.ns.listener = [[GLFWLayoutListener alloc] init]; [[NSNotificationCenter defaultCenter] - addObserver:_glfw.ns.listener + addObserver:_glfw.ns.helper selector:@selector(selectedKeyboardInputSourceChanged:) name:NSTextInputContextKeyboardSelectionDidChangeNotification object:nil]; @@ -342,18 +368,21 @@ void _glfwPlatformTerminate(void) _glfw.ns.delegate = nil; } - if (_glfw.ns.listener) + if (_glfw.ns.helper) { [[NSNotificationCenter defaultCenter] - removeObserver:_glfw.ns.listener + removeObserver:_glfw.ns.helper name:NSTextInputContextKeyboardSelectionDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] - removeObserver:_glfw.ns.listener]; - [_glfw.ns.listener release]; - _glfw.ns.listener = nil; + removeObserver:_glfw.ns.helper]; + [_glfw.ns.helper release]; + _glfw.ns.helper = nil; } + if (_glfw.ns.keyUpMonitor) + [NSEvent removeMonitor:_glfw.ns.keyUpMonitor]; + free(_glfw.ns.clipboardString); _glfwTerminateNSGL(); diff --git a/src/cocoa_platform.h b/src/cocoa_platform.h index 282f7cc8b..13adaa972 100644 --- a/src/cocoa_platform.h +++ b/src/cocoa_platform.h @@ -109,7 +109,9 @@ typedef struct _GLFWlibraryNS TISInputSourceRef inputSource; IOHIDManagerRef hidManager; id unicodeData; - id listener; + id helper; + id keyUpMonitor; + id nibObjects; char keyName[64]; short int keycodes[256]; diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 9c018eb8b..f450eda02 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -46,7 +46,6 @@ #define NSEventModifierFlagDeviceIndependentFlagsMask NSDeviceIndependentModifierFlagsMask #define NSEventMaskAny NSAnyEventMask #define NSEventTypeApplicationDefined NSApplicationDefined - #define NSEventTypeKeyUp NSKeyUp #define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat #endif @@ -856,52 +855,6 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; @end -//------------------------------------------------------------------------ -// GLFW application class -//------------------------------------------------------------------------ - -@interface GLFWApplication : NSApplication -{ - NSArray* nibObjects; -} - -@end - -@implementation GLFWApplication - -// From http://cocoadev.com/index.pl?GameKeyboardHandlingAlmost -// This works around an AppKit bug, where key up events while holding -// down the command key don't get sent to the key window. -- (void)sendEvent:(NSEvent *)event -{ - if ([event type] == NSEventTypeKeyUp && - ([event modifierFlags] & NSEventModifierFlagCommand)) - { - [[self keyWindow] sendEvent:event]; - } - else - [super sendEvent:event]; -} - - -// No-op thread entry point -// -- (void)doNothing:(id)object -{ -} - -- (void)loadMainMenu -{ -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 - [[NSBundle mainBundle] loadNibNamed:@"MainMenu" - owner:NSApp - topLevelObjects:&nibObjects]; -#else - [[NSBundle mainBundle] loadNibNamed:@"MainMenu" owner:NSApp]; -#endif -} -@end - // Set up the menu bar (manually) // This is nasty, nasty stuff -- calls to undocumented semi-private APIs that // could go away at any moment, lots of stuff that really should be @@ -1011,32 +964,9 @@ static void createMenuBar(void) // static GLFWbool initializeAppKit(void) { - if (NSApp) + if (_glfw.ns.delegate) return GLFW_TRUE; - // Implicitly create shared NSApplication instance - [GLFWApplication sharedApplication]; - - // Make Cocoa enter multi-threaded mode - [NSThread detachNewThreadSelector:@selector(doNothing:) - toTarget:NSApp - withObject:nil]; - - if (_glfw.hints.init.ns.menubar) - { - // In case we are unbundled, make us a proper UI application - [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; - - // Menu bar setup must go between sharedApplication above and - // finishLaunching below, in order to properly emulate the behavior - // of NSApplicationMain - - if ([[NSBundle mainBundle] pathForResource:@"MainMenu" ofType:@"nib"]) - [NSApp loadMainMenu]; - else - createMenuBar(); - } - // There can only be one application delegate, but we allocate it the // first time a window is created to keep all window code in this file _glfw.ns.delegate = [[GLFWApplicationDelegate alloc] init]; @@ -1048,6 +978,30 @@ static GLFWbool initializeAppKit(void) } [NSApp setDelegate:_glfw.ns.delegate]; + + if (_glfw.hints.init.ns.menubar) + { + // In case we are unbundled, make us a proper UI application + [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; + + // Menu bar setup must go between sharedApplication above and + // finishLaunching below, in order to properly emulate the behavior + // of NSApplicationMain + + if ([[NSBundle mainBundle] pathForResource:@"MainMenu" ofType:@"nib"]) + { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 + [[NSBundle mainBundle] loadNibNamed:@"MainMenu" + owner:NSApp + topLevelObjects:&_glfw.ns.nibObjects]; +#else + [[NSBundle mainBundle] loadNibNamed:@"MainMenu" owner:NSApp]; +#endif + } + else + createMenuBar(); + } + [NSApp run]; // Press and Hold prevents some keys from emitting repeated characters @@ -1554,9 +1508,6 @@ void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity) void _glfwPlatformPollEvents(void) { - if (!initializeAppKit()) - return; - for (;;) { NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny @@ -1707,9 +1658,6 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor, NSImage* native; NSBitmapImageRep* rep; - if (!initializeAppKit()) - return GLFW_FALSE; - rep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:image->width @@ -1745,9 +1693,6 @@ int _glfwPlatformCreateCursor(_GLFWcursor* cursor, int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape) { - if (!initializeAppKit()) - return GLFW_FALSE; - if (shape == GLFW_ARROW_CURSOR) cursor->ns.object = [NSCursor arrowCursor]; else if (shape == GLFW_IBEAM_CURSOR) From c3ed70a4b77a2a4a08ef9a7cac7ac64a1835118d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 24 Dec 2018 23:40:30 +0100 Subject: [PATCH 38/59] Cocoa: Add NSApplicationDelegate protocol --- src/cocoa_window.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index f450eda02..043a5f0da 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -363,7 +363,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; // Delegate for application related notifications //------------------------------------------------------------------------ -@interface GLFWApplicationDelegate : NSObject +@interface GLFWApplicationDelegate : NSObject @end @implementation GLFWApplicationDelegate From 17a15a20f28ed95e0e69d403687416c023c77e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 24 Dec 2018 23:41:29 +0100 Subject: [PATCH 39/59] Cocoa: Move to modern Objective-C literals --- src/cocoa_window.m | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 043a5f0da..0a0da8c01 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -657,7 +657,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; _glfwInputKey(window, key, [event keyCode], GLFW_PRESS, mods); - [self interpretKeyEvents:[NSArray arrayWithObject:event]]; + [self interpretKeyEvents:@[event]]; } - (void)flagsChanged:(NSEvent *)event @@ -1005,10 +1005,7 @@ static GLFWbool initializeAppKit(void) [NSApp run]; // Press and Hold prevents some keys from emitting repeated characters - NSDictionary* defaults = - [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], - @"ApplePressAndHoldEnabled", - nil]; + NSDictionary* defaults = @{@"ApplePressAndHoldEnabled":@NO}; [[NSUserDefaults standardUserDefaults] registerDefaults:defaults]; return GLFW_TRUE; @@ -1731,10 +1728,8 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) void _glfwPlatformSetClipboardString(const char* string) { - NSArray* types = [NSArray arrayWithObjects:NSPasteboardTypeString, nil]; - NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; - [pasteboard declareTypes:types owner:nil]; + [pasteboard declareTypes:@[NSPasteboardTypeString] owner:nil]; [pasteboard setString:[NSString stringWithUTF8String:string] forType:NSPasteboardTypeString]; } From cc621765e5e9a5ef258a05ccf070e8c1603a7b6f Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sat, 24 Nov 2018 09:38:07 -0500 Subject: [PATCH 40/59] Cocoa: Accept focusing mouse click as input This makes the behavior on macOS consistent with other platforms. Fixes #1209. Closes #1386. --- src/cocoa_window.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 0a0da8c01..217588f78 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -492,6 +492,11 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; updateCursorImage(window); } +- (BOOL)acceptsFirstMouse:(NSEvent *)event +{ + return YES; +} + - (void)mouseDown:(NSEvent *)event { _glfwInputMouseClick(window, From cf0857f79aed5688d764d33dda11d3cee031a182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 25 Dec 2018 20:52:58 +0100 Subject: [PATCH 41/59] Add credit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d2b25d061..ba34f9afe 100644 --- a/README.md +++ b/README.md @@ -314,6 +314,7 @@ skills. - John Bartholomew - Coşku Baş - Niklas Behrens + - Andrew Belt - Niklas Bergström - Denis Bernard - Doug Binks From c4903d92675a4c971d35190b749edb0ab14574f1 Mon Sep 17 00:00:00 2001 From: Keith Bauer Date: Sun, 4 Nov 2018 13:12:28 +1300 Subject: [PATCH 42/59] Cocoa: Fix half of all key events for Caps Lock This adds reporting of those Caps Lock key events that cause the lock state to change. The full fix involving IOHID is being worked on in #1368. Related to #1368. Closes #1373. --- README.md | 1 + src/cocoa_window.m | 2 ++ 2 files changed, 3 insertions(+) diff --git a/README.md b/README.md index ba34f9afe..26aa74191 100644 --- a/README.md +++ b/README.md @@ -283,6 +283,7 @@ information on what to include when reporting a bug. - [EGL] Added support for `EGL_KHR_get_all_proc_addresses` (#871) - [EGL] Added support for `EGL_KHR_context_flush_control` - [EGL] Bugfix: The test for `EGL_RGB_BUFFER` was invalid +- [Cocoa] Bugfix: caps lock was not generating key events ## Contact diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 217588f78..db9935ce8 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -235,6 +235,8 @@ static NSUInteger translateKeyToModifierFlag(int key) case GLFW_KEY_LEFT_SUPER: case GLFW_KEY_RIGHT_SUPER: return NSEventModifierFlagCommand; + case GLFW_KEY_CAPS_LOCK: + return NSEventModifierFlagCapsLock; } return 0; From 91c1ff1b7d8004d2d0e9f41e3d52e81eead7ab7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 25 Dec 2018 20:59:51 +0100 Subject: [PATCH 43/59] Cleanup --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 26aa74191..2f86760f9 100644 --- a/README.md +++ b/README.md @@ -275,6 +275,7 @@ information on what to include when reporting a bug. - [Cocoa] Bugfix: Event polling did not initialize AppKit if necessary (#1218) - [Cocoa] Bugfix: OpenGL rendering was not initially visible on 10.14 (#1334,#1346) +- [Cocoa] Bugfix: Caps Lock did not generate any key events (#1368,#1373) - [WGL] Added support for `WGL_EXT_colorspace` for OpenGL ES contexts - [WGL] Added support for `WGL_ARB_create_context_no_error` - [GLX] Added support for `GLX_ARB_create_context_no_error` @@ -283,7 +284,6 @@ information on what to include when reporting a bug. - [EGL] Added support for `EGL_KHR_get_all_proc_addresses` (#871) - [EGL] Added support for `EGL_KHR_context_flush_control` - [EGL] Bugfix: The test for `EGL_RGB_BUFFER` was invalid -- [Cocoa] Bugfix: caps lock was not generating key events ## Contact From 86e7bf4169e0b500909146b0a6ff2dff5ae458e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 25 Dec 2018 22:11:23 +0100 Subject: [PATCH 44/59] Documentation work --- include/GLFW/glfw3.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 2c0a3c272..a9897581b 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -4302,9 +4302,7 @@ GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun); * The character callback behaves as system text input normally does and will * not be called if modifier keys are held down that would prevent normal text * input on that platform, for example a Super (Command) key on macOS or Alt key - * on Windows. There is a - * [character with modifiers callback](@ref glfwSetCharModsCallback) that - * receives these events. + * on Windows. * * @param[in] window The window whose callback to set. * @param[in] cbfun The new callback, or `NULL` to remove the currently set From f4a304ff0320eacb6e830a1cff9435c6612c7130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 25 Dec 2018 22:13:00 +0100 Subject: [PATCH 45/59] Remove deprecated event from events test --- tests/events.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/events.c b/tests/events.c index 9a0144d79..5c89beb5a 100644 --- a/tests/events.c +++ b/tests/events.c @@ -429,15 +429,6 @@ static void char_callback(GLFWwindow* window, unsigned int codepoint) get_character_string(codepoint)); } -static void char_mods_callback(GLFWwindow* window, unsigned int codepoint, int mods) -{ - Slot* slot = glfwGetWindowUserPointer(window); - printf("%08x to %i at %0.3f: Character 0x%08x (%s) with modifiers (with%s) input\n", - counter++, slot->number, glfwGetTime(), codepoint, - get_character_string(codepoint), - get_mods_name(mods)); -} - static void drop_callback(GLFWwindow* window, int count, const char** paths) { int i; @@ -616,7 +607,6 @@ int main(int argc, char** argv) glfwSetScrollCallback(slots[i].window, scroll_callback); glfwSetKeyCallback(slots[i].window, key_callback); glfwSetCharCallback(slots[i].window, char_callback); - glfwSetCharModsCallback(slots[i].window, char_mods_callback); glfwSetDropCallback(slots[i].window, drop_callback); glfwMakeContextCurrent(slots[i].window); From a59315ed6adf3bec16e44a07801b2613786756f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 13 Dec 2018 20:29:50 +0100 Subject: [PATCH 46/59] Win32: Fix joystick element info memory leak The array was freed on failure but not on success. Fixes #1396. --- src/win32_joystick.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/win32_joystick.c b/src/win32_joystick.c index d9d341ff5..581239654 100644 --- a/src/win32_joystick.c +++ b/src/win32_joystick.c @@ -260,6 +260,8 @@ static void closeJoystick(_GLFWjoystick* js) IDirectInputDevice8_Release(js->win32.device); } + free(js->win32.objects); + _glfwFreeJoystick(js); _glfwInputJoystick(js, GLFW_DISCONNECTED); } From 3b255af4c3901338f460e075bda811290b31732d Mon Sep 17 00:00:00 2001 From: Sylvain Boilard Date: Thu, 13 Sep 2018 16:23:44 +0200 Subject: [PATCH 47/59] Documentation work The error section of the reference documentation for glfwWaitEventsTimeout was missing. Closes #1326. --- include/GLFW/glfw3.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index a9897581b..fb1841c83 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -3777,6 +3777,9 @@ GLFWAPI void glfwWaitEvents(void); * * @param[in] timeout The maximum amount of time, in seconds, to wait. * + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref + * GLFW_PLATFORM_ERROR and @ref GLFW_INVALID_VALUE. + * * @reentrancy This function must not be called from a callback. * * @thread_safety This function must only be called from the main thread. From 8e313d911becb802260d097d4eeefab734f7dcf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 13 Dec 2018 20:33:17 +0100 Subject: [PATCH 48/59] Cleanup GLFW_PLATFORM_ERROR should be listed last. --- include/GLFW/glfw3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index fb1841c83..db191c769 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -3778,7 +3778,7 @@ GLFWAPI void glfwWaitEvents(void); * @param[in] timeout The maximum amount of time, in seconds, to wait. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref - * GLFW_PLATFORM_ERROR and @ref GLFW_INVALID_VALUE. + * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. * * @reentrancy This function must not be called from a callback. * From 8c611fd5d06e19460b3632efb0ce09e1caeafe51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 18 Dec 2018 19:15:29 +0100 Subject: [PATCH 49/59] Win32: Fix build on older versions of Visual C++ Older versions did not provide fmin or fmax. This adds internal versions of fminf and fmaxf that should not be confused with standards compliant implementations. --- src/init.c | 24 ++++++++++++++++++++++++ src/input.c | 2 +- src/internal.h | 2 ++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/init.c b/src/init.c index 9e670d423..4f424c4a9 100644 --- a/src/init.c +++ b/src/init.c @@ -119,6 +119,30 @@ char* _glfw_strdup(const char* source) return result; } +float _glfw_fminf(float a, float b) +{ + if (a != a) + return b; + else if (b != b) + return a; + else if (a < b) + return a; + else + return b; +} + +float _glfw_fmaxf(float a, float b) +{ + if (a != a) + return b; + else if (b != b) + return a; + else if (a > b) + return a; + else + return b; +} + ////////////////////////////////////////////////////////////////////////// ////// GLFW event API ////// diff --git a/src/input.c b/src/input.c index b0bb3de47..460e9f31f 100644 --- a/src/input.c +++ b/src/input.c @@ -1242,7 +1242,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state) if (e->type == _GLFW_JOYSTICK_AXIS) { const float value = js->axes[e->index] * e->axisScale + e->axisOffset; - state->axes[i] = fminf(fmaxf(value, -1.f), 1.f); + state->axes[i] = _glfw_fminf(_glfw_fmaxf(value, -1.f), 1.f); } else if (e->type == _GLFW_JOYSTICK_HATBIT) { diff --git a/src/internal.h b/src/internal.h index 7be2b267c..30c7551a2 100644 --- a/src/internal.h +++ b/src/internal.h @@ -766,4 +766,6 @@ void _glfwTerminateVulkan(void); const char* _glfwGetVulkanResultString(VkResult result); char* _glfw_strdup(const char* source); +float _glfw_fminf(float a, float b); +float _glfw_fmaxf(float a, float b); From 751c6f9a2792bfc0c09cd381293db21c5a15a9ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 17 Dec 2018 17:04:29 +0100 Subject: [PATCH 50/59] Fix assertions for glfwSetGamma value The NaN assert was implicit in the other ones. The lower bound assert incorrectly allowed a value of zero. Related to #1387. --- src/monitor.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/monitor.c b/src/monitor.c index f7de5500f..0be3d2053 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -431,8 +431,7 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma) unsigned short values[256]; GLFWgammaramp ramp; assert(handle != NULL); - assert(gamma == gamma); - assert(gamma >= 0.f); + assert(gamma > 0.f); assert(gamma <= FLT_MAX); _GLFW_REQUIRE_INIT(); From 064dfaa5493e2f532ce523b63d43eb6e73fadeca Mon Sep 17 00:00:00 2001 From: Alexander Monakov Date: Sat, 24 Nov 2018 18:25:20 +0300 Subject: [PATCH 51/59] Wayland: Remove gamma-related TODOs Commit 9c513346ada1f52d559c4eb4c1ec9d80c05696af ("Gamma will never be supported on Wayland") made it clear that it cannot be implemented, so this removes the TODO markers and rewords the error messages. Related to #1387. --- src/wl_monitor.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/wl_monitor.c b/src/wl_monitor.c index 7d8e23eb9..f033fb6ec 100644 --- a/src/wl_monitor.c +++ b/src/wl_monitor.c @@ -182,17 +182,15 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) { - // TODO _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Gamma ramp getting not supported yet"); + "Wayland: Gamma ramp access it not available"); } void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) { - // TODO _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Gamma ramp setting not supported yet"); + "Wayland: Gamma ramp access is not available"); } From a533c9b3ca494dea845bb6c8e5b480ff745a1777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 26 Dec 2018 14:59:31 +0100 Subject: [PATCH 52/59] Add credit Related to #1387. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2f86760f9..9941f749a 100644 --- a/README.md +++ b/README.md @@ -398,6 +398,7 @@ skills. - Bruce Mitchener - Jack Moffitt - Jeff Molofee + - Alexander Monakov - Pierre Morel - Jon Morton - Pierre Moulon From 3201eedc34a8e707367e09c397bdbd7ca6c3be8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 26 Dec 2018 14:59:51 +0100 Subject: [PATCH 53/59] Cleanup We have a usable fminf now. --- src/monitor.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/monitor.c b/src/monitor.c index 0be3d2053..c161ea110 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -450,10 +450,8 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma) value = i / 255.f; // Apply gamma curve value = powf(value, 1.f / gamma) * 65535.f + 0.5f; - // Clamp to value range - if (value > 65535.f) - value = 65535.f; + value = _glfw_fminf(value, 65535.f); values[i] = (unsigned short) value; } From 52c7a4fc7f243095fb116d6ac721a7590000e972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 19 Dec 2018 14:53:01 +0100 Subject: [PATCH 54/59] Fix glfwGetGammaRamp error handling This makes glfwGetGammaRamp return NULL on platform error as specified. Related to #1387. --- src/cocoa_monitor.m | 3 ++- src/internal.h | 2 +- src/monitor.c | 8 ++++++-- src/null_monitor.c | 3 ++- src/win32_monitor.c | 4 +++- src/wl_monitor.c | 3 ++- src/x11_monitor.c | 15 ++++++++++++++- 7 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/cocoa_monitor.m b/src/cocoa_monitor.m index 986d799e7..39fff6f7f 100644 --- a/src/cocoa_monitor.m +++ b/src/cocoa_monitor.m @@ -467,7 +467,7 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode *mode) CVDisplayLinkRelease(link); } -void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) +GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) { uint32_t i, size = CGDisplayGammaTableCapacity(monitor->ns.displayID); CGGammaValue* values = calloc(size * 3, sizeof(CGGammaValue)); @@ -489,6 +489,7 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) } free(values); + return GLFW_TRUE; } void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) diff --git a/src/internal.h b/src/internal.h index 30c7551a2..c7c5bf8fd 100644 --- a/src/internal.h +++ b/src/internal.h @@ -611,7 +611,7 @@ void _glfwPlatformGetMonitorContentScale(_GLFWmonitor* monitor, float* xscale, float* yscale); GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* count); void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode); -void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp); +GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp); void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp); void _glfwPlatformSetClipboardString(const char* string); diff --git a/src/monitor.c b/src/monitor.c index c161ea110..dea45d6e0 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -472,7 +472,8 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle) _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _glfwFreeGammaArrays(&monitor->currentRamp); - _glfwPlatformGetGammaRamp(monitor, &monitor->currentRamp); + if (!_glfwPlatformGetGammaRamp(monitor, &monitor->currentRamp)) + return NULL; return &monitor->currentRamp; } @@ -498,7 +499,10 @@ GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp) _GLFW_REQUIRE_INIT(); if (!monitor->originalRamp.size) - _glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp); + { + if (!_glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp)) + return; + } _glfwPlatformSetGammaRamp(monitor, ramp); } diff --git a/src/null_monitor.c b/src/null_monitor.c index 84b41c7e3..45c4a10f8 100644 --- a/src/null_monitor.c +++ b/src/null_monitor.c @@ -58,8 +58,9 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) { } -void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) +GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) { + return GLFW_FALSE; } void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) diff --git a/src/win32_monitor.c b/src/win32_monitor.c index b7a24e615..07b3614bb 100644 --- a/src/win32_monitor.c +++ b/src/win32_monitor.c @@ -455,7 +455,7 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) &mode->blueBits); } -void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) +GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) { HDC dc; WORD values[768]; @@ -469,6 +469,8 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) memcpy(ramp->red, values + 0, 256 * sizeof(unsigned short)); memcpy(ramp->green, values + 256, 256 * sizeof(unsigned short)); memcpy(ramp->blue, values + 512, 256 * sizeof(unsigned short)); + + return GLFW_TRUE; } void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) diff --git a/src/wl_monitor.c b/src/wl_monitor.c index f033fb6ec..588f8b0de 100644 --- a/src/wl_monitor.c +++ b/src/wl_monitor.c @@ -180,10 +180,11 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) *mode = monitor->modes[monitor->wl.currentMode]; } -void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) +GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Gamma ramp access it not available"); + return GLFW_FALSE; } void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, diff --git a/src/x11_monitor.c b/src/x11_monitor.c index f557fe472..df53041df 100644 --- a/src/x11_monitor.c +++ b/src/x11_monitor.c @@ -422,7 +422,7 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode) } } -void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) +GLFWbool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) { if (_glfw.x11.randr.available && !_glfw.x11.randr.gammaBroken) { @@ -438,6 +438,7 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) memcpy(ramp->blue, gamma->blue, size * sizeof(unsigned short)); XRRFreeGamma(gamma); + return GLFW_TRUE; } else if (_glfw.x11.vidmode.available) { @@ -449,6 +450,13 @@ void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp) XF86VidModeGetGammaRamp(_glfw.x11.display, _glfw.x11.screen, ramp->size, ramp->red, ramp->green, ramp->blue); + return GLFW_TRUE; + } + else + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "X11: Gamma ramp access not supported by server"); + return GLFW_FALSE; } } @@ -481,6 +489,11 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp) (unsigned short*) ramp->green, (unsigned short*) ramp->blue); } + else + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "X11: Gamma ramp access not supported by server"); + } } From 3531c320afd6816cabae31ff30b9fb0890952c45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 17 Dec 2018 17:40:18 +0100 Subject: [PATCH 55/59] Fix glfwSetGamma generating ramps of invalid sizes This makes glfwSetGamma generate a gamma ramp of the same size as the monitor's current ramp, which will avoid failure on non-256 entry monitors on X11 and avoid ramp interpolation on macOS. Closes #1387. Fixes #1388. --- README.md | 2 ++ include/GLFW/glfw3.h | 10 +++++----- src/monitor.c | 18 +++++++++++++----- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9941f749a..d2fbceaaa 100644 --- a/README.md +++ b/README.md @@ -197,6 +197,8 @@ information on what to include when reporting a bug. - Bugfix: Invalid library paths were used in test and example CMake files (#930) - Bugfix: The scancode for synthetic key release events was always zero - Bugfix: The generated Doxyfile did not handle paths with spaces (#1081) +- Bugfix: The gamma ramp generated by `glfwSetGamma` did not use the monitor + ramp size (#1387,#1388) - [Win32] Added system error strings to relevant GLFW error descriptions (#733) - [Win32] Moved to `WM_INPUT` for disabled cursor mode motion input (#125) - [Win32] Removed XInput circular deadzone from joystick axis data (#1045) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index db191c769..099cd8e67 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -2156,9 +2156,9 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor); /*! @brief Generates a gamma ramp and sets it for the specified monitor. * - * This function generates a 256-element gamma ramp from the specified exponent - * and then calls @ref glfwSetGammaRamp with it. The value must be a finite - * number greater than zero. + * This function generates an appropriately sized gamma ramp from the specified + * exponent and then calls @ref glfwSetGammaRamp with it. The value must be + * a finite number greater than zero. * * The software controlled gamma ramp is applied _in addition_ to the hardware * gamma correction, which today is usually an approximation of sRGB gamma. @@ -2237,8 +2237,8 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor); * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * GLFW_PLATFORM_ERROR. * - * @remark Gamma ramp sizes other than 256 are not supported by all platforms - * or graphics hardware. + * @remark The size of the specified gamma ramp should match the size of the + * current ramp for that monitor. * * @remark @win32 The gamma ramp size must be 256. * diff --git a/src/monitor.c b/src/monitor.c index dea45d6e0..0ab865e3b 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -427,9 +427,10 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* handle) GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma) { - int i; - unsigned short values[256]; + unsigned int i; + unsigned short* values; GLFWgammaramp ramp; + const GLFWgammaramp* original; assert(handle != NULL); assert(gamma > 0.f); assert(gamma <= FLT_MAX); @@ -442,12 +443,18 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma) return; } - for (i = 0; i < 256; i++) + original = glfwGetGammaRamp(handle); + if (!original) + return; + + values = calloc(original->size, sizeof(unsigned short)); + + for (i = 0; i < original->size; i++) { float value; // Calculate intensity - value = i / 255.f; + value = i / (float) (original->size - 1); // Apply gamma curve value = powf(value, 1.f / gamma) * 65535.f + 0.5f; // Clamp to value range @@ -459,9 +466,10 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma) ramp.red = values; ramp.green = values; ramp.blue = values; - ramp.size = 256; + ramp.size = original->size; glfwSetGammaRamp(handle, &ramp); + free(values); } GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle) From e29882523ee9e0561154ff13b4e67fe8d1ec1e68 Mon Sep 17 00:00:00 2001 From: Vallentin Date: Fri, 14 Dec 2018 19:26:42 +0100 Subject: [PATCH 56/59] Fix typos Closes #1402. --- examples/boing.c | 4 ++-- src/osmesa_context.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/boing.c b/examples/boing.c index 45c867fd1..5b8e667e8 100644 --- a/examples/boing.c +++ b/examples/boing.c @@ -302,7 +302,7 @@ void cursor_position_callback( GLFWwindow* window, double x, double y ) * The Boing ball is sphere in which each facet is a rectangle. * Facet colors alternate between red and white. * The ball is built by stacking latitudinal circles. Each circle is composed - * of a widely-separated set of points, so that each facet is noticably large. + * of a widely-separated set of points, so that each facet is noticeably large. *****************************************************************************/ void DrawBoingBall( void ) { @@ -446,7 +446,7 @@ void DrawBoingBallBand( GLfloat long_lo, static int colorToggle = 0; /* - * Iterate thru the points of a latitude circle. + * Iterate through the points of a latitude circle. * A latitude circle is a 2D set of X,Z points. */ for ( lat_deg = 0; diff --git a/src/osmesa_context.c b/src/osmesa_context.c index a7de33f26..03651ebf4 100644 --- a/src/osmesa_context.c +++ b/src/osmesa_context.c @@ -240,7 +240,7 @@ GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window, if (ctxconfig->forward) { _glfwInputError(GLFW_VERSION_UNAVAILABLE, - "OSMesa: Foward-compatible contexts not supported"); + "OSMesa: Forward-compatible contexts not supported"); return GLFW_FALSE; } From 9ac9d7b85a224bb932f4a74912ddf5625a4eb110 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Sun, 18 Nov 2018 23:32:11 -0500 Subject: [PATCH 57/59] Win32: Disable non-client painting if undecorated Fixes an issue where a small title bar and window caption buttons were being painted after restoring a minimized undecorated window. Closes #1383. --- src/win32_window.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/win32_window.c b/src/win32_window.c index 796ae150e..daef15363 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1161,6 +1161,19 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, DragFinish(drop); return 0; } + + case WM_NCACTIVATE: + case WM_NCPAINT: + { + // HACK: Prevent title bar artifacts from appearing after restoring + // a minimized borderless window + if (!window->decorated) + { + return TRUE; + } + + break; + } } return DefWindowProcW(hWnd, uMsg, wParam, lParam); From 1635fe28265019f1a16ee01e4efaf655599a7f87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 26 Dec 2018 15:18:36 +0100 Subject: [PATCH 58/59] Cleanup Put the non-client painting related message cases with the client ones so that they can be happy together. Related to #1383. --- README.md | 2 ++ src/win32_window.c | 24 +++++++++++------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index d2fbceaaa..51911f989 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,8 @@ information on what to include when reporting a bug. hint set to false (#1179,#1180) - [Win32] Bugfix: The keypad equals key was reported as `GLFW_KEY_UNKNOWN` (#1315,#1316) +- [Win32] Bugfix: A title bar would be drawn over undecorated windows in some + circumstances (#1383) - [X11] Moved to XI2 `XI_RawMotion` for disable cursor mode motion input (#125) - [X11] Replaced `_GLFW_HAS_XF86VM` compile-time option with dynamic loading - [X11] Bugfix: `glfwGetVideoMode` would segfault on Cygwin/X diff --git a/src/win32_window.c b/src/win32_window.c index daef15363..a0abca060 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1060,6 +1060,17 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, return TRUE; } + case WM_NCACTIVATE: + case WM_NCPAINT: + { + // Prevent title bar from being drawn after restoring a minimized + // undecorated window + if (!window->decorated) + return TRUE; + + break; + } + case WM_DWMCOMPOSITIONCHANGED: { if (window->win32.transparent) @@ -1161,19 +1172,6 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, DragFinish(drop); return 0; } - - case WM_NCACTIVATE: - case WM_NCPAINT: - { - // HACK: Prevent title bar artifacts from appearing after restoring - // a minimized borderless window - if (!window->decorated) - { - return TRUE; - } - - break; - } } return DefWindowProcW(hWnd, uMsg, wParam, lParam); From c90c7b97109db909577e3bf540b5f884422b7e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 26 Dec 2018 15:19:02 +0100 Subject: [PATCH 59/59] Add credit Related to #1383. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 51911f989..6366a4f37 100644 --- a/README.md +++ b/README.md @@ -386,6 +386,7 @@ skills. - Glenn Lewis - Shane Liesegang - Eyal Lotem + - Aaron Loucks - Tristam MacDonald - Hans Mackowiak - Дмитри Малышев