
Проблема в том, что окно, созданное с помощью кода, показанного на рисунке (и далее в этом сообщении), намеревается создать окно X11 с X11/Xlib.h вызов выглядит следующим образом:
BBToolkit::Window * window = new BBToolkit::Window("lol", {x: 100, y: 100}, {x: 100, y: 100}, {x: 100, y: 100}, {x: 100, y: 100}, {x: 100, y: 100});
Однако окно появляется только на панели задач, а не на самом экране, предварительный просмотр окна, как вы можете видеть на изображении, просто показывает пустое окно Windows по умолчанию.
Как я могу заставить его просто показывать окно?
#include
#include
#include
#include
Window window;
BBToolkit::Window::Window(
std::string title,
BBToolkit::XYIntContainer size,
BBToolkit::XYIntContainer minSize,
BBToolkit::XYIntContainer maxSize,
BBToolkit::XYFloatContainer minAsp,
BBToolkit::XYFloatContainer maxAsp
) {
Display * display = XOpenDisplay(0); // Display = collection of Screens ( one for every IRL display )
if (!display) exit(1);
int root = DefaultRootWindow(display); // Behind the scenes the Display is just a collection of biiig Windows, one for every IRL screen, thats called the root window.
int defaultScreen = DefaultScreen(display); // The Screen represents your IRL display.
int screenBitDepth = 24; // The amount of bits for RGB ( 24bd = FF/255 is max )
XVisualInfo visInfo = {}; // Contains some visual settings for the window.
if (!XMatchVisualInfo(display, defaultScreen, screenBitDepth, TrueColor, &visInfo)) exit(2);
XSetWindowAttributes windowAttr; // Contains some general settings for the window.
windowAttr.background_pixel = WhitePixel(display, defaultScreen);
windowAttr.colormap = XCreateColormap(display, root, visInfo.visual, AllocNone);
unsigned long attribMask = CWBackPixel | CWColormap; // Need to tell X which of those general settings it needs to use. Why is this needed? Dunno.
window = XCreateWindow(display, root, 0, 0, size.x, size.y, 0, visInfo.depth, InputOutput, visInfo.visual, attribMask, &windowAttr); // Create that window BABY!!!!!
if (!window) exit(3);
XStoreName(display, window, title.c_str());
XMapWindow(display, window);
XFlush(display);
while (true) {}
}
Подробнее здесь: https://stackoverflow.com/questions/798 ... -appearing
Мобильная версия