… | |
… | |
368 | { |
368 | { |
369 | for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++) |
369 | for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++) |
370 | (*t)->emergency_cleanup (); |
370 | (*t)->emergency_cleanup (); |
371 | } |
371 | } |
372 | |
372 | |
373 | #if ENABLE_FRILLS |
373 | #if !ENABLE_MINIMAL |
374 | static void |
374 | static void |
375 | print_x_error (Display *dpy, XErrorEvent *event) |
375 | print_x_error (Display *dpy, XErrorEvent *event) |
376 | { |
376 | { |
377 | char buffer[BUFSIZ]; |
377 | char buffer[BUFSIZ]; |
378 | char mesg[BUFSIZ]; |
378 | char mesg[BUFSIZ]; |
… | |
… | |
426 | GET_R->allowedxerror = event->error_code; |
426 | GET_R->allowedxerror = event->error_code; |
427 | else |
427 | else |
428 | { |
428 | { |
429 | // GET_R is most likely not the terminal which caused the error, |
429 | // GET_R is most likely not the terminal which caused the error, |
430 | // so just output the error and continue |
430 | // so just output the error and continue |
431 | #if ENABLE_FRILLS |
431 | #if ENABLE_MINIMAL |
|
|
432 | old_xerror_handler (display, event); |
|
|
433 | #else |
432 | print_x_error (display, event); |
434 | print_x_error (display, event); |
433 | #else |
|
|
434 | old_xerror_handler (display, event); |
|
|
435 | #endif |
435 | #endif |
436 | } |
436 | } |
437 | |
437 | |
438 | return 0; |
438 | return 0; |
439 | } |
439 | } |
… | |
… | |
514 | #if ENABLE_XEMBED |
514 | #if ENABLE_XEMBED |
515 | if (rs[Rs_embed]) |
515 | if (rs[Rs_embed]) |
516 | { |
516 | { |
517 | long info[2] = { 0, XEMBED_MAPPED }; |
517 | long info[2] = { 0, XEMBED_MAPPED }; |
518 | |
518 | |
519 | XChangeProperty (display->display, parent[0], xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], |
519 | XChangeProperty (xdisp, parent[0], xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], |
520 | 32, PropModeReplace, (unsigned char *)&info, 2); |
520 | 32, PropModeReplace, (unsigned char *)&info, 2); |
521 | } |
521 | } |
522 | #endif |
522 | #endif |
523 | |
523 | |
524 | XMapWindow (xdisp, vt); |
524 | XMapWindow (xdisp, vt); |
… | |
… | |
842 | return true; |
842 | return true; |
843 | } |
843 | } |
844 | |
844 | |
845 | void rxvt_term::set_string_property (Atom prop, const char *str, int len) |
845 | void rxvt_term::set_string_property (Atom prop, const char *str, int len) |
846 | { |
846 | { |
847 | XChangeProperty (display->display, parent[0], |
847 | XChangeProperty (xdisp, parent[0], |
848 | prop, XA_STRING, 8, PropModeReplace, |
848 | prop, XA_STRING, 8, PropModeReplace, |
849 | (const unsigned char *)str, len >= 0 ? len : strlen (str)); |
849 | (const unsigned char *)str, len >= 0 ? len : strlen (str)); |
850 | } |
850 | } |
851 | |
851 | |
852 | void rxvt_term::set_utf8_property (Atom prop, const char *str, int len) |
852 | void rxvt_term::set_utf8_property (Atom prop, const char *str, int len) |
853 | { |
853 | { |
854 | wchar_t *ws = rxvt_mbstowcs (str, len); |
854 | wchar_t *ws = rxvt_mbstowcs (str, len); |
855 | char *s = rxvt_wcstoutf8 (ws); |
855 | char *s = rxvt_wcstoutf8 (ws); |
856 | |
856 | |
857 | XChangeProperty (display->display, parent[0], |
857 | XChangeProperty (xdisp, parent[0], |
858 | prop, xa[XA_UTF8_STRING], 8, PropModeReplace, |
858 | prop, xa[XA_UTF8_STRING], 8, PropModeReplace, |
859 | (const unsigned char *)s, strlen (s)); |
859 | (const unsigned char *)s, strlen (s)); |
860 | |
860 | |
861 | free (s); |
861 | free (s); |
862 | free (ws); |
862 | free (ws); |
… | |
… | |
912 | SET_PIXCOLOR (idx); |
912 | SET_PIXCOLOR (idx); |
913 | goto done; |
913 | goto done; |
914 | } |
914 | } |
915 | } |
915 | } |
916 | |
916 | |
917 | if (!rXParseAllocColor (&xcol, color)) |
917 | if (!set_color (xcol, color)) |
918 | return; |
918 | return; |
919 | |
919 | |
920 | /* XStoreColor (display->display, display->cmap, XColor*); */ |
920 | /* XStoreColor (xdisp, display->cmap, XColor*); */ |
921 | |
921 | |
922 | /* |
922 | /* |
923 | * FIXME: should free colors here, but no idea how to do it so instead, |
923 | * FIXME: should free colors here, but no idea how to do it so instead, |
924 | * so just keep gobbling up the colormap |
924 | * so just keep gobbling up the colormap |
925 | */ |
925 | */ |
… | |
… | |
928 | if (pix_colors[idx] == pix_colors[i]) |
928 | if (pix_colors[idx] == pix_colors[i]) |
929 | break; |
929 | break; |
930 | if (i > Color_White) |
930 | if (i > Color_White) |
931 | { |
931 | { |
932 | /* fprintf (stderr, "XFreeColors: pix_colors [%d] = %lu\n", idx, pix_colors [idx]); */ |
932 | /* fprintf (stderr, "XFreeColors: pix_colors [%d] = %lu\n", idx, pix_colors [idx]); */ |
933 | XFreeColors (display->display, display->cmap, (pix_colors + idx), 1, |
933 | XFreeColors (xdisp, display->cmap, (pix_colors + idx), 1, |
934 | DisplayPlanes (display->display, display->screen)); |
934 | DisplayPlanes (xdisp, display->screen)); |
935 | } |
935 | } |
936 | # endif |
936 | # endif |
937 | |
937 | |
938 | pix_colors_focused[idx] = xcol; |
938 | pix_colors_focused[idx] = xcol; |
939 | SET_PIXCOLOR (idx); |
939 | SET_PIXCOLOR (idx); |
… | |
… | |
942 | /* Cursor cursor; */ |
942 | /* Cursor cursor; */ |
943 | done: |
943 | done: |
944 | |
944 | |
945 | #if OFF_FOCUS_FADING |
945 | #if OFF_FOCUS_FADING |
946 | if (rs[Rs_fade]) |
946 | if (rs[Rs_fade]) |
|
|
947 | { |
|
|
948 | rxvt_rgba c; |
|
|
949 | pix_colors [Color_fade].get (this, c); |
947 | pix_colors_unfocused[idx] = pix_colors_focused[idx].fade (this, atoi (rs[Rs_fade]), pix_colors[Color_fade]); |
950 | pix_colors_unfocused [idx] = pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), c); |
|
|
951 | } |
948 | #endif |
952 | #endif |
949 | |
953 | |
950 | /*TODO: handle Color_BD, scrollbar background, etc. */ |
954 | /*TODO: handle Color_BD, scrollbar background, etc. */ |
951 | |
955 | |
952 | recolour_cursor (); |
956 | recolour_cursor (); |
… | |
… | |
967 | : pix_colors_focused[Color_fg]; |
971 | : pix_colors_focused[Color_fg]; |
968 | xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) |
972 | xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) |
969 | ? pix_colors_focused[Color_pointer_bg] |
973 | ? pix_colors_focused[Color_pointer_bg] |
970 | : pix_colors_focused[Color_bg]; |
974 | : pix_colors_focused[Color_bg]; |
971 | |
975 | |
972 | XQueryColors (display->display, cmap, xcol, 2); |
976 | XQueryColors (xdisp, cmap, xcol, 2); |
973 | XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1); |
977 | XRecolorCursor (xdisp, TermWin_cursor, xcol + 0, xcol + 1); |
974 | } |
978 | } |
975 | |
979 | |
976 | /*----------------------------------------------------------------------*/ |
980 | /*----------------------------------------------------------------------*/ |
977 | /* |
981 | /* |
978 | * find if fg/bg matches any of the normal (low-intensity) colors |
982 | * find if fg/bg matches any of the normal (low-intensity) colors |
… | |
… | |
1006 | sprintf (env_colorfgbg, "COLORFGBG=%s;%s%s", fstr, xpmb, bstr); |
1010 | sprintf (env_colorfgbg, "COLORFGBG=%s;%s%s", fstr, xpmb, bstr); |
1007 | } |
1011 | } |
1008 | |
1012 | |
1009 | /*----------------------------------------------------------------------*/ |
1013 | /*----------------------------------------------------------------------*/ |
1010 | |
1014 | |
1011 | int |
1015 | bool |
1012 | rxvt_term::rXParseAllocColor (rxvt_color *screen_in_out, const char *colour) |
1016 | rxvt_term::set_color (rxvt_color &color, const char *name) |
1013 | { |
1017 | { |
1014 | if (!screen_in_out->set (this, colour)) |
1018 | if (color.set (this, name)) |
1015 | { |
|
|
1016 | rxvt_warn ("can't get colour '%s', continuing without.\n", colour); |
|
|
1017 | return false; |
|
|
1018 | } |
|
|
1019 | |
|
|
1020 | return true; |
1019 | return true; |
|
|
1020 | |
|
|
1021 | rxvt_warn ("can't get colour '%s', continuing without.\n", name); |
|
|
1022 | return false; |
1021 | } |
1023 | } |
1022 | |
1024 | |
1023 | /* -------------------------------------------------------------------- * |
1025 | /* -------------------------------------------------------------------- * |
1024 | * - WINDOW RESIZING - * |
1026 | * - WINDOW RESIZING - * |
1025 | * -------------------------------------------------------------------- */ |
1027 | * -------------------------------------------------------------------- */ |
… | |
… | |
1125 | { |
1127 | { |
1126 | XWindowAttributes wattr; |
1128 | XWindowAttributes wattr; |
1127 | |
1129 | |
1128 | if (newwidth == 0 || newheight == 0) |
1130 | if (newwidth == 0 || newheight == 0) |
1129 | { |
1131 | { |
1130 | XGetWindowAttributes (display->display, display->root, &wattr); |
1132 | XGetWindowAttributes (xdisp, display->root, &wattr); |
1131 | |
1133 | |
1132 | if (newwidth == 0) |
1134 | if (newwidth == 0) |
1133 | newwidth = wattr.width - szHint.base_width; |
1135 | newwidth = wattr.width - szHint.base_width; |
1134 | if (newheight == 0) |
1136 | if (newheight == 0) |
1135 | newheight = wattr.height - szHint.base_height; |
1137 | newheight = wattr.height - szHint.base_height; |
… | |
… | |
1197 | strncat (server, & (p[4]), IMBUFSIZ - 9); /* skip "@im=" */ |
1199 | strncat (server, & (p[4]), IMBUFSIZ - 9); /* skip "@im=" */ |
1198 | |
1200 | |
1199 | if ((p = strchr (server + 1, '@')) != NULL) /* first one only */ |
1201 | if ((p = strchr (server + 1, '@')) != NULL) /* first one only */ |
1200 | *p = '\0'; |
1202 | *p = '\0'; |
1201 | |
1203 | |
1202 | atom = XInternAtom (display->display, server, False); |
1204 | atom = XInternAtom (xdisp, server, False); |
1203 | win = XGetSelectionOwner (display->display, atom); |
1205 | win = XGetSelectionOwner (xdisp, atom); |
1204 | |
1206 | |
1205 | if (win != None) |
1207 | if (win != None) |
1206 | return True; |
1208 | return True; |
1207 | } |
1209 | } |
1208 | |
1210 | |
… | |
… | |
1432 | "*", |
1434 | "*", |
1433 | fheight, |
1435 | fheight, |
1434 | fheight + 1, fheight - 1, |
1436 | fheight + 1, fheight - 1, |
1435 | fheight - 2, fheight + 2); |
1437 | fheight - 2, fheight + 2); |
1436 | |
1438 | |
1437 | fs = XCreateFontSet (display->display, rs[Rs_imFont] ? rs[Rs_imFont] : pat, |
1439 | fs = XCreateFontSet (xdisp, rs[Rs_imFont] ? rs[Rs_imFont] : pat, |
1438 | &missing_charset_list, &missing_charset_count, &def_string); |
1440 | &missing_charset_list, &missing_charset_count, &def_string); |
1439 | |
1441 | |
1440 | if (missing_charset_list) |
1442 | if (missing_charset_list) |
1441 | XFreeStringList (missing_charset_list); |
1443 | XFreeStringList (missing_charset_list); |
1442 | |
1444 | |
… | |
… | |
1518 | status_attr ? XNStatusAttributes : NULL, |
1520 | status_attr ? XNStatusAttributes : NULL, |
1519 | status_attr, NULL); |
1521 | status_attr, NULL); |
1520 | |
1522 | |
1521 | if (preedit_attr) XFree (preedit_attr); |
1523 | if (preedit_attr) XFree (preedit_attr); |
1522 | if (status_attr) XFree (status_attr); |
1524 | if (status_attr) XFree (status_attr); |
1523 | if (fs) XFreeFontSet (display->display, fs); |
1525 | if (fs) XFreeFontSet (xdisp, fs); |
1524 | |
1526 | |
1525 | if (Input_Context == NULL) |
1527 | if (Input_Context == NULL) |
1526 | { |
1528 | { |
1527 | rxvt_warn ("failed to create input context, continuing without XIM.\n"); |
1529 | rxvt_warn ("failed to create input context, continuing without XIM.\n"); |
1528 | im_destroy (); |
1530 | im_destroy (); |