@@ -595,14 +595,39 @@ void input_key_notify(struct aaa *e, void *user_data) {
595
595
wl_display_terminate (server -> display );
596
596
break ;
597
597
}
598
+ struct surface_node * match ;
599
+ if ( e -> key == KEY_TAB ) {
600
+ struct wl_list * current_surface ;
601
+ current_surface = server -> mapped_surfaces_list .next ;
602
+ for (uint8_t c = 0 ; c < i + 1 ;c ++ ){
603
+ if (current_surface != NULL ) {
604
+ current_surface = current_surface -> next ;
605
+ } else {
606
+ break ;
607
+ }
608
+ }
609
+ if (server -> mapped_surfaces_list .next -> prev != server -> mapped_surfaces_list .next -> next ) {
610
+ if (current_surface != & server -> mapped_surfaces_list ){
611
+ match = wl_container_of (current_surface , match , link );
612
+ errlog ("match %p" , (void * )match );
613
+ server_change_focus (server , match );
614
+ }
615
+ }
616
+ i ++ ;
617
+ break ;
618
+ }
598
619
errlog ("the key '%s' was pressed" , e -> name );
599
620
name [i ] = e -> name [0 ];
600
621
i ++ ;
601
- struct surface_node * match = match_app_id (server , name );
622
+ match = match_app_id (server , name );
602
623
errlog ("match %p" , (void * )match );
603
624
if (match )
604
625
server_change_focus (server , match );
605
626
} else if (steal ) {
627
+ if (e -> key == KEY_ESC ) {
628
+ wl_display_terminate (server -> display );
629
+ break ;
630
+ }
606
631
} else if (!wl_list_empty (& server -> mapped_surfaces_list )) {
607
632
struct wl_resource * keyboard = focused_surface_keyboard (server );
608
633
if (keyboard ) {
0 commit comments