… | |
… | |
30 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
30 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
31 | *---------------------------------------------------------------------*/ |
31 | *---------------------------------------------------------------------*/ |
32 | |
32 | |
33 | #include "../config.h" /* NECESSARY */ |
33 | #include "../config.h" /* NECESSARY */ |
34 | #include "rxvt.h" /* NECESSARY */ |
34 | #include "rxvt.h" /* NECESSARY */ |
35 | #include "main.intpro" /* PROTOS for internal routines */ |
|
|
36 | |
35 | |
37 | #include <csignal> |
36 | #include <csignal> |
38 | #include <cstring> |
37 | #include <cstring> |
39 | |
38 | |
40 | #ifdef TTY_GID_SUPPORT |
39 | #ifdef TTY_GID_SUPPORT |
… | |
… | |
253 | //if (menuBar.win) |
252 | //if (menuBar.win) |
254 | // XDestroyWindow (disp, menuBar.win); |
253 | // XDestroyWindow (disp, menuBar.win); |
255 | #endif |
254 | #endif |
256 | delete TermWin.drawable; |
255 | delete TermWin.drawable; |
257 | // destroy all windows |
256 | // destroy all windows |
258 | if (TermWin.parent[0] |
257 | if (TermWin.parent[0]) |
259 | #if ENABLE_FRILLS |
|
|
260 | && !rs[Rs_embed] |
|
|
261 | #endif |
|
|
262 | ) |
|
|
263 | XDestroyWindow (disp, TermWin.parent[0]); |
258 | XDestroyWindow (disp, TermWin.parent[0]); |
264 | } |
259 | } |
265 | |
260 | |
266 | // TODO: free pixcolours, colours should become part of rxvt_display |
261 | // TODO: free pixcolours, colours should become part of rxvt_display |
267 | |
262 | |
268 | delete pix_colors_focused; |
263 | delete pix_colors_focused; |
269 | #ifdef OFF_FOCUS_FADING |
264 | #if OFF_FOCUS_FADING |
270 | delete pix_colors_unfocused; |
265 | delete pix_colors_unfocused; |
271 | #endif |
266 | #endif |
272 | |
267 | |
273 | displays.put (display); |
268 | displays.put (display); |
274 | |
269 | |
… | |
… | |
422 | { |
417 | { |
423 | if (GET_R->allowedxerror == -1) |
418 | if (GET_R->allowedxerror == -1) |
424 | GET_R->allowedxerror = event->error_code; |
419 | GET_R->allowedxerror = event->error_code; |
425 | else |
420 | else |
426 | { |
421 | { |
427 | //TODO: GET_R is most likely not the terminal which caused the error |
422 | // GET_R is most likely not the terminal which caused the error, |
428 | //TODO: maybe just output the error and continue? |
423 | // so just output the error and continue |
429 | #if ENABLE_FRILLS |
424 | #if ENABLE_FRILLS |
430 | print_x_error (display, event); |
425 | print_x_error (display, event); |
431 | #else |
426 | #else |
432 | old_xerror_handler (display, event); |
427 | old_xerror_handler (display, event); |
433 | #endif |
428 | #endif |
… | |
… | |
590 | rxvt_fatal ("memory allocation failure. aborting.\n"); |
585 | rxvt_fatal ("memory allocation failure. aborting.\n"); |
591 | |
586 | |
592 | return p; |
587 | return p; |
593 | } |
588 | } |
594 | |
589 | |
595 | /* INTPROTO */ |
|
|
596 | void * |
590 | void * |
597 | rxvt_calloc (size_t number, size_t size) |
591 | rxvt_calloc (size_t number, size_t size) |
598 | { |
592 | { |
599 | void *p = calloc (number, size); |
593 | void *p = calloc (number, size); |
600 | |
594 | |
… | |
… | |
602 | rxvt_fatal ("memory allocation failure. aborting.\n"); |
596 | rxvt_fatal ("memory allocation failure. aborting.\n"); |
603 | |
597 | |
604 | return p; |
598 | return p; |
605 | } |
599 | } |
606 | |
600 | |
607 | /* INTPROTO */ |
|
|
608 | void * |
601 | void * |
609 | rxvt_realloc (void *ptr, size_t size) |
602 | rxvt_realloc (void *ptr, size_t size) |
610 | { |
603 | { |
611 | void *p = realloc (ptr, size); |
604 | void *p = realloc (ptr, size); |
612 | |
605 | |
… | |
… | |
848 | (void)ioctl (pty.pty, TIOCSWINSZ, &ws); |
841 | (void)ioctl (pty.pty, TIOCSWINSZ, &ws); |
849 | |
842 | |
850 | #if 0 |
843 | #if 0 |
851 | // TIOCSWINSZ⎈ is supposed to do this automatically and correctly |
844 | // TIOCSWINSZ⎈ is supposed to do this automatically and correctly |
852 | if (cmd_pid) /* force through to the command */ |
845 | if (cmd_pid) /* force through to the command */ |
853 | kill (cmd_pid, SIGWINCH); |
846 | kill (-cmd_pid, SIGWINCH); |
854 | #endif |
847 | #endif |
855 | } |
848 | } |
856 | |
849 | |
857 | /*----------------------------------------------------------------------*/ |
850 | /*----------------------------------------------------------------------*/ |
858 | /* set_fonts () - load and set the various fonts |
851 | /* set_fonts () - load and set the various fonts |
859 | /* |
852 | * |
860 | * init = 1 - initialize |
853 | * init = 1 - initialize |
861 | * |
854 | * |
862 | * fontname == FONT_UP - switch to bigger font |
855 | * fontname == FONT_UP - switch to bigger font |
863 | * fontname == FONT_DN - switch to smaller font |
856 | * fontname == FONT_DN - switch to smaller font |
864 | */ |
857 | */ |
… | |
… | |
962 | /* xterm sequences - title, iconName, color (exptl) */ |
955 | /* xterm sequences - title, iconName, color (exptl) */ |
963 | void |
956 | void |
964 | rxvt_term::set_title (const char *str) |
957 | rxvt_term::set_title (const char *str) |
965 | { |
958 | { |
966 | set_string_property (XA_WM_NAME, str); |
959 | set_string_property (XA_WM_NAME, str); |
967 | #if ENABLE_FRILLS |
960 | #if ENABLE_EWMH |
968 | set_utf8_property (xa[XA_NET_WM_NAME], str); |
961 | set_utf8_property (xa[XA_NET_WM_NAME], str); |
969 | #endif |
962 | #endif |
970 | } |
963 | } |
971 | |
964 | |
972 | void |
965 | void |
973 | rxvt_term::set_icon_name (const char *str) |
966 | rxvt_term::set_icon_name (const char *str) |
974 | { |
967 | { |
975 | set_string_property (XA_WM_ICON_NAME, str); |
968 | set_string_property (XA_WM_ICON_NAME, str); |
976 | #if ENABLE_FRILLS |
969 | #if ENABLE_EWMH |
977 | set_utf8_property (xa[XA_NET_WM_ICON_NAME], str); |
970 | set_utf8_property (xa[XA_NET_WM_ICON_NAME], str); |
978 | #endif |
971 | #endif |
979 | } |
972 | } |
980 | |
973 | |
981 | #ifdef XTERM_COLOR_CHANGE |
974 | #ifdef XTERM_COLOR_CHANGE |
… | |
… | |
997 | { /* bright colors */ |
990 | { /* bright colors */ |
998 | i -= 8; |
991 | i -= 8; |
999 | # ifndef NO_BRIGHTCOLOR |
992 | # ifndef NO_BRIGHTCOLOR |
1000 | pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i]; |
993 | pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i]; |
1001 | SET_PIXCOLOR (idx); |
994 | SET_PIXCOLOR (idx); |
1002 | goto Done; |
995 | goto done; |
1003 | # endif |
996 | # endif |
1004 | } |
997 | } |
1005 | |
998 | |
1006 | if (i >= 0 && i <= 7) |
999 | if (i >= 0 && i <= 7) |
1007 | { /* normal colors */ |
1000 | { /* normal colors */ |
1008 | pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i]; |
1001 | pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i]; |
1009 | SET_PIXCOLOR (idx); |
1002 | SET_PIXCOLOR (idx); |
1010 | goto Done; |
1003 | goto done; |
1011 | } |
1004 | } |
1012 | } |
1005 | } |
1013 | |
1006 | |
1014 | if (!rXParseAllocColor (&xcol, color)) |
1007 | if (!rXParseAllocColor (&xcol, color)) |
1015 | return; |
1008 | return; |
… | |
… | |
1035 | pix_colors_focused[idx] = xcol; |
1028 | pix_colors_focused[idx] = xcol; |
1036 | SET_PIXCOLOR (idx); |
1029 | SET_PIXCOLOR (idx); |
1037 | |
1030 | |
1038 | /* XSetWindowAttributes attr; */ |
1031 | /* XSetWindowAttributes attr; */ |
1039 | /* Cursor cursor; */ |
1032 | /* Cursor cursor; */ |
1040 | Done: |
1033 | done: |
|
|
1034 | |
1041 | #ifdef OFF_FOCUS_FADING |
1035 | #if OFF_FOCUS_FADING |
1042 | if (rs[Rs_fade]) |
1036 | if (rs[Rs_fade]) |
1043 | pix_colors_unfocused[idx] = pix_colors_focused[idx].fade (display, atoi (rs[Rs_fade])); |
1037 | pix_colors_unfocused[idx] = pix_colors_focused[idx].fade (display, atoi (rs[Rs_fade]), pix_colors[Color_fade]); |
1044 | #endif |
1038 | #endif |
1045 | |
1039 | |
1046 | /*TODO: handle Color_BD, scrollbar background, etc. */ |
1040 | /*TODO: handle Color_BD, scrollbar background, etc. */ |
1047 | |
1041 | |
1048 | recolour_cursor (); |
1042 | recolour_cursor (); |
… | |
… | |
1253 | XWindowAttributes wattr; |
1247 | XWindowAttributes wattr; |
1254 | |
1248 | |
1255 | if (width == 0 || height == 0) |
1249 | if (width == 0 || height == 0) |
1256 | { |
1250 | { |
1257 | XGetWindowAttributes (display->display, display->root, &wattr); |
1251 | XGetWindowAttributes (display->display, display->root, &wattr); |
|
|
1252 | |
1258 | if (width == 0) |
1253 | if (width == 0) |
1259 | width = wattr.width - szHint.base_width; |
1254 | width = wattr.width - szHint.base_width; |
1260 | if (height == 0) |
1255 | if (height == 0) |
1261 | height = wattr.height - szHint.base_height; |
1256 | height = wattr.height - szHint.base_height; |
1262 | } |
1257 | } |
… | |
… | |
1556 | } |
1551 | } |
1557 | |
1552 | |
1558 | void |
1553 | void |
1559 | rxvt_term::im_cb () |
1554 | rxvt_term::im_cb () |
1560 | { |
1555 | { |
1561 | int i, found, had_im; |
1556 | int i; |
1562 | const char *p; |
1557 | const char *p; |
1563 | char **s; |
1558 | char **s; |
1564 | char buf[IMBUFSIZ]; |
1559 | char buf[IMBUFSIZ]; |
1565 | |
1560 | |
1566 | SET_R (this); |
1561 | SET_R (this); |