Wayland: Handle monitor removal

This commit is contained in:
Emmanuel Gil Peyrot 2018-02-24 22:18:39 +01:00
parent f67b610dd4
commit d6b9d00ceb
3 changed files with 14 additions and 0 deletions

View File

@ -585,6 +585,18 @@ static void registryHandleGlobalRemove(void *data,
struct wl_registry *registry, struct wl_registry *registry,
uint32_t name) uint32_t name)
{ {
int i;
_GLFWmonitor* monitor;
for (i = 0; i < _glfw.monitorCount; ++i)
{
monitor = _glfw.monitors[i];
if (monitor->wl.name == name)
{
_glfwInputMonitor(monitor, GLFW_DISCONNECTED, 0);
return;
}
}
} }

View File

@ -136,6 +136,7 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
monitor->wl.scale = 1; monitor->wl.scale = 1;
monitor->wl.output = output; monitor->wl.output = output;
monitor->wl.name = name;
wl_output_add_listener(output, &outputListener, monitor); wl_output_add_listener(output, &outputListener, monitor);
} }

View File

@ -284,6 +284,7 @@ typedef struct _GLFWlibraryWayland
typedef struct _GLFWmonitorWayland typedef struct _GLFWmonitorWayland
{ {
struct wl_output* output; struct wl_output* output;
int name;
int currentMode; int currentMode;
int x; int x;