Port sighandler to tree-branch
This commit is contained in:
parent
2d05c3a37d
commit
fb6d117c42
2
Makefile
2
Makefile
|
@ -4,7 +4,7 @@ include $(TOPDIR)/common.mk
|
|||
|
||||
# Depend on the object files of all source-files in src/*.c and on all header files
|
||||
AUTOGENERATED:=src/cfgparse.tab.c src/cfgparse.yy.c src/cmdparse.tab.c src/cmdparse.yy.c
|
||||
FILES:=src/ipc.c src/main.c src/log.c src/util.c src/tree.c src/xcb.c src/manage.c src/workspace.c src/x.c src/floating.c src/click.c src/config.c src/handlers.c src/randr.c src/xinerama.c src/con.c src/load_layout.c src/render.c src/window.c src/match.c src/xcursor.c src/resize.c
|
||||
FILES:=src/ipc.c src/main.c src/log.c src/util.c src/tree.c src/xcb.c src/manage.c src/workspace.c src/x.c src/floating.c src/click.c src/config.c src/handlers.c src/randr.c src/xinerama.c src/con.c src/load_layout.c src/render.c src/window.c src/match.c src/xcursor.c src/resize.c src/sighandler.c
|
||||
FILES:=$(FILES:.c=.o)
|
||||
HEADERS:=$(filter-out include/loglevels.h,$(wildcard include/*.h))
|
||||
|
||||
|
|
|
@ -53,5 +53,6 @@
|
|||
#include "cmdparse.h"
|
||||
#include "xcursor.h"
|
||||
#include "resize.h"
|
||||
#include "sighandler.h"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -385,6 +385,12 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
manage_existing_windows(root);
|
||||
|
||||
setup_signal_handler();
|
||||
|
||||
/* Ignore SIGPIPE to survive errors when an IPC client disconnects
|
||||
* while we are sending him a message */
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
/* Autostarting exec-lines */
|
||||
if (autostart) {
|
||||
struct Autostart *exec;
|
||||
|
|
|
@ -50,17 +50,17 @@ static int crash_text_longest = 1;
|
|||
* Draw the window containing the info text
|
||||
*
|
||||
*/
|
||||
static int sig_draw_window(xcb_connection_t *conn, xcb_window_t win, int width, int height, int font_height) {
|
||||
static int sig_draw_window(xcb_window_t win, int width, int height, int font_height) {
|
||||
/* re-draw the background */
|
||||
xcb_rectangle_t border = { 0, 0, width, height},
|
||||
inner = { 2, 2, width - 4, height - 4};
|
||||
xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FOREGROUND, get_colorpixel(conn, "#FF0000"));
|
||||
xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FOREGROUND, get_colorpixel("#FF0000"));
|
||||
xcb_poly_fill_rectangle(conn, pixmap, pixmap_gc, 1, &border);
|
||||
xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FOREGROUND, get_colorpixel(conn, "#000000"));
|
||||
xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FOREGROUND, get_colorpixel("#000000"));
|
||||
xcb_poly_fill_rectangle(conn, pixmap, pixmap_gc, 1, &inner);
|
||||
|
||||
/* restore font color */
|
||||
xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FOREGROUND, get_colorpixel(conn, "#FFFFFF"));
|
||||
xcb_change_gc_single(conn, pixmap_gc, XCB_GC_FOREGROUND, get_colorpixel("#FFFFFF"));
|
||||
|
||||
for (int i = 0; i < sizeof(crash_text) / sizeof(char*); i++) {
|
||||
int text_len = strlen(crash_text[i]);
|
||||
|
@ -156,8 +156,6 @@ void handle_signal(int sig, siginfo_t *info, void *data) {
|
|||
sigaction(sig, &action, NULL);
|
||||
raised_signal = sig;
|
||||
|
||||
xcb_connection_t *conn = global_conn;
|
||||
|
||||
/* setup event handler for key presses */
|
||||
xcb_event_handlers_t sig_evenths;
|
||||
memset(&sig_evenths, 0, sizeof(xcb_event_handlers_t));
|
||||
|
@ -200,7 +198,7 @@ void handle_signal(int sig, siginfo_t *info, void *data) {
|
|||
xcb_grab_pointer(conn, false, win, XCB_NONE, XCB_GRAB_MODE_ASYNC,
|
||||
XCB_GRAB_MODE_ASYNC, win, XCB_NONE, XCB_CURRENT_TIME);
|
||||
|
||||
sig_draw_window(conn, win, width, height, font->height);
|
||||
sig_draw_window(win, width, height, font->height);
|
||||
xcb_flush(conn);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue