@@ -49,7 +49,7 @@ struct WallpaperThread {
4949}
5050
5151impl WallpaperThread {
52- fn _log ( & self , msg : String ) {
52+ fn log ( & self , msg : String ) {
5353 self . pandora . upgrade ( ) . unwrap ( ) . log ( "wallpaper" , msg) ;
5454 }
5555 fn debug ( & self , msg : String ) {
@@ -63,11 +63,16 @@ impl WallpaperThread {
6363 let mut conn = Connection :: < RenderThreadState > :: connect ( ) . unwrap ( ) ;
6464 let mut thread_state = RenderThreadState {
6565 outputs : Vec :: new ( ) ,
66+ detached_outputs : Vec :: new ( ) ,
6667 globals : WaylandGlobals :: new ( & mut conn) ,
6768 pandora : self . pandora . clone ( ) ,
6869 } ;
70+ self . verbose ( "getting initial output states" . to_string ( ) ) ;
6971 thread_state. get_outputs ( & mut conn) ;
72+ self . verbose ( "initializing wallpaper states" . to_string ( ) ) ;
73+ // thought: peek at self.cmd_queue => pull initial scroll events, if any, for initial position state?
7074 crate :: wayland:: render_base:: initialize_wallpaper_outputs ( & mut conn, & self . config , & mut thread_state) ;
75+ self . log ( "entering draw loop" . to_string ( ) ) ;
7176 self . draw_loop ( & mut conn, & mut thread_state) ;
7277 }
7378
@@ -86,16 +91,15 @@ impl WallpaperThread {
8691 Ok ( queue) =>
8792 self . handle_cmd ( conn, state, & queue. recv ( )
8893 . expect ( "thread exploded during blocking read on inbound commands" ) ) ,
89- Err ( _e ) => ( ) ,
90- //state.pandora.debug("wallpaper", format!("{e:?}")),
94+ Err ( e ) =>
95+ return self . log ( format ! ( "{e:?}" ) ) ,
9196 }
9297 }
9398 }
9499 }
95100 }
96101
97102 fn handle_inbound_commands ( & self , conn : & mut Connection < RenderThreadState > , state : & mut RenderThreadState ) {
98- let pandora = self . pandora . upgrade ( ) . unwrap ( ) ;
99103 match self . cmd_queue . lock ( ) {
100104 Ok ( queue) => loop {
101105 match queue. try_recv ( ) {
@@ -104,20 +108,22 @@ impl WallpaperThread {
104108 }
105109 } ,
106110 Err ( e) =>
107- return pandora . debug ( "wallpaper" , format ! ( "{e:?}" ) ) ,
111+ return self . log ( format ! ( "{e:?}" ) ) ,
108112 }
109113 }
110114
111115 fn handle_cmd ( & self , conn : & mut Connection < RenderThreadState > , state : & mut RenderThreadState , cmd : & RenderThreadCommand ) {
112116 self . verbose ( format ! ( "command: {:?}" , cmd) ) ;
113117 match cmd {
114118 RenderThreadCommand :: Render ( _) => {
119+ // could just handle as discard old render_state & make new . . . with new scroll position? hmmmmmmm
115120 //self.render(c, state).expect("error handling render command");
116121 todo ! ( ) ;
117122 }
118- RenderThreadCommand :: Scroll ( c ) => {
119- self . scroll ( conn, state, c ) ;
123+ RenderThreadCommand :: Scroll ( cmd ) => {
124+ self . scroll ( conn, state, cmd ) ;
120125 } ,
126+ // reload config :/
121127 }
122128 }
123129
@@ -128,8 +134,10 @@ impl WallpaperThread {
128134 None => return self . debug ( "could not find output in state vec for scroll op" . to_string ( ) ) ,
129135 } ;
130136
131- if let OutputRenderStateVariety :: Wallpaper ( render_state) = output_state. render_state . as_mut ( ) . unwrap ( ) {
137+ if let Some ( OutputRenderStateVariety :: Wallpaper ( render_state) ) = output_state. render_state . as_mut ( ) {
132138 render_state. scroll ( conn, cmd. position ) ;
139+ } else {
140+ self . debug ( "received scroll command, but no wallpaper state found on attached outputs. reseat pending/workspace change from output disconnect?" . to_string ( ) ) ;
133141 }
134142 }
135143}
0 commit comments