--- rxvt-unicode/src/main.C 2004/04/02 15:15:26 1.65 +++ rxvt-unicode/src/main.C 2004/08/13 19:31:23 1.80 @@ -1,5 +1,5 @@ -/*--------------------------------*-C-*---------------------------------*; - * File: main.c +/*--------------------------------*-C-*---------------------------------* + * File: main.C *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. @@ -142,9 +142,9 @@ rxvt_term::rxvt_term () : +#if TRANSPARENT rootwin_ev (this, &rxvt_term::rootwin_cb), - termwin_ev (this, &rxvt_term::x_cb), - vt_ev (this, &rxvt_term::x_cb), +#endif #ifdef HAVE_SCROLLBARS scrollbar_ev (this, &rxvt_term::x_cb), #endif @@ -157,13 +157,25 @@ #ifdef TEXT_BLINK text_blink_ev (this, &rxvt_term::text_blink_cb), #endif +#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING + cont_scroll_ev (this, &rxvt_term::cont_scroll_cb), +#endif +#ifdef SELECTION_SCROLLING + sel_scroll_ev (this, &rxvt_term::sel_scroll_cb), +#endif +#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) + slip_wheel_ev (this, &rxvt_term::slip_wheel_cb), +#endif #ifdef POINTER_BLANK pointer_ev (this, &rxvt_term::pointer_cb), #endif #ifdef USE_XIM im_ev (this, &rxvt_term::im_cb), #endif + termwin_ev (this, &rxvt_term::x_cb), + vt_ev (this, &rxvt_term::x_cb), check_ev (this, &rxvt_term::check_cb), + flush_ev (this, &rxvt_term::flush_cb), destroy_ev (this, &rxvt_term::destroy_cb), pty_ev (this, &rxvt_term::pty_cb), incr_ev (this, &rxvt_term::incr_cb) @@ -193,6 +205,9 @@ { selection_clear (); +#ifdef USE_XIM + im_destroy (); +#endif #ifdef MENUBAR if (menubarGC) XFreeGC (display->display, menubarGC); #endif @@ -235,7 +250,10 @@ // TODO: free pixcolours, colours should become part of rxvt_display - delete PixColors; + delete PixColorsFocused; +#ifdef OFF_FOCUS_FADING + delete PixColorsUnFocused; +#endif displays.put (display); @@ -263,21 +281,26 @@ void rxvt_term::destroy () { + if (destroy_ev.active) + return; + if (display) { - rootwin_ev.stop (display); - termwin_ev.stop (display); - vt_ev.stop (display); -#ifdef USE_XIM - im_destroy (); +#if USE_XIM im_ev.stop (display); #endif -#ifdef HAVE_SCROLLBARS +#if HAVE_SCROLLBARS scrollbar_ev.stop (display); #endif -#ifdef MENUBAR +#if MENUBAR menubar_ev.stop (display); #endif +#if TRANSPARENT + rootwin_ev.stop (display); +#endif + incr_ev.stop (); + termwin_ev.stop (display); + vt_ev.stop (display); } check_ev.stop (); @@ -288,6 +311,12 @@ #ifdef TEXT_BLINK text_blink_ev.stop (); #endif +#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING + cont_scroll_ev.stop (); +#endif +#ifdef SELECTION_SCROLLING + sel_scroll_ev.stop (); +#endif #ifdef POINTER_BLANK pointer_ev.stop (); #endif @@ -360,11 +389,10 @@ { XSelectInput (display->display, display->root, PropertyChangeMask); check_our_parents (); + rootwin_ev.start (display, display->root); } #endif - rootwin_ev.start (display, display->root); - XMapWindow (display->display, TermWin.vt); XMapWindow (display->display, TermWin.parent[0]); @@ -742,20 +770,23 @@ szHint.base_width = szHint.base_height = 2 * TermWin.int_bwidth; sb_w = mb_h = 0; - window_vt_x = window_vt_y = 0; + window_vt_x = window_vt_y = TermWin.int_bwidth; + if (scrollbar_visible ()) { sb_w = scrollbar_TotalWidth (); szHint.base_width += sb_w; - if (! (Options & Opt_scrollBar_right)) - window_vt_x = sb_w; + if (!(Options & Opt_scrollBar_right)) + window_vt_x += sb_w; } + if (menubar_visible ()) { mb_h = menuBar_TotalHeight (); szHint.base_height += mb_h; - window_vt_y = mb_h; + window_vt_y += mb_h; } + szHint.width_inc = TermWin.fwidth; szHint.height_inc = TermWin.fheight; szHint.min_width = szHint.base_width + szHint.width_inc; @@ -771,6 +802,7 @@ MIN_IT (TermWin.width, max_width); szHint.width = szHint.base_width + TermWin.width; } + if (height && height - szHint.base_height < max_height) { szHint.height = height; @@ -781,6 +813,7 @@ MIN_IT (TermWin.height, max_height); szHint.height = szHint.base_height + TermWin.height; } + if (scrollbar_visible () && (Options & Opt_scrollBar_right)) window_sb_x = szHint.width - sb_w; @@ -865,6 +898,9 @@ scr_touch (true); } + for (unicode_t ch = 0x20; ch <= 0x7f; ch++) + TermWin.ascii_map [ch - 0x20] = fs->find_font (ch); + return true; } } @@ -937,7 +973,7 @@ { /* bright colors */ i -= 8; # ifndef NO_BRIGHTCOLOR - PixColors[idx] = PixColors[minBrightCOLOR + i]; + PixColorsFocused[idx] = PixColorsFocused[minBrightCOLOR + i]; SET_PIXCOLOR (idx); goto Done; # endif @@ -945,7 +981,7 @@ } if (i >= 0 && i <= 7) { /* normal colors */ - PixColors[idx] = PixColors[minCOLOR + i]; + PixColorsFocused[idx] = PixColorsFocused[minCOLOR + i]; SET_PIXCOLOR (idx); goto Done; } @@ -954,7 +990,7 @@ if (!rXParseAllocColor (& xcol, color)) return; - /* XStoreColor (display->display, XCMAP, XColor*); */ + /* XStoreColor (display->display, display->cmap, XColor*); */ /* * FIXME: should free colors here, but no idea how to do it so instead, @@ -967,20 +1003,22 @@ if (i > Color_White) { /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */ - XFreeColors (display->display, XCMAP, (PixColors + idx), 1, + XFreeColors (display->display, display->cmap, (PixColors + idx), 1, DisplayPlanes (display->display, display->screen)); } # endif - PixColors[idx] = xcol; + PixColorsFocused[idx] = xcol; SET_PIXCOLOR (idx); /* XSetWindowAttributes attr; */ /* Cursor cursor; */ Done: +#ifdef OFF_FOCUS_FADING + PixColorsUnFocused[idx] = PixColorsFocused[idx].fade (display, atoi (rs[Rs_fade])); +#endif if (idx == Color_bg && ! (Options & Opt_transparent)) - XSetWindowBackground (display->display, TermWin.vt, - PixColors[Color_bg]); + XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]); /* handle Color_BD, scrollbar background, etc. */ @@ -998,9 +1036,9 @@ { XColor xcol[2]; - xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) ? PixColors[Color_pointer_fg] : PixColors[Color_fg]; - xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) ? PixColors[Color_pointer_bg] : PixColors[Color_bg]; - XQueryColors (display->display, XCMAP, xcol, 2); + xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) ? PixColorsFocused[Color_pointer_fg] : PixColorsFocused[Color_fg]; + xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) ? PixColorsFocused[Color_pointer_bg] : PixColorsFocused[Color_bg]; + XQueryColors (display->display, display->cmap, xcol, 2); XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1); } @@ -1081,6 +1119,7 @@ window_calc (width, height); XSetWMNormalHints (display->display, TermWin.parent[0], &szHint); + if (!ignoreparent) { #ifdef SMART_RESIZE @@ -1125,36 +1164,34 @@ XMoveResizeWindow (display->display, TermWin.parent[0], x + dx, y + dy, szHint.width, szHint.height); #else - XResizeWindow (display->display, TermWin.parent[0], szHint.width, - szHint.height); + XResizeWindow (display->display, TermWin.parent[0], szHint.width, szHint.height); #endif - } - fix_screen = (TermWin.ncol != prev_ncol - || TermWin.nrow != prev_nrow); + fix_screen = TermWin.ncol != prev_ncol || TermWin.nrow != prev_nrow; if (fix_screen || width != old_width || height != old_height) { if (scrollbar_visible ()) { - XMoveResizeWindow (display->display, scrollBar.win, window_sb_x, - 0, scrollbar_TotalWidth (), szHint.height); + XMoveResizeWindow (display->display, scrollBar.win, + window_sb_x, 0, + scrollbar_TotalWidth (), szHint.height); resize_scrollbar (); } if (menubar_visible ()) - XMoveResizeWindow (display->display, menuBar.win, window_vt_x, - 0, TermWin_TotalWidth (), menuBar_TotalHeight ()); - - XMoveResizeWindow (display->display, TermWin.vt, window_vt_x, - window_vt_y, TermWin_TotalWidth (), - TermWin_TotalHeight ()); - scr_clear (height != old_height); + XMoveResizeWindow (display->display, menuBar.win, + window_vt_x, 0, + TermWin_TotalWidth (), menuBar_TotalHeight ()); + + XMoveResizeWindow (display->display, TermWin.vt, + window_vt_x, window_vt_y, + TermWin_TotalWidth (), TermWin_TotalHeight ()); + scr_clear (); #ifdef XPM_BACKGROUND resize_pixmap (); #endif - } if (fix_screen || old_height == 0) @@ -1205,6 +1242,7 @@ if (height == 0) height = wattr.height - szHint.base_height; } + if (width != TermWin.width || height != TermWin.height) { width += szHint.base_width;