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 ) ) ); }
bool sge::x11input::xi_version( awl::backends::x11::display &_display, int const _major, int const _minor ) { // BadRequest will be generated if the // server doesn't support XI2 at all. // Otherwise the version the server actually supports is returned. int major_ret( _major ), minor_ret( _minor ); return ::XIQueryVersion( _display.get(), &major_ret, &minor_ret ) != BadRequest && ( major_ret > _major || ( _major == major_ret && minor_ret >= _minor ) ); }
sge::x11input::atom_name::atom_name( awl::backends::x11::display &_display, Atom const _atom ) : name_( ::XGetAtomName( _display.get(), _atom ) ) { }
awl::backends::x11::cursor::holder_unique_ptr awl::backends::x11::cursor::create_pixmap( awl::backends::x11::display const &_display, awl::backends::x11::cursor::source_pixmap const &_source_pixmap, awl::backends::x11::cursor::dest_pixmap const &_dest_pixmap, awl::backends::x11::cursor::foreground_color const &_foreground_color, awl::backends::x11::cursor::background_color const &_background_color, awl::cursor::hotspot const _hotspot ) { Cursor const result{ ::XCreatePixmapCursor( _display.get(), _source_pixmap.get().get(), _dest_pixmap.get().get(), const_cast< XColor * >( &_foreground_color.get() ), const_cast< XColor * >( &_background_color.get() ), _hotspot.x(), _hotspot.y() ) }; if( result == None ) throw awl::exception{ FCPPT_TEXT("XCreatePixmapCursor failed!") }; return fcppt::make_unique_ptr< awl::backends::x11::cursor::holder >( _display, result ); }
awl::backends::x11::system::event::object awl::backends::x11::system::event::next( awl::backends::x11::display &_display ) { XEvent event; // always returns 0 ::XNextEvent( _display.get(), &event ); return awl::backends::x11::system::event::object( event ); }
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 ); }