mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 14:04:36 +00:00
Merge branch 'multi-context-windows-merge-master' into multi-context-windows
This commit is contained in:
commit
c01d16a9ee
@ -24,6 +24,7 @@ video tutorials.
|
||||
- Waris Boonyasiriwat
|
||||
- Kyle Brenneman
|
||||
- Rok Breulj
|
||||
- TheBrokenRail
|
||||
- Kai Burjack
|
||||
- Martin Capitanio
|
||||
- Nicolas Caramelli
|
||||
@ -145,6 +146,7 @@ video tutorials.
|
||||
- Pierre Moulon
|
||||
- Martins Mozeiko
|
||||
- Pascal Muetschard
|
||||
- James Murphy
|
||||
- Julian Møller
|
||||
- ndogxj
|
||||
- n3rdopolis
|
||||
@ -160,6 +162,7 @@ video tutorials.
|
||||
- Christopher Pelloux
|
||||
- Arturo J. Pérez
|
||||
- Vladimir Perminov
|
||||
- Olivier Perret
|
||||
- Anthony Pesch
|
||||
- Orson Peters
|
||||
- Emmanuel Gil Peyrot
|
||||
@ -173,6 +176,7 @@ video tutorials.
|
||||
- Pablo Prietz
|
||||
- przemekmirek
|
||||
- pthom
|
||||
- Martin Pulec
|
||||
- Guillaume Racicot
|
||||
- Philip Rideout
|
||||
- Eddie Ringle
|
||||
|
32
README.md
32
README.md
@ -302,6 +302,7 @@ information on what to include when reporting a bug.
|
||||
- [Wayland] Added dynamic loading of all Wayland libraries
|
||||
- [Wayland] Added support for key names via xkbcommon
|
||||
- [Wayland] Added support for file path drop events (#2040)
|
||||
- [Wayland] Added support for more human-readable monitor names where available
|
||||
- [Wayland] Removed support for `wl_shell` (#1443)
|
||||
- [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432)
|
||||
- [Wayland] Bugfix: `CLOCK_MONOTONIC` was not correctly enabled
|
||||
@ -335,6 +336,37 @@ information on what to include when reporting a bug.
|
||||
- [Wayland] Bugfix: The OSMesa library was not unloaded on termination
|
||||
- [Wayland] Bugfix: `glfwCreateWindow` could emit `GLFW_FEATURE_UNAVAILABLE`
|
||||
- [Wayland] Bugfix: Lock key modifier bits were only set when lock keys were pressed
|
||||
- [Wayland] Bugfix: A window leaving full screen mode would be iconified (#1995)
|
||||
- [Wayland] Bugfix: A window leaving full screen mode ignored its desired size
|
||||
- [Wayland] Bugfix: `glfwSetWindowMonitor` did not update windowed mode size
|
||||
- [Wayland] Bugfix: `glfwRestoreWindow` would make a full screen window windowed
|
||||
- [Wayland] Bugfix: A window maximized or restored by the user would enter an
|
||||
inconsistent state
|
||||
- [Wayland] Bugfix: Window maximization events were not emitted
|
||||
- [Wayland] Bugfix: `glfwRestoreWindow` assumed it was always in windowed mode
|
||||
- [Wayland] Bugfix: `glfwSetWindowSize` would resize a full screen window
|
||||
- [Wayland] Bugfix: A window content scale event would be emitted every time
|
||||
the window resized
|
||||
- [Wayland] Bugfix: If `glfwInit` failed it would close stdin
|
||||
- [Wayland] Bugfix: Manual resizing with fallback decorations behaved erratically
|
||||
(#1991,#2115,#2127)
|
||||
- [Wayland] Bugfix: Size limits included frame size for fallback decorations
|
||||
- [Wayland] Bugfix: Updating `GLFW_DECORATED` had no effect on server-side
|
||||
decorations
|
||||
- [Wayland] Bugfix: A monitor would be reported as connected again if its scale
|
||||
changed
|
||||
- [Wayland] Bugfix: `glfwTerminate` would segfault if any monitor had changed
|
||||
scale
|
||||
- [Wayland] Bugfix: Window content scale events were not emitted when monitor
|
||||
scale changed
|
||||
- [Wayland] Bugfix: `glfwSetWindowAspectRatio` reported an error instead of
|
||||
applying the specified ratio
|
||||
- [Wayland] Bugfix: `GLFW_MAXIMIZED` window hint had no effect
|
||||
- [Wayland] Bugfix: `glfwRestoreWindow` had no effect before first show
|
||||
- [Wayland] Bugfix: Hiding and then showing a window caused program abort on
|
||||
wlroots compositors (#1268)
|
||||
- [Wayland] Bugfix: `GLFW_DECORATED` was ignored when showing a window with XDG
|
||||
decorations
|
||||
- [POSIX] Removed use of deprecated function `gettimeofday`
|
||||
- [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled
|
||||
- [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072)
|
||||
|
@ -184,11 +184,9 @@ static void registryHandleGlobalRemove(void* userData,
|
||||
struct wl_registry* registry,
|
||||
uint32_t name)
|
||||
{
|
||||
_GLFWmonitor* monitor;
|
||||
|
||||
for (int i = 0; i < _glfw.monitorCount; ++i)
|
||||
{
|
||||
monitor = _glfw.monitors[i];
|
||||
_GLFWmonitor* monitor = _glfw.monitors[i];
|
||||
if (monitor->wl.name == name)
|
||||
{
|
||||
_glfwInputMonitor(monitor, GLFW_DISCONNECTED, 0);
|
||||
@ -480,6 +478,10 @@ int _glfwInitWayland(void)
|
||||
long cursorSizeLong;
|
||||
int cursorSize;
|
||||
|
||||
// These must be set before any failure checks
|
||||
_glfw.wl.timerfd = -1;
|
||||
_glfw.wl.cursorTimerfd = -1;
|
||||
|
||||
_glfw.wl.client.display_flush = (PFN_wl_display_flush)
|
||||
_glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_flush");
|
||||
_glfw.wl.client.display_cancel_read = (PFN_wl_display_cancel_read)
|
||||
@ -636,9 +638,10 @@ int _glfwInitWayland(void)
|
||||
// Sync so we got all initial output events
|
||||
wl_display_roundtrip(_glfw.wl.display);
|
||||
|
||||
_glfw.wl.timerfd = -1;
|
||||
if (_glfw.wl.seatVersion >= 4)
|
||||
#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION
|
||||
if (_glfw.wl.seatVersion >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION)
|
||||
_glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
|
||||
#endif
|
||||
|
||||
if (!_glfw.wl.wmBase)
|
||||
{
|
||||
|
@ -55,7 +55,8 @@ static void outputHandleGeometry(void* userData,
|
||||
monitor->widthMM = physicalWidth;
|
||||
monitor->heightMM = physicalHeight;
|
||||
|
||||
snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model);
|
||||
if (strlen(monitor->name) == 0)
|
||||
snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model);
|
||||
}
|
||||
|
||||
static void outputHandleMode(void* userData,
|
||||
@ -96,6 +97,12 @@ static void outputHandleDone(void* userData, struct wl_output* output)
|
||||
monitor->heightMM = (int) (mode->height * 25.4f / 96.f);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _glfw.monitorCount; i++)
|
||||
{
|
||||
if (_glfw.monitors[i] == monitor)
|
||||
return;
|
||||
}
|
||||
|
||||
_glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
|
||||
}
|
||||
|
||||
@ -106,14 +113,47 @@ static void outputHandleScale(void* userData,
|
||||
struct _GLFWmonitor* monitor = userData;
|
||||
|
||||
monitor->wl.scale = factor;
|
||||
|
||||
for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next)
|
||||
{
|
||||
for (int i = 0; i < window->wl.monitorsCount; i++)
|
||||
{
|
||||
if (window->wl.monitors[i] == monitor)
|
||||
{
|
||||
_glfwUpdateContentScaleWayland(window);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
|
||||
|
||||
void outputHandleName(void* userData, struct wl_output* wl_output, const char* name)
|
||||
{
|
||||
struct _GLFWmonitor* monitor = userData;
|
||||
|
||||
strncpy(monitor->name, name, sizeof(monitor->name) - 1);
|
||||
}
|
||||
|
||||
void outputHandleDescription(void* userData,
|
||||
struct wl_output* wl_output,
|
||||
const char* description)
|
||||
{
|
||||
}
|
||||
|
||||
#endif // WL_OUTPUT_NAME_SINCE_VERSION
|
||||
|
||||
static const struct wl_output_listener outputListener =
|
||||
{
|
||||
outputHandleGeometry,
|
||||
outputHandleMode,
|
||||
outputHandleDone,
|
||||
outputHandleScale,
|
||||
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
|
||||
outputHandleName,
|
||||
outputHandleDescription,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@ -123,9 +163,6 @@ static const struct wl_output_listener outputListener =
|
||||
|
||||
void _glfwAddOutputWayland(uint32_t name, uint32_t version)
|
||||
{
|
||||
_GLFWmonitor* monitor;
|
||||
struct wl_output* output;
|
||||
|
||||
if (version < 2)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
@ -133,19 +170,21 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
|
||||
return;
|
||||
}
|
||||
|
||||
// The actual name of this output will be set in the geometry handler.
|
||||
monitor = _glfwAllocMonitor("", 0, 0);
|
||||
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
|
||||
version = _glfw_min(version, WL_OUTPUT_NAME_SINCE_VERSION);
|
||||
#else
|
||||
version = 2;
|
||||
#endif
|
||||
|
||||
output = wl_registry_bind(_glfw.wl.registry,
|
||||
name,
|
||||
&wl_output_interface,
|
||||
2);
|
||||
struct wl_output* output = wl_registry_bind(_glfw.wl.registry,
|
||||
name,
|
||||
&wl_output_interface,
|
||||
version);
|
||||
if (!output)
|
||||
{
|
||||
_glfwFreeMonitor(monitor);
|
||||
return;
|
||||
}
|
||||
|
||||
// The actual name of this output will be set in the geometry handler
|
||||
_GLFWmonitor* monitor = _glfwAllocMonitor("", 0, 0);
|
||||
monitor->wl.scale = 1;
|
||||
monitor->wl.output = output;
|
||||
monitor->wl.name = name;
|
||||
|
@ -198,11 +198,6 @@ typedef xkb_keysym_t (* PFN_xkb_compose_state_get_one_sym)(struct xkb_compose_st
|
||||
#define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status
|
||||
#define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym
|
||||
|
||||
#define _GLFW_DECORATION_WIDTH 4
|
||||
#define _GLFW_DECORATION_TOP 24
|
||||
#define _GLFW_DECORATION_VERTICAL (_GLFW_DECORATION_TOP + _GLFW_DECORATION_WIDTH)
|
||||
#define _GLFW_DECORATION_HORIZONTAL (2 * _GLFW_DECORATION_WIDTH)
|
||||
|
||||
typedef enum _GLFWdecorationSideWayland
|
||||
{
|
||||
mainWindow,
|
||||
@ -233,16 +228,30 @@ typedef struct _GLFWwindowWayland
|
||||
int width, height;
|
||||
GLFWbool visible;
|
||||
GLFWbool maximized;
|
||||
GLFWbool activated;
|
||||
GLFWbool fullscreen;
|
||||
GLFWbool hovered;
|
||||
GLFWbool transparent;
|
||||
struct wl_surface* surface;
|
||||
struct wl_egl_window* native;
|
||||
struct wl_callback* callback;
|
||||
|
||||
struct {
|
||||
struct wl_egl_window* window;
|
||||
} egl;
|
||||
|
||||
struct {
|
||||
int width, height;
|
||||
GLFWbool maximized;
|
||||
GLFWbool iconified;
|
||||
GLFWbool activated;
|
||||
GLFWbool fullscreen;
|
||||
} pending;
|
||||
|
||||
struct {
|
||||
struct xdg_surface* surface;
|
||||
struct xdg_toplevel* toplevel;
|
||||
struct zxdg_toplevel_decoration_v1* decoration;
|
||||
uint32_t decorationMode;
|
||||
} xdg;
|
||||
|
||||
_GLFWcursor* currentCursor;
|
||||
@ -264,13 +273,10 @@ typedef struct _GLFWwindowWayland
|
||||
|
||||
struct zwp_idle_inhibitor_v1* idleInhibitor;
|
||||
|
||||
GLFWbool wasFullscreen;
|
||||
|
||||
struct {
|
||||
GLFWbool serverSide;
|
||||
struct wl_buffer* buffer;
|
||||
_GLFWdecorationWayland top, left, right, bottom;
|
||||
int focus;
|
||||
_GLFWdecorationSideWayland focus;
|
||||
} decorations;
|
||||
} _GLFWwindowWayland;
|
||||
|
||||
@ -508,6 +514,7 @@ GLFWbool _glfwGetGammaRampWayland(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
|
||||
void _glfwSetGammaRampWayland(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
|
||||
|
||||
void _glfwAddOutputWayland(uint32_t name, uint32_t version);
|
||||
void _glfwUpdateContentScaleWayland(_GLFWwindow* window);
|
||||
GLFWbool _glfwInputTextWayland(_GLFWwindow* window, uint32_t scancode);
|
||||
|
||||
_GLFWusercontext* _glfwCreateUserContextWayland(_GLFWwindow* window);
|
||||
|
679
src/wl_window.c
679
src/wl_window.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user