@@ -260,7 +260,7 @@ static void focusmon(const Arg *arg);
260
260
static void focusstack (const Arg * arg );
261
261
static Client * focustop (Monitor * m );
262
262
static void fullscreennotify (struct wl_listener * listener , void * data );
263
- static int handlesig (int signo , void * data );
263
+ static void handlesig (int signo );
264
264
static void incnmaster (const Arg * arg );
265
265
static void inputdevice (struct wl_listener * listener , void * data );
266
266
static int keybinding (uint32_t mods , xkb_keysym_t sym );
@@ -326,8 +326,6 @@ static pid_t child_pid = -1;
326
326
static int locked ;
327
327
static void * exclusive_focus ;
328
328
static struct wl_display * dpy ;
329
- static struct wl_event_loop * eventloop ;
330
- static struct wl_event_source * sighandler [4 ];
331
329
static struct wlr_backend * backend ;
332
330
static struct wlr_scene * scene ;
333
331
static struct wlr_scene_tree * layers [NUM_LAYERS ];
@@ -654,7 +652,6 @@ checkidleinhibitor(struct wlr_surface *exclude)
654
652
void
655
653
cleanup (void )
656
654
{
657
- int i ;
658
655
#ifdef XWAYLAND
659
656
wlr_xwayland_destroy (xwayland );
660
657
#endif
@@ -671,8 +668,6 @@ cleanup(void)
671
668
wlr_cursor_destroy (cursor );
672
669
wlr_output_layout_destroy (output_layout );
673
670
wlr_seat_destroy (seat );
674
- for (i = 0 ; i < LENGTH (sighandler ); i ++ )
675
- wl_event_source_remove (sighandler [i ]);
676
671
wl_display_destroy (dpy );
677
672
}
678
673
@@ -826,7 +821,8 @@ createkeyboard(struct wlr_keyboard *keyboard)
826
821
827
822
wlr_seat_set_keyboard (seat , keyboard );
828
823
829
- kb -> key_repeat_source = wl_event_loop_add_timer (eventloop , keyrepeat , kb );
824
+ kb -> key_repeat_source = wl_event_loop_add_timer (
825
+ wl_display_get_event_loop (dpy ), keyrepeat , kb );
830
826
831
827
/* And add the keyboard to our list of keyboards */
832
828
wl_list_insert (& keyboards , & kb -> link );
@@ -1338,8 +1334,8 @@ fullscreennotify(struct wl_listener *listener, void *data)
1338
1334
setfullscreen (c , client_wants_fullscreen (c ));
1339
1335
}
1340
1336
1341
- int
1342
- handlesig (int signo , void * data )
1337
+ void
1338
+ handlesig (int signo )
1343
1339
{
1344
1340
if (signo == SIGCHLD ) {
1345
1341
#ifdef XWAYLAND
@@ -1357,7 +1353,6 @@ handlesig(int signo, void *data)
1357
1353
} else if (signo == SIGINT || signo == SIGTERM ) {
1358
1354
quit (NULL );
1359
1355
}
1360
- return 0 ;
1361
1356
}
1362
1357
1363
1358
void
@@ -2143,13 +2138,15 @@ void
2143
2138
setup (void )
2144
2139
{
2145
2140
int i , sig [] = {SIGCHLD , SIGINT , SIGTERM , SIGPIPE };
2141
+ struct sigaction sa = {.sa_flags = SA_RESTART , .sa_handler = handlesig };
2142
+ sigemptyset (& sa .sa_mask );
2143
+
2144
+ for (i = 0 ; i < LENGTH (sig ); i ++ )
2145
+ sigaction (sig [i ], & sa , NULL );
2146
2146
2147
2147
/* The Wayland display is managed by libwayland. It handles accepting
2148
2148
* clients from the Unix socket, manging Wayland globals, and so on. */
2149
2149
dpy = wl_display_create ();
2150
- eventloop = wl_display_get_event_loop (dpy );
2151
- for (i = 0 ; i < LENGTH (sighandler ); i ++ )
2152
- sighandler [i ] = wl_event_loop_add_signal (eventloop , sig [i ], handlesig , NULL );
2153
2150
2154
2151
/* The backend is a wlroots feature which abstracts the underlying input and
2155
2152
* output hardware. The autocreate option will choose the most suitable
0 commit comments