awl::backends::x11::colormap::colormap( awl::backends::x11::display &_display, awl::backends::x11::screen const _screen, awl::backends::x11::visual::object const &_visual ) : display_( _display ), colormap_( ::XCreateColormap( display_.get(), ::XRootWindow( display_.get(), _screen.get() ), _visual.get(), AllocNone ) ) { if( colormap_ == 0 ) throw awl::exception( FCPPT_TEXT("XCreateColormap() failed!") ); }
awl::backends::x11::visual::object_unique_ptr awl::backends::x11::visual::default_( awl::backends::x11::display &_display, awl::backends::x11::screen const _screen ) { Visual *const visual( ::XDefaultVisual( _display.get(), _screen.get() ) ); FCPPT_ASSERT_POST( visual, awl::exception ); return awl::backends::x11::visual::object_unique_ptr( fcppt::make_unique_ptr< awl::backends::x11::visual::wrapped >( awl::backends::x11::visual::create_info( _display, *visual ) ) ); }
awl::backends::x11::window::base_unique_ptr awl::backends::x11::window::root( awl::backends::x11::display &_display, awl::backends::x11::screen const _screen ) { return fcppt::unique_ptr_to_base< awl::backends::x11::window::base >( fcppt::make_unique_ptr< awl::backends::x11::window::wrapped >( _display, _screen, ::XRootWindow( _display.get(), _screen.get() ) ) ); }
Window awl::backends::x11::window::create( awl::window::optional_pos const &_position, awl::window::optional_dim const &_dim, awl::backends::x11::display &_display, awl::backends::x11::screen const _screen, awl::backends::x11::colormap const &_colormap, awl::backends::x11::visual::object const &_visual, awl::backends::x11::cursor::const_optional_object_ref const &_cursor ) { unsigned long value_mask( CWColormap | CWBorderPixel | CWEventMask ); XSetWindowAttributes swa; swa.colormap = _colormap.get(); swa.border_pixel = 0; swa.event_mask = StructureNotifyMask | FocusChangeMask; if( _cursor ) { swa.cursor = _cursor->get(); value_mask |= CWCursor; } // always returns a handle return ::XCreateWindow( _display.get(), ::XRootWindow( _display.get(), _screen.get() ), _position ? _position->x() : 0 , _position ? _position->y() : 0 , _dim ? _dim->w() : 1u , _dim ? _dim->h() : 1u , // border_width 0, _visual.depth(), InputOutput, _visual.get(), value_mask, &swa ); }