1414
1515//! X11 window creation and window management.
1616
17- use std:: borrow:: Cow ;
1817use std:: cell:: { Cell , RefCell } ;
1918use std:: collections:: BinaryHeap ;
2019use std:: convert:: { TryFrom , TryInto } ;
@@ -31,14 +30,13 @@ use tracing::{error, info, warn};
3130use x11rb:: atom_manager;
3231use x11rb:: connection:: Connection ;
3332use x11rb:: errors:: ReplyOrIdError ;
34- use x11rb:: image:: { BitsPerPixel , Image , ImageOrder , ScanlinePad } ;
3533use x11rb:: protocol:: present:: { CompleteNotifyEvent , ConnectionExt as _, IdleNotifyEvent } ;
3634use x11rb:: protocol:: render:: { ConnectionExt as _, Pictformat } ;
3735use x11rb:: protocol:: xfixes:: { ConnectionExt as _, Region as XRegion } ;
3836use x11rb:: protocol:: xproto:: {
3937 self , AtomEnum , ChangeWindowAttributesAux , ConfigureNotifyEvent , ConnectionExt , CreateGCAux ,
40- EventMask , Gcontext , ImageOrder as X11ImageOrder , Pixmap , PropMode , Rectangle , Visualtype ,
41- WindowClass ,
38+ EventMask , Gcontext , ImageFormat , ImageOrder as X11ImageOrder , Pixmap , PropMode , Rectangle ,
39+ Visualtype , WindowClass ,
4240} ;
4341use x11rb:: wrapper:: ConnectionExt as _;
4442use x11rb:: xcb_ffi:: XCBConnection ;
@@ -1734,27 +1732,31 @@ fn make_cursor(
17341732 } )
17351733 } )
17361734 . collect :: < Vec < u8 > > ( ) ;
1737- let image = Image :: new (
1738- desc. image . width ( ) . try_into ( ) . expect ( "Invalid cursor width" ) ,
1739- desc. image
1740- . height ( )
1741- . try_into ( )
1742- . expect ( "Invalid cursor height" ) ,
1743- ScanlinePad :: Pad8 ,
1744- 32 ,
1745- BitsPerPixel :: B32 ,
1746- ImageOrder :: MSBFirst ,
1747- Cow :: Owned ( pixels) ,
1748- )
1749- . expect ( "We got the number of bytes for this image wrong?!" ) ;
1735+ let width = desc. image . width ( ) . try_into ( ) . expect ( "Invalid cursor width" ) ;
1736+ let height = desc
1737+ . image
1738+ . height ( )
1739+ . try_into ( )
1740+ . expect ( "Invalid cursor height" ) ;
17501741
17511742 let pixmap = conn. generate_id ( ) ?;
17521743 let gc = conn. generate_id ( ) ?;
17531744 let picture = conn. generate_id ( ) ?;
1754- conn. create_pixmap ( 32 , pixmap, root_window, image . width ( ) , image . height ( ) ) ?;
1745+ conn. create_pixmap ( 32 , pixmap, root_window, width, height) ?;
17551746 conn. create_gc ( gc, pixmap, & Default :: default ( ) ) ?;
17561747
1757- image. put ( conn, pixmap, gc, 0 , 0 ) ?;
1748+ conn. put_image (
1749+ ImageFormat :: Z_PIXMAP ,
1750+ pixmap,
1751+ gc,
1752+ width,
1753+ height,
1754+ 0 ,
1755+ 0 ,
1756+ 0 ,
1757+ 32 ,
1758+ & pixels,
1759+ ) ?;
17581760 conn. render_create_picture ( picture, pixmap, argb32_format, & Default :: default ( ) ) ?;
17591761
17601762 conn. free_gc ( gc) ?;
0 commit comments