@@ -1138,15 +1138,16 @@ destroylocksurface(struct wl_listener *listener, void *data)
1138
1138
m -> lock_surface = NULL ;
1139
1139
wl_list_remove (& m -> destroy_lock_surface .link );
1140
1140
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 );
1150
1151
}
1151
1152
}
1152
1153
@@ -1452,12 +1453,13 @@ keypress(struct wl_listener *listener, void *data)
1452
1453
wl_event_source_timer_update (kb -> key_repeat_source , 0 );
1453
1454
}
1454
1455
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 );
1461
1463
}
1462
1464
1463
1465
void
@@ -1483,13 +1485,14 @@ keyrepeat(void *data)
1483
1485
{
1484
1486
Keyboard * kb = data ;
1485
1487
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 ;
1489
1490
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 ]);
1493
1496
1494
1497
return 0 ;
1495
1498
}
@@ -2335,11 +2338,12 @@ void
2335
2338
tag (const Arg * arg )
2336
2339
{
2337
2340
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 );
2343
2347
printstatus ();
2344
2348
}
2345
2349
@@ -2409,11 +2413,12 @@ toggletag(const Arg *arg)
2409
2413
if (!sel )
2410
2414
return ;
2411
2415
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 );
2417
2422
printstatus ();
2418
2423
}
2419
2424
@@ -2422,11 +2427,12 @@ toggleview(const Arg *arg)
2422
2427
{
2423
2428
uint32_t newtagset = selmon ? selmon -> tagset [selmon -> seltags ] ^ (arg -> ui & TAGMASK ) : 0 ;
2424
2429
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 );
2430
2436
printstatus ();
2431
2437
}
2432
2438
@@ -2583,10 +2589,11 @@ urgent(struct wl_listener *listener, void *data)
2583
2589
struct wlr_xdg_activation_v1_request_activate_event * event = data ;
2584
2590
Client * c = NULL ;
2585
2591
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 ();
2590
2597
}
2591
2598
2592
2599
void
@@ -2745,10 +2752,11 @@ void
2745
2752
sethints (struct wl_listener * listener , void * data )
2746
2753
{
2747
2754
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 ();
2752
2760
}
2753
2761
2754
2762
void
0 commit comments