… | |
… | |
10 | * Copyright (c) 1996 Chuck Blake <cblake@BBN.COM> |
10 | * Copyright (c) 1996 Chuck Blake <cblake@BBN.COM> |
11 | * Copyright (c) 1997 mj olesen <olesen@me.queensu.ca> |
11 | * Copyright (c) 1997 mj olesen <olesen@me.queensu.ca> |
12 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
12 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
13 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
13 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
14 | * - extensive modifications |
14 | * - extensive modifications |
15 | * Copyright (c) 2003-2008 Marc Lehmann <pcg@goof.com> |
15 | * Copyright (c) 2003-2008 Marc Lehmann <schmorp@schmorp.de> |
16 | * |
16 | * |
17 | * This program is free software; you can redistribute it and/or modify |
17 | * This program is free software; you can redistribute it and/or modify |
18 | * it under the terms of the GNU General Public License as published by |
18 | * it under the terms of the GNU General Public License as published by |
19 | * the Free Software Foundation; either version 2 of the License, or |
19 | * the Free Software Foundation; either version 2 of the License, or |
20 | * (at your option) any later version. |
20 | * (at your option) any later version. |
… | |
… | |
143 | |
143 | |
144 | return rval; |
144 | return rval; |
145 | } |
145 | } |
146 | #endif |
146 | #endif |
147 | |
147 | |
148 | const char *const def_colorName[] = |
148 | static const char *const def_colorName[] = |
149 | { |
149 | { |
150 | COLOR_FOREGROUND, |
150 | COLOR_FOREGROUND, |
151 | COLOR_BACKGROUND, |
151 | COLOR_BACKGROUND, |
152 | /* low-intensity colors */ |
152 | /* low-intensity colors */ |
153 | "rgb:00/00/00", // 0: black (Black) |
153 | "rgb:00/00/00", // 0: black (Black) |
… | |
… | |
811 | |
811 | |
812 | if (option (Opt_scrollBar)) |
812 | if (option (Opt_scrollBar)) |
813 | scrollBar.resize (); /* create and map scrollbar */ |
813 | scrollBar.resize (); /* create and map scrollbar */ |
814 | #ifdef HAVE_BG_PIXMAP |
814 | #ifdef HAVE_BG_PIXMAP |
815 | { |
815 | { |
816 | bgPixmap.set_target (this); |
816 | bg_init (); |
817 | bgPixmap.invalidate (); |
|
|
818 | |
817 | |
819 | #ifdef ENABLE_TRANSPARENCY |
818 | #ifdef ENABLE_TRANSPARENCY |
820 | if (option (Opt_transparent)) |
819 | if (option (Opt_transparent)) |
821 | { |
820 | { |
822 | bgPixmap.set_transparent (); |
821 | bg_set_transparent (); |
823 | |
822 | |
824 | if (rs [Rs_blurradius]) |
823 | if (rs [Rs_blurradius]) |
825 | bgPixmap.set_blur_radius (rs [Rs_blurradius]); |
824 | bg_set_blur (rs [Rs_blurradius]); |
826 | |
825 | |
827 | if (ISSET_PIXCOLOR (Color_tint)) |
826 | if (ISSET_PIXCOLOR (Color_tint)) |
828 | bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
827 | bg_set_tint (pix_colors_focused [Color_tint]); |
829 | |
828 | |
830 | if (rs [Rs_shade]) |
829 | if (rs [Rs_shade]) |
831 | bgPixmap.set_shade (rs [Rs_shade]); |
830 | bg_set_shade (rs [Rs_shade]); |
832 | |
831 | |
833 | bgPixmap.set_root_pixmap (); |
832 | bg_set_root_pixmap (); |
834 | XSelectInput (dpy, display->root, PropertyChangeMask); |
833 | XSelectInput (dpy, display->root, PropertyChangeMask); |
835 | rootwin_ev.start (display, display->root); |
834 | rootwin_ev.start (display, display->root); |
836 | } |
835 | } |
837 | #endif |
836 | #endif |
838 | |
837 | |
… | |
… | |
842 | const char *p = rs[Rs_backgroundPixmap]; |
841 | const char *p = rs[Rs_backgroundPixmap]; |
843 | |
842 | |
844 | if ((p = strchr (p, ';')) != 0) |
843 | if ((p = strchr (p, ';')) != 0) |
845 | { |
844 | { |
846 | p++; |
845 | p++; |
847 | bgPixmap.set_geometry (p); |
846 | bg_set_geometry (p); |
848 | } |
847 | } |
849 | else |
848 | else |
850 | bgPixmap.set_defaultGeometry (); |
849 | bg_set_default_geometry (); |
851 | |
850 | |
852 | if (bgPixmap.set_file (rs[Rs_backgroundPixmap])) |
851 | if (bg_set_file (rs[Rs_backgroundPixmap])) |
853 | if (!bgPixmap.window_position_sensitive ()) |
852 | if (!bg_window_position_sensitive ()) |
854 | update_background (); |
853 | update_background (); |
855 | } |
854 | } |
856 | #endif |
855 | #endif |
857 | } |
856 | } |
858 | #endif |
857 | #endif |
… | |
… | |
875 | #if ENABLE_XEMBED |
874 | #if ENABLE_XEMBED |
876 | if (rs[Rs_embed]) |
875 | if (rs[Rs_embed]) |
877 | { |
876 | { |
878 | long info[2] = { 0, XEMBED_MAPPED }; |
877 | long info[2] = { 0, XEMBED_MAPPED }; |
879 | |
878 | |
880 | XChangeProperty (dpy, parent[0], xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], |
879 | XChangeProperty (dpy, parent, xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], |
881 | 32, PropModeReplace, (unsigned char *)&info, 2); |
880 | 32, PropModeReplace, (unsigned char *)&info, 2); |
882 | } |
881 | } |
883 | #endif |
882 | #endif |
884 | |
883 | |
885 | XMapWindow (dpy, vt); |
884 | XMapWindow (dpy, vt); |
886 | XMapWindow (dpy, parent[0]); |
885 | XMapWindow (dpy, parent); |
887 | |
886 | |
888 | refresh_check (); |
887 | refresh_check (); |
889 | } |
888 | } |
890 | |
889 | |
891 | /*----------------------------------------------------------------------*/ |
890 | /*----------------------------------------------------------------------*/ |
892 | void |
891 | void |
893 | rxvt_term::init_env () |
892 | rxvt_term::init_env () |
894 | { |
893 | { |
895 | int i; |
|
|
896 | char *val; |
894 | char *val; |
897 | |
895 | |
898 | #ifdef DISPLAY_IS_IP |
896 | #ifdef DISPLAY_IS_IP |
899 | /* Fixup display_name for export over pty to any interested terminal |
897 | /* Fixup display_name for export over pty to any interested terminal |
900 | * clients via "ESC[7n" (e.g. shells). Note we use the pure IP number |
898 | * clients via "ESC[7n" (e.g. shells). Note we use the pure IP number |
… | |
… | |
914 | val = XDisplayString (dpy); |
912 | val = XDisplayString (dpy); |
915 | |
913 | |
916 | if (rs[Rs_display_name] == NULL) |
914 | if (rs[Rs_display_name] == NULL) |
917 | rs[Rs_display_name] = val; /* use broken `:0' value */ |
915 | rs[Rs_display_name] = val; /* use broken `:0' value */ |
918 | |
916 | |
919 | i = strlen (val); |
|
|
920 | env_display = (char *)rxvt_malloc (i + 9); |
917 | env_display = (char *)rxvt_malloc (strlen (val) + 9); |
921 | |
918 | |
922 | sprintf (env_display, "DISPLAY=%s", val); |
919 | sprintf (env_display, "DISPLAY=%s", val); |
923 | |
920 | |
924 | sprintf (env_windowid, "WINDOWID=%lu", (unsigned long)parent[0]); |
921 | sprintf (env_windowid, "WINDOWID=%lu", (unsigned long)parent); |
925 | |
922 | |
926 | /* add entries to the environment: |
923 | /* add entries to the environment: |
927 | * @ DISPLAY: in case we started with -display |
924 | * @ DISPLAY: in case we started with -display |
928 | * @ WINDOWID: X window id number of the window |
925 | * @ WINDOWID: X window id number of the window |
929 | * @ COLORTERM: terminal sub-name and also indicates its color |
926 | * @ COLORTERM: terminal sub-name and also indicates its color |
… | |
… | |
1326 | buffer [1] = h; |
1323 | buffer [1] = h; |
1327 | |
1324 | |
1328 | for (unsigned int i = 0; i < w * h; ++i) |
1325 | for (unsigned int i = 0; i < w * h; ++i) |
1329 | buffer [i + 2] = asbuf [i]; |
1326 | buffer [i + 2] = asbuf [i]; |
1330 | |
1327 | |
1331 | XChangeProperty (dpy, parent[0], xa[XA_NET_WM_ICON], XA_CARDINAL, 32, |
1328 | XChangeProperty (dpy, parent, xa[XA_NET_WM_ICON], XA_CARDINAL, 32, |
1332 | PropModeReplace, (const unsigned char *) buffer, 2 + w * h); |
1329 | PropModeReplace, (const unsigned char *) buffer, 2 + w * h); |
1333 | free (buffer); |
1330 | free (buffer); |
1334 | } |
1331 | } |
1335 | else |
1332 | else |
1336 | rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); |
1333 | rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); |
… | |
… | |
1383 | } |
1380 | } |
1384 | |
1381 | |
1385 | row += rowstride; |
1382 | row += rowstride; |
1386 | } |
1383 | } |
1387 | |
1384 | |
1388 | XChangeProperty (dpy, parent[0], xa[XA_NET_WM_ICON], XA_CARDINAL, 32, |
1385 | XChangeProperty (dpy, parent, xa[XA_NET_WM_ICON], XA_CARDINAL, 32, |
1389 | PropModeReplace, (const unsigned char *) buffer, 2 + w * h); |
1386 | PropModeReplace, (const unsigned char *) buffer, 2 + w * h); |
1390 | free (buffer); |
1387 | free (buffer); |
1391 | } |
1388 | } |
1392 | else |
1389 | else |
1393 | rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); |
1390 | rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); |
… | |
… | |
1395 | g_object_unref (pixbuf); |
1392 | g_object_unref (pixbuf); |
1396 | #endif |
1393 | #endif |
1397 | } |
1394 | } |
1398 | |
1395 | |
1399 | /*----------------------------------------------------------------------*/ |
1396 | /*----------------------------------------------------------------------*/ |
1400 | /* rxvt_Create_Windows () - Open and map the window */ |
1397 | /* Open and map the window */ |
1401 | void |
1398 | void |
1402 | rxvt_term::create_windows (int argc, const char *const *argv) |
1399 | rxvt_term::create_windows (int argc, const char *const *argv) |
1403 | { |
1400 | { |
1404 | XClassHint classHint; |
1401 | XClassHint classHint; |
1405 | XWMHints wmHint; |
1402 | XWMHints wmHint; |
… | |
… | |
1451 | } |
1448 | } |
1452 | #endif |
1449 | #endif |
1453 | |
1450 | |
1454 | window_calc (0, 0); |
1451 | window_calc (0, 0); |
1455 | |
1452 | |
1456 | /* sub-window placement & size in rxvt_resize_subwindows () */ |
1453 | /* sub-window placement & size in rxvt_term::resize_all_windows () */ |
1457 | attributes.background_pixel = pix_colors_focused [Color_border]; |
1454 | attributes.background_pixel = pix_colors_focused [Color_border]; |
1458 | attributes.border_pixel = pix_colors_focused [Color_border]; |
1455 | attributes.border_pixel = pix_colors_focused [Color_border]; |
1459 | attributes.colormap = cmap; |
1456 | attributes.colormap = cmap; |
1460 | |
1457 | |
1461 | top = XCreateWindow (dpy, parent, |
1458 | top = XCreateWindow (dpy, parent, |
… | |
… | |
1464 | ext_bwidth, |
1461 | ext_bwidth, |
1465 | depth, InputOutput, visual, |
1462 | depth, InputOutput, visual, |
1466 | CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect, |
1463 | CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect, |
1467 | &attributes); |
1464 | &attributes); |
1468 | |
1465 | |
1469 | this->parent[0] = top; |
1466 | this->parent = top; |
1470 | |
1467 | |
1471 | old_width = szHint.width; |
1468 | old_width = szHint.width; |
1472 | old_height = szHint.height; |
1469 | old_height = szHint.height; |
1473 | |
1470 | |
1474 | set_title (rs [Rs_title]); |
1471 | set_title (rs [Rs_title]); |
… | |
… | |
1507 | #if ENABLE_EWMH |
1504 | #if ENABLE_EWMH |
1508 | xa[XA_NET_WM_PING], |
1505 | xa[XA_NET_WM_PING], |
1509 | #endif |
1506 | #endif |
1510 | }; |
1507 | }; |
1511 | |
1508 | |
1512 | XSetWMProtocols (dpy, top, protocols, sizeof (protocols) / sizeof (protocols[0])); |
1509 | XSetWMProtocols (dpy, top, protocols, ARRAY_LENGTH(protocols)); |
1513 | |
1510 | |
1514 | #if ENABLE_FRILLS |
1511 | #if ENABLE_FRILLS |
1515 | if (rs[Rs_transient_for]) |
1512 | if (rs[Rs_transient_for]) |
1516 | XSetTransientForHint (dpy, top, (Window)strtol (rs[Rs_transient_for], 0, 0)); |
1513 | XSetTransientForHint (dpy, top, (Window)strtol (rs[Rs_transient_for], 0, 0)); |
1517 | #endif |
1514 | #endif |