@@ -1138,15 +1138,16 @@ destroylocksurface(struct wl_listener *listener, void *data)
11381138 m -> lock_surface = NULL ;
11391139 wl_list_remove (& m -> destroy_lock_surface .link );
11401140
1141- if (lock_surface -> surface == seat -> keyboard_state .focused_surface ) {
1142- if (locked && cur_lock && !wl_list_empty (& cur_lock -> surfaces )) {
1143- surface = wl_container_of (cur_lock -> surfaces .next , surface , link );
1144- client_notify_enter (surface -> surface , wlr_seat_get_keyboard (seat ));
1145- } else if (!locked ) {
1146- focusclient (focustop (selmon ), 1 );
1147- } else {
1148- wlr_seat_keyboard_clear_focus (seat );
1149- }
1141+ if (lock_surface -> surface != seat -> keyboard_state .focused_surface )
1142+ return ;
1143+
1144+ if (locked && cur_lock && !wl_list_empty (& cur_lock -> surfaces )) {
1145+ surface = wl_container_of (cur_lock -> surfaces .next , surface , link );
1146+ client_notify_enter (surface -> surface , wlr_seat_get_keyboard (seat ));
1147+ } else if (!locked ) {
1148+ focusclient (focustop (selmon ), 1 );
1149+ } else {
1150+ wlr_seat_keyboard_clear_focus (seat );
11501151 }
11511152}
11521153
@@ -1452,12 +1453,13 @@ keypress(struct wl_listener *listener, void *data)
14521453 wl_event_source_timer_update (kb -> key_repeat_source , 0 );
14531454 }
14541455
1455- if (!handled ) {
1456- /* Pass unhandled keycodes along to the client. */
1457- wlr_seat_set_keyboard (seat , kb -> wlr_keyboard );
1458- wlr_seat_keyboard_notify_key (seat , event -> time_msec ,
1459- event -> keycode , event -> state );
1460- }
1456+ if (handled )
1457+ return ;
1458+
1459+ /* Pass unhandled keycodes along to the client. */
1460+ wlr_seat_set_keyboard (seat , kb -> wlr_keyboard );
1461+ wlr_seat_keyboard_notify_key (seat , event -> time_msec ,
1462+ event -> keycode , event -> state );
14611463}
14621464
14631465void
@@ -1483,13 +1485,14 @@ keyrepeat(void *data)
14831485{
14841486 Keyboard * kb = data ;
14851487 int i ;
1486- if (kb -> nsyms && kb -> wlr_keyboard -> repeat_info .rate > 0 ) {
1487- wl_event_source_timer_update (kb -> key_repeat_source ,
1488- 1000 / kb -> wlr_keyboard -> repeat_info .rate );
1488+ if (!kb -> nsyms || kb -> wlr_keyboard -> repeat_info .rate <= 0 )
1489+ return 0 ;
14891490
1490- for (i = 0 ; i < kb -> nsyms ; i ++ )
1491- keybinding (kb -> mods , kb -> keysyms [i ]);
1492- }
1491+ wl_event_source_timer_update (kb -> key_repeat_source ,
1492+ 1000 / kb -> wlr_keyboard -> repeat_info .rate );
1493+
1494+ for (i = 0 ; i < kb -> nsyms ; i ++ )
1495+ keybinding (kb -> mods , kb -> keysyms [i ]);
14931496
14941497 return 0 ;
14951498}
@@ -2335,11 +2338,12 @@ void
23352338tag (const Arg * arg )
23362339{
23372340 Client * sel = focustop (selmon );
2338- if (sel && arg -> ui & TAGMASK ) {
2339- sel -> tags = arg -> ui & TAGMASK ;
2340- focusclient (focustop (selmon ), 1 );
2341- arrange (selmon );
2342- }
2341+ if (!sel || (arg -> ui & TAGMASK ) == 0 )
2342+ return ;
2343+
2344+ sel -> tags = arg -> ui & TAGMASK ;
2345+ focusclient (focustop (selmon ), 1 );
2346+ arrange (selmon );
23432347 printstatus ();
23442348}
23452349
@@ -2409,11 +2413,12 @@ toggletag(const Arg *arg)
24092413 if (!sel )
24102414 return ;
24112415 newtags = sel -> tags ^ (arg -> ui & TAGMASK );
2412- if (newtags ) {
2413- sel -> tags = newtags ;
2414- focusclient (focustop (selmon ), 1 );
2415- arrange (selmon );
2416- }
2416+ if (!newtags )
2417+ return ;
2418+
2419+ sel -> tags = newtags ;
2420+ focusclient (focustop (selmon ), 1 );
2421+ arrange (selmon );
24172422 printstatus ();
24182423}
24192424
@@ -2422,11 +2427,12 @@ toggleview(const Arg *arg)
24222427{
24232428 uint32_t newtagset = selmon ? selmon -> tagset [selmon -> seltags ] ^ (arg -> ui & TAGMASK ) : 0 ;
24242429
2425- if (newtagset ) {
2426- selmon -> tagset [selmon -> seltags ] = newtagset ;
2427- focusclient (focustop (selmon ), 1 );
2428- arrange (selmon );
2429- }
2430+ if (!newtagset )
2431+ return ;
2432+
2433+ selmon -> tagset [selmon -> seltags ] = newtagset ;
2434+ focusclient (focustop (selmon ), 1 );
2435+ arrange (selmon );
24302436 printstatus ();
24312437}
24322438
@@ -2583,10 +2589,11 @@ urgent(struct wl_listener *listener, void *data)
25832589 struct wlr_xdg_activation_v1_request_activate_event * event = data ;
25842590 Client * c = NULL ;
25852591 toplevel_from_wlr_surface (event -> surface , & c , NULL );
2586- if (c && c != focustop (selmon )) {
2587- c -> isurgent = 1 ;
2588- printstatus ();
2589- }
2592+ if (!c || c == focustop (selmon ))
2593+ return ;
2594+
2595+ c -> isurgent = 1 ;
2596+ printstatus ();
25902597}
25912598
25922599void
@@ -2745,10 +2752,11 @@ void
27452752sethints (struct wl_listener * listener , void * data )
27462753{
27472754 Client * c = wl_container_of (listener , c , set_hints );
2748- if (c != focustop (selmon )) {
2749- c -> isurgent = xcb_icccm_wm_hints_get_urgency (c -> surface .xwayland -> hints );
2750- printstatus ();
2751- }
2755+ if (c == focustop (selmon ))
2756+ return ;
2757+
2758+ c -> isurgent = xcb_icccm_wm_hints_get_urgency (c -> surface .xwayland -> hints );
2759+ printstatus ();
27522760}
27532761
27542762void
0 commit comments