From 6412fd18f057703fdaaebafc244cf9cb63e5a1f3 Mon Sep 17 00:00:00 2001 From: sabetts Date: Mon, 11 Jun 2001 01:27:49 +0000 Subject: * src/main.c (rp_rat_bits): remove (rp_rat_mask_bits): remove include (sighandler): only increment kill_signalled (hup_handler): only increment hup_signalled (alrm_handler): only increment alarm_signalled (read_startup_files): use PRINT_ERROR for error messages. (init_rat_cursor): Use a standard X cursor for the screen's rat. * src/events.h (unmap_notify): remove prototype (delegate_event): likewise (key_press): likewise (keymapstate): likewise (map_request): likewise * src/events.c: includes and (new_window): static function (unmap_notify): likewise (map_request): likewise (destroy_window): likewise (configure_notify): likewise (configure_request): likewise (key_press): likewise (property_notify): likewise (colormap_notify): likewise (delegate_event): likewise (get_event): new function (more_destroy_events): remove function (handle_events): call get_event. * src/data.h: rp_current_event is an XEvent dependant code updated. new globals alarm_signalled, kill_signalled, hup_signalled. * src/actions.c (initialize_default_keybindings): new bindings for "split" and "vsplit". --- src/main.c | 77 +++++++++----------------------------------------------------- 1 file changed, 11 insertions(+), 66 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 16b27bf..c34436a 100644 --- a/src/main.c +++ b/src/main.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -37,19 +38,9 @@ static void init_screen (screen_info *s, int screen_num); -/* When a user hits the prefix key, the rat switches to a different - pixmap to indicate that ratpoison expects the user to hit another - key, these are the pixmaps. */ -static unsigned char rp_rat_bits[] = { - 0x00, 0x00, 0xfe, 0x7f, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, - 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, - 0x02, 0x40, 0x02, 0x40, 0xfe, 0x7f, 0x00, 0x00}; - -static unsigned char rp_rat_mask_bits[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - +int alarm_signalled = 0; +int kill_signalled = 0; +int hup_signalled = 0; int rat_x; int rat_y; int rat_visible = 1; /* rat is visible by default */ @@ -123,39 +114,19 @@ xrealloc (void *ptr, size_t size) void sighandler (int signum) { - fprintf (stderr, "ratpoison: Agg! I've been SHOT!\n"); - clean_up (); - exit (EXIT_FAILURE); + kill_signalled++; } void hup_handler (int signum) { - /* Doesn't function correctly. The event IS placed on the queue but - XSync() doesn't seem to sync it and until other events come in - the restart event won't be processed. */ - PRINT_DEBUG ("Restarting with a fresh plate.\n"); - - send_restart (); - XSync(dpy, False); + hup_signalled++; } void alrm_handler (int signum) { - int i; - - PRINT_DEBUG ("alarm recieved.\n"); - - /* FIXME: should only hide 1 bar, but we hide them all. */ - for (i=0; iscreen_num), - "black", &fg, &dummy); - XAllocNamedColor(dpy, DefaultColormap(dpy, s->screen_num), - "white", &bg, &dummy); - - fore = XCreatePixmapFromBitmapData (dpy, s->root, - rp_rat_bits, RAT_WIDTH, RAT_HEIGHT, - 1, 0, 1); - mask = XCreatePixmapFromBitmapData (dpy, s->root, - rp_rat_mask_bits, RAT_WIDTH, RAT_HEIGHT, - 1, 0, 1); - s->rat = XCreatePixmapCursor(dpy, fore, mask, - &fg, &bg, RAT_HOT_X, RAT_HOT_Y); - - XFreePixmap (dpy, fore); - XFreePixmap (dpy, mask); + s->rat = XCreateFontCursor( dpy, XC_icon ); } static void @@ -508,11 +463,6 @@ init_screen (screen_info *s, int screen_num) fprintf (stderr, "ratpoison: Unknown color '%s'\n", BACKGROUND); } -/* if (!XAllocNamedColor (dpy, s->def_cmap, BAR_BOLD_COLOR, &bold_color, &junk)) */ -/* { */ -/* fprintf (stderr, "ratpoison: Unknown color '%s'\n", BAR_BOLD_COLOR); */ -/* } */ - /* Setup the GC for drawing the font. */ gv.foreground = fg_color.pixel; gv.background = bg_color.pixel; @@ -524,11 +474,6 @@ init_screen (screen_info *s, int screen_num) GCForeground | GCBackground | GCFunction | GCLineWidth | GCSubwindowMode | GCFont, &gv); -/* gv.foreground = bold_color.pixel; */ -/* s->bold_gc = XCreateGC(dpy, s->root, */ -/* GCForeground | GCBackground | GCFunction */ -/* | GCLineWidth | GCSubwindowMode | GCFont, */ -/* &gv); */ /* Create the program bar window. */ s->bar_is_raised = 0; -- cgit v1.2.3