handle signal
This commit is contained in:
parent
da02846571
commit
d2b48791c8
3 changed files with 20 additions and 1 deletions
|
|
@ -1,5 +1,11 @@
|
|||
#include "milkwm.h"
|
||||
|
||||
void rehash(int sig) {
|
||||
pthread_mutex_lock(&xmutex);
|
||||
wm_rehash = 1;
|
||||
pthread_mutex_unlock(&xmutex);
|
||||
}
|
||||
|
||||
int main() {
|
||||
int st;
|
||||
|
||||
|
|
@ -8,5 +14,7 @@ int main() {
|
|||
|
||||
if((st = init_x()) != 0) return st;
|
||||
|
||||
signal(SIGHUP, rehash);
|
||||
|
||||
loop_wm();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
|
||||
#define TitleBarHeight 16
|
||||
#define Gap 1
|
||||
|
|
@ -30,9 +31,11 @@ extern Display* xdisplay;
|
|||
int init_x(void);
|
||||
void loop_x(void);
|
||||
void set_focus_x(MwWidget widget);
|
||||
void set_background_x(void);
|
||||
|
||||
/* wm.c */
|
||||
extern MwWidget root;
|
||||
extern int wm_rehash;
|
||||
|
||||
void loop_wm(void);
|
||||
MwWidget wm_frame(int w, int h);
|
||||
|
|
|
|||
10
milkwm/wm.c
10
milkwm/wm.c
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
#include <stb_ds.h>
|
||||
|
||||
MwWidget root = NULL;
|
||||
MwWidget root = NULL;
|
||||
int wm_rehash = 0;
|
||||
|
||||
typedef struct wmframe {
|
||||
MwWidget inside;
|
||||
|
|
@ -42,6 +43,13 @@ void loop_wm(void) {
|
|||
int s = 0;
|
||||
|
||||
pthread_mutex_lock(&xmutex);
|
||||
if(wm_rehash) {
|
||||
wm_config_init();
|
||||
wm_config_read();
|
||||
set_background_x();
|
||||
wm_rehash = 0;
|
||||
}
|
||||
|
||||
while(MwPending(root)) {
|
||||
if((s = MwStep(root)) != 0) break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue