@@ -134,6 +134,9 @@ pub struct WindowState {
134134 /// Whether we should decorate the frame.
135135 decorate : bool ,
136136
137+ /// Whether we should tell the compositor that we prefer drawing decorations ourself.
138+ prefer_csd : bool ,
139+
137140 /// Min size.
138141 min_surface_size : LogicalSize < u32 > ,
139142 max_surface_size : Option < LogicalSize < u32 > > ,
@@ -180,6 +183,7 @@ impl WindowState {
180183 initial_size : Size ,
181184 window : Window ,
182185 theme : Option < Theme > ,
186+ prefer_csd : bool ,
183187 ) -> Self {
184188 let compositor = winit_state. compositor_state . clone ( ) ;
185189 let pointer_constraints = winit_state. pointer_constraints . clone ( ) ;
@@ -209,6 +213,7 @@ impl WindowState {
209213 selected_cursor : Default :: default ( ) ,
210214 cursor_visible : true ,
211215 decorate : true ,
216+ prefer_csd,
212217 fractional_scale,
213218 frame : None ,
214219 frame_callback_state : FrameCallbackState :: None ,
@@ -955,7 +960,7 @@ impl WindowState {
955960 /// Whether show or hide client side decorations.
956961 #[ inline]
957962 pub fn set_decorate ( & mut self , decorate : bool ) {
958- if decorate == self . decorate {
963+ if decorate == self . decorate && ! self . prefer_csd {
959964 return ;
960965 }
961966
@@ -966,6 +971,9 @@ impl WindowState {
966971 // To disable decorations we should request client and hide the frame.
967972 self . window . request_decoration_mode ( Some ( DecorationMode :: Client ) )
968973 } ,
974+ _ if self . decorate && self . prefer_csd => {
975+ self . window . request_decoration_mode ( Some ( DecorationMode :: Client ) )
976+ } ,
969977 _ if self . decorate => self . window . request_decoration_mode ( Some ( DecorationMode :: Server ) ) ,
970978 _ => ( ) ,
971979 }
0 commit comments