File tree Expand file tree Collapse file tree 2 files changed +18
-22
lines changed
Expand file tree Collapse file tree 2 files changed +18
-22
lines changed Original file line number Diff line number Diff line change @@ -112,14 +112,15 @@ impl Widget for Button {
112112 event : & PointerEvent ,
113113 ) {
114114 match event {
115- PointerEvent :: Down {
116- button : Some ( PointerButton :: Primary ) ,
117- ..
118- } => {
119- ctx. capture_pointer ( ) ;
120- // Changes in pointer capture impact appearance, but not accessibility node
121- ctx. request_paint_only ( ) ;
122- trace ! ( "Button {:?} pressed" , ctx. widget_id( ) ) ;
115+ PointerEvent :: Down { button, .. } => {
116+ if * button == Some ( PointerButton :: Primary ) {
117+ ctx. capture_pointer ( ) ;
118+ // Changes in pointer capture impact appearance, but not accessibility node
119+ ctx. request_paint_only ( ) ;
120+ trace ! ( "Button {:?} pressed" , ctx. widget_id( ) ) ;
121+ }
122+ // Any click event should lead to this widget getting focused.
123+ ctx. request_focus ( ) ;
123124 }
124125 PointerEvent :: Up {
125126 button : Some ( PointerButton :: Primary ) ,
@@ -134,10 +135,6 @@ impl Widget for Button {
134135 // Changes in pointer capture impact appearance, but not accessibility node
135136 ctx. request_paint_only ( ) ;
136137 }
137- PointerEvent :: Down { .. } => {
138- // Any non-primary click event should lead to this widget getting focused.
139- ctx. request_focus ( ) ;
140- }
141138 _ => ( ) ,
142139 }
143140 }
Original file line number Diff line number Diff line change @@ -113,12 +113,15 @@ impl Widget for Checkbox {
113113 event : & PointerEvent ,
114114 ) {
115115 match event {
116- PointerEvent :: Down {
117- button : Some ( PointerButton :: Primary ) ,
118- ..
119- } => {
120- ctx. capture_pointer ( ) ;
121- trace ! ( "Checkbox {:?} pressed" , ctx. widget_id( ) ) ;
116+ PointerEvent :: Down { button, .. } => {
117+ if * button == Some ( PointerButton :: Primary ) {
118+ ctx. capture_pointer ( ) ;
119+ // Checked state impacts appearance and accessibility node
120+ ctx. request_render ( ) ;
121+ trace ! ( "Checkbox {:?} pressed" , ctx. widget_id( ) ) ;
122+ }
123+ // Any click event should lead to this widget getting focused.
124+ ctx. request_focus ( ) ;
122125 }
123126 PointerEvent :: Up {
124127 button : Some ( PointerButton :: Primary ) ,
@@ -129,10 +132,6 @@ impl Widget for Checkbox {
129132 trace ! ( "Checkbox {:?} released" , ctx. widget_id( ) ) ;
130133 }
131134 }
132- PointerEvent :: Down { .. } => {
133- // Any non-primary click event should lead to this widget getting focused.
134- ctx. request_focus ( ) ;
135- }
136135 _ => ( ) ,
137136 }
138137 }
You can’t perform that action at this time.
0 commit comments