本文整理汇总了C++中Display::getVisualInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ Display::getVisualInfo方法的具体用法?C++ Display::getVisualInfo怎么用?C++ Display::getVisualInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Display
的用法示例。
在下文中一共展示了Display::getVisualInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DefaultRootWindow
Window::Window (Display& display, int width, int height, ::Visual* visual)
: m_display (display)
, m_colormap (None)
, m_window (None)
, m_visible (false)
{
XSetWindowAttributes swa;
::Display* const dpy = m_display.getXDisplay();
::Window root = DefaultRootWindow(dpy);
unsigned long mask = CWBorderPixel | CWEventMask;
// If redirect is enabled, window size can't be guaranteed and it is up to
// the window manager to decide whether to honor sizing requests. However,
// overriding that causes window to appear as an overlay, which causes
// other issues, so this is disabled by default.
const bool overrideRedirect = false;
if (overrideRedirect)
{
mask |= CWOverrideRedirect;
swa.override_redirect = true;
}
if (visual == DE_NULL)
visual = CopyFromParent;
else
{
XVisualInfo info = XVisualInfo();
bool succ = display.getVisualInfo(XVisualIDFromVisual(visual), info);
TCU_CHECK_INTERNAL(succ);
root = RootWindow(dpy, info.screen);
m_colormap = XCreateColormap(dpy, root, visual, AllocNone);
swa.colormap = m_colormap;
mask |= CWColormap;
}
swa.border_pixel = 0;
swa.event_mask = ExposureMask|KeyPressMask|KeyReleaseMask|StructureNotifyMask;
if (width == glu::RenderConfig::DONT_CARE)
width = DEFAULT_WINDOW_WIDTH;
if (height == glu::RenderConfig::DONT_CARE)
height = DEFAULT_WINDOW_HEIGHT;
m_window = XCreateWindow(dpy, root, 0, 0, width, height, 0,
CopyFromParent, InputOutput, visual, mask, &swa);
TCU_CHECK(m_window);
Atom deleteAtom = m_display.getDeleteAtom();
XSetWMProtocols(dpy, m_window, &deleteAtom, 1);
}
示例2: DefaultRootWindow
Window::Window (Display& display, int width, int height, ::Visual* visual)
: m_display (display)
, m_colormap (None)
, m_window (None)
, m_visible (false)
{
XSetWindowAttributes swa;
::Display* dpy = m_display.getXDisplay();
::Window root = DefaultRootWindow(dpy);
unsigned long mask = CWBorderPixel | CWEventMask;
if (visual == DE_NULL)
visual = CopyFromParent;
else
{
XVisualInfo info = XVisualInfo();
bool succ = display.getVisualInfo(XVisualIDFromVisual(visual), info);
TCU_CHECK_INTERNAL(succ);
root = RootWindow(dpy, info.screen);
m_colormap = XCreateColormap(dpy, root, visual, AllocNone);
swa.colormap = m_colormap;
mask |= CWColormap;
}
swa.border_pixel = 0;
swa.event_mask = ExposureMask|KeyPressMask|KeyReleaseMask|StructureNotifyMask;
mask |= CWOverrideRedirect;
swa.override_redirect = true;
if (width == glu::RenderConfig::DONT_CARE)
width = DEFAULT_WINDOW_WIDTH;
if (height == glu::RenderConfig::DONT_CARE)
height = DEFAULT_WINDOW_HEIGHT;
m_window = XCreateWindow(dpy, root, 0, 0, width, height, 0,
CopyFromParent, InputOutput, visual, mask, &swa);
TCU_CHECK(m_window);
Atom deleteAtom = m_display.getDeleteAtom();
XSetWMProtocols(dpy, m_window, &deleteAtom, 1);
}