mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-12-06 20:53:40 +01:00
GLX11Window::Create called XSelectInput(display, parent_window, StructureNotifyMask) on the host's display connection, which replaces the event mask that the host (DolphinQt or DolphinNoGUI) selected for the window instead of adding to it. As a result, Qt stopped receiving FocusIn/FocusOut, key and mouse events for the render window once an OpenGL context had been created on it. The same issue made DolphinNoGUI lose its key and focus events with OpenGL. The GL code doesn't process any events itself, and the hosts already select StructureNotify, so just drop the call. Also stop discarding pending events in XSync, as the event queue belongs to the host. Fixes https://bugs.dolphin-emu.org/issues/13354
51 lines
1.8 KiB
C++
51 lines
1.8 KiB
C++
// Copyright 2012 Dolphin Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include "Common/GL/GLX11Window.h"
|
|
|
|
GLX11Window::GLX11Window(Display* display, Window parent_window, Colormap color_map, Window window,
|
|
int width, int height)
|
|
: m_display(display), m_parent_window(parent_window), m_color_map(color_map), m_window(window),
|
|
m_width(width), m_height(height)
|
|
{
|
|
}
|
|
|
|
GLX11Window::~GLX11Window()
|
|
{
|
|
XUnmapWindow(m_display, m_window);
|
|
XDestroyWindow(m_display, m_window);
|
|
XFreeColormap(m_display, m_color_map);
|
|
}
|
|
|
|
void GLX11Window::UpdateDimensions()
|
|
{
|
|
XWindowAttributes attribs;
|
|
XGetWindowAttributes(m_display, m_parent_window, &attribs);
|
|
XResizeWindow(m_display, m_window, attribs.width, attribs.height);
|
|
m_width = attribs.width;
|
|
m_height = attribs.height;
|
|
}
|
|
|
|
std::unique_ptr<GLX11Window> GLX11Window::Create(Display* display, Window parent_window,
|
|
XVisualInfo* vi)
|
|
{
|
|
// Set color map for the new window based on the visual.
|
|
Colormap color_map = XCreateColormap(display, parent_window, vi->visual, AllocNone);
|
|
XSetWindowAttributes attribs = {};
|
|
attribs.colormap = color_map;
|
|
|
|
// Get the dimensions from the parent window.
|
|
XWindowAttributes parent_attribs = {};
|
|
XGetWindowAttributes(display, parent_window, &parent_attribs);
|
|
|
|
// Create the window
|
|
Window window =
|
|
XCreateWindow(display, parent_window, 0, 0, parent_attribs.width, parent_attribs.height, 0,
|
|
vi->depth, InputOutput, vi->visual, CWColormap, &attribs);
|
|
XMapWindow(display, window);
|
|
XSync(display, False);
|
|
|
|
return std::make_unique<GLX11Window>(display, parent_window, color_map, window,
|
|
parent_attribs.width, parent_attribs.height);
|
|
}
|