… | |
… | |
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] && !rs[Rs_embed]) |
257 | if (TermWin.parent[0]) |
259 | XDestroyWindow (disp, TermWin.parent[0]); |
258 | XDestroyWindow (disp, TermWin.parent[0]); |
260 | } |
259 | } |
261 | |
260 | |
262 | // TODO: free pixcolours, colours should become part of rxvt_display |
261 | // TODO: free pixcolours, colours should become part of rxvt_display |
263 | |
262 | |
264 | delete pix_colors_focused; |
263 | delete pix_colors_focused; |
265 | #ifdef OFF_FOCUS_FADING |
264 | #if OFF_FOCUS_FADING |
266 | delete pix_colors_unfocused; |
265 | delete pix_colors_unfocused; |
267 | #endif |
266 | #endif |
268 | |
267 | |
269 | displays.put (display); |
268 | displays.put (display); |
270 | |
269 | |
… | |
… | |
418 | { |
417 | { |
419 | if (GET_R->allowedxerror == -1) |
418 | if (GET_R->allowedxerror == -1) |
420 | GET_R->allowedxerror = event->error_code; |
419 | GET_R->allowedxerror = event->error_code; |
421 | else |
420 | else |
422 | { |
421 | { |
423 | //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, |
424 | //TODO: maybe just output the error and continue? |
423 | // so just output the error and continue |
425 | #if ENABLE_FRILLS |
424 | #if ENABLE_FRILLS |
426 | print_x_error (display, event); |
425 | print_x_error (display, event); |
427 | #else |
426 | #else |
428 | old_xerror_handler (display, event); |
427 | old_xerror_handler (display, event); |
429 | #endif |
428 | #endif |
… | |
… | |
586 | rxvt_fatal ("memory allocation failure. aborting.\n"); |
585 | rxvt_fatal ("memory allocation failure. aborting.\n"); |
587 | |
586 | |
588 | return p; |
587 | return p; |
589 | } |
588 | } |
590 | |
589 | |
591 | /* INTPROTO */ |
|
|
592 | void * |
590 | void * |
593 | rxvt_calloc (size_t number, size_t size) |
591 | rxvt_calloc (size_t number, size_t size) |
594 | { |
592 | { |
595 | void *p = calloc (number, size); |
593 | void *p = calloc (number, size); |
596 | |
594 | |
… | |
… | |
598 | rxvt_fatal ("memory allocation failure. aborting.\n"); |
596 | rxvt_fatal ("memory allocation failure. aborting.\n"); |
599 | |
597 | |
600 | return p; |
598 | return p; |
601 | } |
599 | } |
602 | |
600 | |
603 | /* INTPROTO */ |
|
|
604 | void * |
601 | void * |
605 | rxvt_realloc (void *ptr, size_t size) |
602 | rxvt_realloc (void *ptr, size_t size) |
606 | { |
603 | { |
607 | void *p = realloc (ptr, size); |
604 | void *p = realloc (ptr, size); |
608 | |
605 | |
… | |
… | |
844 | (void)ioctl (pty.pty, TIOCSWINSZ, &ws); |
841 | (void)ioctl (pty.pty, TIOCSWINSZ, &ws); |
845 | |
842 | |
846 | #if 0 |
843 | #if 0 |
847 | // TIOCSWINSZ⎈ is supposed to do this automatically and correctly |
844 | // TIOCSWINSZ⎈ is supposed to do this automatically and correctly |
848 | if (cmd_pid) /* force through to the command */ |
845 | if (cmd_pid) /* force through to the command */ |
849 | kill (cmd_pid, SIGWINCH); |
846 | kill (-cmd_pid, SIGWINCH); |
850 | #endif |
847 | #endif |
851 | } |
848 | } |
852 | |
849 | |
853 | /*----------------------------------------------------------------------*/ |
850 | /*----------------------------------------------------------------------*/ |
854 | /* set_fonts () - load and set the various fonts |
851 | /* set_fonts () - load and set the various fonts |
… | |
… | |
958 | /* xterm sequences - title, iconName, color (exptl) */ |
955 | /* xterm sequences - title, iconName, color (exptl) */ |
959 | void |
956 | void |
960 | rxvt_term::set_title (const char *str) |
957 | rxvt_term::set_title (const char *str) |
961 | { |
958 | { |
962 | set_string_property (XA_WM_NAME, str); |
959 | set_string_property (XA_WM_NAME, str); |
963 | #if ENABLE_FRILLS |
960 | #if ENABLE_EWMH |
964 | set_utf8_property (xa[XA_NET_WM_NAME], str); |
961 | set_utf8_property (xa[XA_NET_WM_NAME], str); |
965 | #endif |
962 | #endif |
966 | } |
963 | } |
967 | |
964 | |
968 | void |
965 | void |
969 | rxvt_term::set_icon_name (const char *str) |
966 | rxvt_term::set_icon_name (const char *str) |
970 | { |
967 | { |
971 | set_string_property (XA_WM_ICON_NAME, str); |
968 | set_string_property (XA_WM_ICON_NAME, str); |
972 | #if ENABLE_FRILLS |
969 | #if ENABLE_EWMH |
973 | set_utf8_property (xa[XA_NET_WM_ICON_NAME], str); |
970 | set_utf8_property (xa[XA_NET_WM_ICON_NAME], str); |
974 | #endif |
971 | #endif |
975 | } |
972 | } |
976 | |
973 | |
977 | #ifdef XTERM_COLOR_CHANGE |
974 | #ifdef XTERM_COLOR_CHANGE |
… | |
… | |
993 | { /* bright colors */ |
990 | { /* bright colors */ |
994 | i -= 8; |
991 | i -= 8; |
995 | # ifndef NO_BRIGHTCOLOR |
992 | # ifndef NO_BRIGHTCOLOR |
996 | pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i]; |
993 | pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i]; |
997 | SET_PIXCOLOR (idx); |
994 | SET_PIXCOLOR (idx); |
998 | goto Done; |
995 | goto done; |
999 | # endif |
996 | # endif |
1000 | } |
997 | } |
1001 | |
998 | |
1002 | if (i >= 0 && i <= 7) |
999 | if (i >= 0 && i <= 7) |
1003 | { /* normal colors */ |
1000 | { /* normal colors */ |
1004 | pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i]; |
1001 | pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i]; |
1005 | SET_PIXCOLOR (idx); |
1002 | SET_PIXCOLOR (idx); |
1006 | goto Done; |
1003 | goto done; |
1007 | } |
1004 | } |
1008 | } |
1005 | } |
1009 | |
1006 | |
1010 | if (!rXParseAllocColor (&xcol, color)) |
1007 | if (!rXParseAllocColor (&xcol, color)) |
1011 | return; |
1008 | return; |
… | |
… | |
1031 | pix_colors_focused[idx] = xcol; |
1028 | pix_colors_focused[idx] = xcol; |
1032 | SET_PIXCOLOR (idx); |
1029 | SET_PIXCOLOR (idx); |
1033 | |
1030 | |
1034 | /* XSetWindowAttributes attr; */ |
1031 | /* XSetWindowAttributes attr; */ |
1035 | /* Cursor cursor; */ |
1032 | /* Cursor cursor; */ |
1036 | Done: |
1033 | done: |
|
|
1034 | |
1037 | #ifdef OFF_FOCUS_FADING |
1035 | #if OFF_FOCUS_FADING |
1038 | if (rs[Rs_fade]) |
1036 | if (rs[Rs_fade]) |
1039 | 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]); |
1040 | #endif |
1038 | #endif |
1041 | |
1039 | |
1042 | /*TODO: handle Color_BD, scrollbar background, etc. */ |
1040 | /*TODO: handle Color_BD, scrollbar background, etc. */ |
1043 | |
1041 | |
1044 | recolour_cursor (); |
1042 | recolour_cursor (); |
… | |
… | |
1249 | XWindowAttributes wattr; |
1247 | XWindowAttributes wattr; |
1250 | |
1248 | |
1251 | if (width == 0 || height == 0) |
1249 | if (width == 0 || height == 0) |
1252 | { |
1250 | { |
1253 | XGetWindowAttributes (display->display, display->root, &wattr); |
1251 | XGetWindowAttributes (display->display, display->root, &wattr); |
|
|
1252 | |
1254 | if (width == 0) |
1253 | if (width == 0) |
1255 | width = wattr.width - szHint.base_width; |
1254 | width = wattr.width - szHint.base_width; |
1256 | if (height == 0) |
1255 | if (height == 0) |
1257 | height = wattr.height - szHint.base_height; |
1256 | height = wattr.height - szHint.base_height; |
1258 | } |
1257 | } |