dolphin/Source/Core/Common/GL/GLX11Window.cpp
Martino Fontana a14c88ba67 Remove unused imports
Yellow squiggly lines begone!
Done automatically on .cpp files through `run-clang-tidy`, with manual corrections to the mistakes.
If an import is directly used, but is technically unnecessary since it's recursively imported by something else, it is *not* removed.
The tool doesn't touch .h files, so I did some of them by hand while fixing errors due to old recursive imports.
Not everything is removed, but the cleanup should be substantial enough.
Because this done on Linux, code that isn't used on it is mostly untouched.
(Hopefully no open PR is depending on these imports...)
2026-01-25 16:12:15 +01:00

52 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);
XSelectInput(display, parent_window, StructureNotifyMask);
XMapWindow(display, window);
XSync(display, True);
return std::make_unique<GLX11Window>(display, parent_window, color_map, window,
parent_attribs.width, parent_attribs.height);
}