--- rxvt-unicode/src/main.C 2006/01/25 00:57:57 1.201 +++ rxvt-unicode/src/main.C 2006/01/25 21:03:04 1.206 @@ -218,43 +218,43 @@ if (display) { - dDisp; - selection_clear (); #ifdef USE_XIM im_destroy (); #endif #ifdef XTERM_SCROLLBAR - if (xscrollbarGC) XFreeGC (disp, xscrollbarGC); - if (ShadowGC) XFreeGC (disp, ShadowGC); + if (xscrollbarGC) XFreeGC (xdisp, xscrollbarGC); + if (ShadowGC) XFreeGC (xdisp, ShadowGC); #endif #ifdef PLAIN_SCROLLBAR - if (pscrollbarGC) XFreeGC (disp, pscrollbarGC); + if (pscrollbarGC) XFreeGC (xdisp, pscrollbarGC); #endif #ifdef NEXT_SCROLLBAR - if (blackGC) XFreeGC (disp, blackGC); - if (whiteGC) XFreeGC (disp, whiteGC); - if (grayGC) XFreeGC (disp, grayGC); - if (darkGC) XFreeGC (disp, darkGC); - if (stippleGC) XFreeGC (disp, stippleGC); - if (dimple) XFreePixmap (disp, dimple); - if (upArrow) XFreePixmap (disp, upArrow); - if (downArrow) XFreePixmap (disp, downArrow); - if (upArrowHi) XFreePixmap (disp, upArrowHi); - if (downArrowHi) XFreePixmap (disp, downArrowHi); + if (blackGC) XFreeGC (xdisp, blackGC); + if (whiteGC) XFreeGC (xdisp, whiteGC); + if (grayGC) XFreeGC (xdisp, grayGC); + if (darkGC) XFreeGC (xdisp, darkGC); + if (stippleGC) XFreeGC (xdisp, stippleGC); + if (dimple) XFreePixmap (xdisp, dimple); + if (upArrow) XFreePixmap (xdisp, upArrow); + if (downArrow) XFreePixmap (xdisp, downArrow); + if (upArrowHi) XFreePixmap (xdisp, upArrowHi); + if (downArrowHi) XFreePixmap (xdisp, downArrowHi); #endif #ifdef RXVT_SCROLLBAR - if (topShadowGC) XFreeGC (disp, topShadowGC); - if (botShadowGC) XFreeGC (disp, botShadowGC); - if (scrollbarGC) XFreeGC (disp, scrollbarGC); + if (topShadowGC) XFreeGC (xdisp, topShadowGC); + if (botShadowGC) XFreeGC (xdisp, botShadowGC); + if (scrollbarGC) XFreeGC (xdisp, scrollbarGC); #endif - if (gc) XFreeGC (disp, gc); + if (gc) XFreeGC (xdisp, gc); delete drawable; // destroy all windows if (parent[0]) - XDestroyWindow (disp, parent[0]); + XDestroyWindow (xdisp, parent[0]); + + clear (); } // TODO: free pixcolours, colours should become part of rxvt_display @@ -273,10 +273,8 @@ free (selection.text); // TODO: manage env vars in child only(!) - free (env_windowid); free (env_display); free (env_term); - free (env_colorfgbg); free (locale); free (v_buffer); free (incr_buf); @@ -479,14 +477,12 @@ create_windows (argc, argv); - dDisp; - init_xlocale (); scr_reset (); // initialize screen #if 0 - XSynchronize (disp, True); + XSynchronize (xdisp, True); #endif #ifdef HAVE_SCROLLBARS @@ -496,7 +492,7 @@ #ifdef TRANSPARENT if (OPTION (Opt_transparent)) { - XSelectInput (disp, display->root, PropertyChangeMask); + XSelectInput (xdisp, display->root, PropertyChangeMask); check_our_parents (); rootwin_ev.start (display, display->root); } @@ -515,8 +511,18 @@ HOOK_INVOKE ((this, HOOK_START, DT_END)); - XMapWindow (disp, vt); - XMapWindow (disp, parent[0]); +#if ENABLE_XEMBED + if (rs[Rs_embed]) + { + long info[2] = { 0, XEMBED_MAPPED }; + + XChangeProperty (display->display, parent[0], xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], + 32, PropModeReplace, (unsigned char *)&info, 2); + } +#endif + + XMapWindow (xdisp, vt); + XMapWindow (xdisp, parent[0]); return true; } @@ -616,7 +622,6 @@ int x, y, sb_w, flags; unsigned int w, h; unsigned int max_width, max_height; - dDisp; szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; szHint.win_gravity = NorthWestGravity; @@ -723,9 +728,10 @@ window_sb_x = szHint.width - sb_w; if (recalc_x) - szHint.x += DisplayWidth (disp, display->screen) - szHint.width - 2 * ext_bwidth; + szHint.x += DisplayWidth (xdisp, display->screen) - szHint.width - 2 * ext_bwidth; + if (recalc_y) - szHint.y += DisplayHeight (disp, display->screen) - szHint.height - 2 * ext_bwidth; + szHint.y += DisplayHeight (xdisp, display->screen) - szHint.height - 2 * ext_bwidth; ncol = width / fwidth; nrow = height / fheight; @@ -938,7 +944,7 @@ #if OFF_FOCUS_FADING if (rs[Rs_fade]) - pix_colors_unfocused[idx] = pix_colors_focused[idx].fade (display, atoi (rs[Rs_fade]), pix_colors[Color_fade]); + pix_colors_unfocused[idx] = pix_colors_focused[idx].fade (this, atoi (rs[Rs_fade]), pix_colors[Color_fade]); #endif /*TODO: handle Color_BD, scrollbar background, etc. */ @@ -963,7 +969,7 @@ ? pix_colors_focused[Color_pointer_bg] : pix_colors_focused[Color_bg]; - XQueryColors (display->display, display->cmap, xcol, 2); + XQueryColors (display->display, cmap, xcol, 2); XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1); } @@ -978,7 +984,6 @@ const char *xpmb = "\0"; char fstr[sizeof ("default") + 1], bstr[sizeof ("default") + 1]; - env_colorfgbg = (char *)rxvt_malloc (sizeof ("COLORFGBG=default;default;bg") + 1); strcpy (fstr, "default"); strcpy (bstr, "default"); for (i = Color_Black; i <= Color_White; i++) @@ -1006,7 +1011,7 @@ int rxvt_term::rXParseAllocColor (rxvt_color *screen_in_out, const char *colour) { - if (!screen_in_out->set (display, colour)) + if (!screen_in_out->set (this, colour)) { rxvt_warn ("can't get colour '%s', continuing without.\n", colour); return false; @@ -1024,10 +1029,9 @@ int fix_screen; int old_width = szHint.width; int old_height = szHint.height; - dDisp; window_calc (newwidth, newheight); - XSetWMNormalHints (disp, parent[0], &szHint); + XSetWMNormalHints (xdisp, parent[0], &szHint); if (!ignoreparent) { @@ -1041,9 +1045,9 @@ unsigned int unused_w1, unused_h1, unused_b1, unused_d1; Window unused_cr; - XTranslateCoordinates (disp, parent[0], display->root, + XTranslateCoordinates (xdisp, parent[0], display->root, 0, 0, &x, &y, &unused_cr); - XGetGeometry (disp, parent[0], &unused_cr, &x1, &y1, + XGetGeometry (xdisp, parent[0], &unused_cr, &x1, &y1, &unused_w1, &unused_h1, &unused_b1, &unused_d1); /* * if display->root isn't the parent window, a WM will probably have offset @@ -1055,8 +1059,8 @@ y -= y1; } - x1 = (DisplayWidth (disp, display->screen) - old_width ) / 2; - y1 = (DisplayHeight (disp, display->screen) - old_height) / 2; + x1 = (DisplayWidth (xdisp, display->screen) - old_width ) / 2; + y1 = (DisplayHeight (xdisp, display->screen) - old_height) / 2; dx = old_width - szHint.width; dy = old_height - szHint.height; @@ -1070,10 +1074,10 @@ else if (y == y1) /* exact center */ dy /= 2; - XMoveResizeWindow (disp, parent[0], x + dx, y + dy, + XMoveResizeWindow (xdisp, parent[0], x + dx, y + dy, szHint.width, szHint.height); #else - XResizeWindow (disp, parent[0], szHint.width, szHint.height); + XResizeWindow (xdisp, parent[0], szHint.width, szHint.height); #endif } @@ -1083,13 +1087,13 @@ { if (scrollBar.state) { - XMoveResizeWindow (disp, scrollBar.win, + XMoveResizeWindow (xdisp, scrollBar.win, window_sb_x, 0, scrollbar_TotalWidth (), szHint.height); resize_scrollbar (); } - XMoveResizeWindow (disp, vt, + XMoveResizeWindow (xdisp, vt, window_vt_x, window_vt_y, width, height); @@ -1213,7 +1217,7 @@ if (!Input_Context || !focus - || !(input_style & XIMPreeditPosition)) + || !(input_style & (XIMPreeditPosition | XIMPreeditCallbacks))) return; im_set_position (nspot); @@ -1481,24 +1485,29 @@ XNFontSet, fs, NULL); } +#if ENABLE_XIM_ONTHESPOT else if (input_style & XIMPreeditCallbacks) { + im_set_position (spot); + xcb[0].client_data = (XPointer)this; xcb[0].callback = (XIMProc)xim_preedit_start; xcb[1].client_data = (XPointer)this; xcb[1].callback = (XIMProc)xim_preedit_done; xcb[2].client_data = (XPointer)this; xcb[2].callback = (XIMProc)xim_preedit_draw; -#if 0 +# if 0 xcb[3].client_data = (XPointer)this; xcb[3].callback = (XIMProc)xim_preedit_caret; -#endif +# endif preedit_attr = XVaCreateNestedList (0, + XNSpotLocation, &spot, XNPreeditStartCallback, &xcb[0], XNPreeditDoneCallback , &xcb[1], XNPreeditDrawCallback , &xcb[2], -#if 0 +# if 0 XNPreeditCaretCallback, &xcb[3], -#endif +# endif NULL); } +#endif Input_Context = XCreateIC (xim, XNInputStyle, input_style,