… | |
… | |
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. |
… | |
… | |
60 | #ifdef DISPLAY_IS_IP |
60 | #ifdef DISPLAY_IS_IP |
61 | /* On Solaris link with -lsocket and -lnsl */ |
61 | /* On Solaris link with -lsocket and -lnsl */ |
62 | #include <sys/types.h> |
62 | #include <sys/types.h> |
63 | #include <sys/socket.h> |
63 | #include <sys/socket.h> |
64 | |
64 | |
65 | /* these next is probably only on Sun (not Solaris) */ |
65 | /* these next two are probably only on Sun (not Solaris) */ |
66 | #ifdef HAVE_SYS_SOCKIO_H |
66 | #ifdef HAVE_SYS_SOCKIO_H |
67 | #include <sys/sockio.h> |
67 | #include <sys/sockio.h> |
|
|
68 | #endif |
|
|
69 | #ifdef HAVE_SYS_BYTEORDER_H |
|
|
70 | #include <sys/byteorder.h> |
68 | #endif |
71 | #endif |
69 | |
72 | |
70 | #include <netinet/in.h> |
73 | #include <netinet/in.h> |
71 | #include <arpa/inet.h> |
74 | #include <arpa/inet.h> |
72 | #include <net/if.h> |
75 | #include <net/if.h> |
… | |
… | |
624 | |
627 | |
625 | for (int i = NUM_RESOURCES; i--; ) |
628 | for (int i = NUM_RESOURCES; i--; ) |
626 | if (rs [i] == resval_undef) |
629 | if (rs [i] == resval_undef) |
627 | rs [i] = 0; |
630 | rs [i] = 0; |
628 | |
631 | |
629 | #ifdef HAVE_AFTERIMAGE |
|
|
630 | set_application_name ((char *)rs[Rs_name]); |
|
|
631 | set_output_threshold (OUTPUT_LEVEL_WARNING); |
|
|
632 | #endif |
|
|
633 | |
|
|
634 | #ifdef HAVE_PIXBUF |
|
|
635 | g_type_init (); |
|
|
636 | #endif |
|
|
637 | |
|
|
638 | #if ENABLE_PERL |
632 | #if ENABLE_PERL |
639 | if (!rs[Rs_perl_ext_1]) |
633 | if (!rs[Rs_perl_ext_1]) |
640 | rs[Rs_perl_ext_1] = "default"; |
634 | rs[Rs_perl_ext_1] = "default"; |
641 | |
635 | |
642 | if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1]) |
636 | if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1]) |
… | |
… | |
808 | |
802 | |
809 | if (option (Opt_scrollBar)) |
803 | if (option (Opt_scrollBar)) |
810 | scrollBar.resize (); /* create and map scrollbar */ |
804 | scrollBar.resize (); /* create and map scrollbar */ |
811 | #ifdef HAVE_BG_PIXMAP |
805 | #ifdef HAVE_BG_PIXMAP |
812 | { |
806 | { |
813 | bgPixmap.set_target (this); |
807 | bg_init (); |
814 | bgPixmap.invalidate (); |
|
|
815 | |
808 | |
816 | #ifdef ENABLE_TRANSPARENCY |
809 | #ifdef ENABLE_TRANSPARENCY |
817 | if (option (Opt_transparent)) |
810 | if (option (Opt_transparent)) |
818 | { |
811 | { |
819 | bgPixmap.set_transparent (); |
812 | bg_set_transparent (); |
820 | |
813 | |
821 | if (rs [Rs_blurradius]) |
814 | if (rs [Rs_blurradius]) |
822 | bgPixmap.set_blur_radius (rs [Rs_blurradius]); |
815 | bg_set_blur (rs [Rs_blurradius]); |
823 | |
816 | |
824 | if (ISSET_PIXCOLOR (Color_tint)) |
817 | if (ISSET_PIXCOLOR (Color_tint)) |
825 | bgPixmap.set_tint (pix_colors_focused [Color_tint]); |
818 | bg_set_tint (pix_colors_focused [Color_tint]); |
826 | |
819 | |
827 | if (rs [Rs_shade]) |
820 | if (rs [Rs_shade]) |
828 | bgPixmap.set_shade (rs [Rs_shade]); |
821 | bg_set_shade (rs [Rs_shade]); |
829 | |
822 | |
830 | bgPixmap.set_root_pixmap (); |
823 | bg_set_root_pixmap (); |
831 | XSelectInput (dpy, display->root, PropertyChangeMask); |
824 | XSelectInput (dpy, display->root, PropertyChangeMask); |
832 | rootwin_ev.start (display, display->root); |
825 | rootwin_ev.start (display, display->root); |
833 | } |
826 | } |
834 | #endif |
827 | #endif |
835 | |
828 | |
836 | #ifdef BG_IMAGE_FROM_FILE |
829 | #ifdef BG_IMAGE_FROM_FILE |
837 | if (rs[Rs_backgroundPixmap]) |
830 | if (rs[Rs_backgroundPixmap]) |
838 | { |
831 | { |
839 | const char *p = rs[Rs_backgroundPixmap]; |
|
|
840 | |
|
|
841 | if ((p = strchr (p, ';')) != 0) |
|
|
842 | { |
|
|
843 | p++; |
|
|
844 | bgPixmap.set_geometry (p); |
|
|
845 | } |
|
|
846 | else |
|
|
847 | bgPixmap.set_defaultGeometry (); |
|
|
848 | |
|
|
849 | if (bgPixmap.set_file (rs[Rs_backgroundPixmap])) |
832 | if (bg_set_file (rs[Rs_backgroundPixmap])) |
850 | if (!bgPixmap.window_position_sensitive ()) |
833 | if (!bg_window_position_sensitive ()) |
851 | update_background (); |
834 | update_background (); |
852 | } |
835 | } |
853 | #endif |
836 | #endif |
854 | } |
837 | } |
855 | #endif |
838 | #endif |
… | |
… | |
872 | #if ENABLE_XEMBED |
855 | #if ENABLE_XEMBED |
873 | if (rs[Rs_embed]) |
856 | if (rs[Rs_embed]) |
874 | { |
857 | { |
875 | long info[2] = { 0, XEMBED_MAPPED }; |
858 | long info[2] = { 0, XEMBED_MAPPED }; |
876 | |
859 | |
877 | XChangeProperty (dpy, parent[0], xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], |
860 | XChangeProperty (dpy, parent, xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], |
878 | 32, PropModeReplace, (unsigned char *)&info, 2); |
861 | 32, PropModeReplace, (unsigned char *)&info, 2); |
879 | } |
862 | } |
880 | #endif |
863 | #endif |
881 | |
864 | |
882 | XMapWindow (dpy, vt); |
865 | XMapWindow (dpy, vt); |
883 | XMapWindow (dpy, parent[0]); |
866 | XMapWindow (dpy, parent); |
884 | |
867 | |
885 | refresh_check (); |
868 | refresh_check (); |
886 | } |
869 | } |
887 | |
870 | |
888 | /*----------------------------------------------------------------------*/ |
871 | /*----------------------------------------------------------------------*/ |
… | |
… | |
914 | |
897 | |
915 | env_display = (char *)rxvt_malloc (strlen (val) + 9); |
898 | env_display = (char *)rxvt_malloc (strlen (val) + 9); |
916 | |
899 | |
917 | sprintf (env_display, "DISPLAY=%s", val); |
900 | sprintf (env_display, "DISPLAY=%s", val); |
918 | |
901 | |
919 | sprintf (env_windowid, "WINDOWID=%lu", (unsigned long)parent[0]); |
902 | sprintf (env_windowid, "WINDOWID=%lu", (unsigned long)parent); |
920 | |
903 | |
921 | /* add entries to the environment: |
904 | /* add entries to the environment: |
922 | * @ DISPLAY: in case we started with -display |
905 | * @ DISPLAY: in case we started with -display |
923 | * @ WINDOWID: X window id number of the window |
906 | * @ WINDOWID: X window id number of the window |
924 | * @ COLORTERM: terminal sub-name and also indicates its color |
907 | * @ COLORTERM: terminal sub-name and also indicates its color |
… | |
… | |
1321 | buffer [1] = h; |
1304 | buffer [1] = h; |
1322 | |
1305 | |
1323 | for (unsigned int i = 0; i < w * h; ++i) |
1306 | for (unsigned int i = 0; i < w * h; ++i) |
1324 | buffer [i + 2] = asbuf [i]; |
1307 | buffer [i + 2] = asbuf [i]; |
1325 | |
1308 | |
1326 | XChangeProperty (dpy, parent[0], xa[XA_NET_WM_ICON], XA_CARDINAL, 32, |
1309 | XChangeProperty (dpy, parent, xa[XA_NET_WM_ICON], XA_CARDINAL, 32, |
1327 | PropModeReplace, (const unsigned char *) buffer, 2 + w * h); |
1310 | PropModeReplace, (const unsigned char *) buffer, 2 + w * h); |
1328 | free (buffer); |
1311 | free (buffer); |
1329 | } |
1312 | } |
1330 | else |
1313 | else |
1331 | rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); |
1314 | rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); |
… | |
… | |
1378 | } |
1361 | } |
1379 | |
1362 | |
1380 | row += rowstride; |
1363 | row += rowstride; |
1381 | } |
1364 | } |
1382 | |
1365 | |
1383 | XChangeProperty (dpy, parent[0], xa[XA_NET_WM_ICON], XA_CARDINAL, 32, |
1366 | XChangeProperty (dpy, parent, xa[XA_NET_WM_ICON], XA_CARDINAL, 32, |
1384 | PropModeReplace, (const unsigned char *) buffer, 2 + w * h); |
1367 | PropModeReplace, (const unsigned char *) buffer, 2 + w * h); |
1385 | free (buffer); |
1368 | free (buffer); |
1386 | } |
1369 | } |
1387 | else |
1370 | else |
1388 | rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); |
1371 | rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); |
… | |
… | |
1390 | g_object_unref (pixbuf); |
1373 | g_object_unref (pixbuf); |
1391 | #endif |
1374 | #endif |
1392 | } |
1375 | } |
1393 | |
1376 | |
1394 | /*----------------------------------------------------------------------*/ |
1377 | /*----------------------------------------------------------------------*/ |
1395 | /* rxvt_Create_Windows () - Open and map the window */ |
1378 | /* Open and map the window */ |
1396 | void |
1379 | void |
1397 | rxvt_term::create_windows (int argc, const char *const *argv) |
1380 | rxvt_term::create_windows (int argc, const char *const *argv) |
1398 | { |
1381 | { |
1399 | XClassHint classHint; |
1382 | XClassHint classHint; |
1400 | XWMHints wmHint; |
1383 | XWMHints wmHint; |
… | |
… | |
1446 | } |
1429 | } |
1447 | #endif |
1430 | #endif |
1448 | |
1431 | |
1449 | window_calc (0, 0); |
1432 | window_calc (0, 0); |
1450 | |
1433 | |
1451 | /* sub-window placement & size in rxvt_resize_subwindows () */ |
1434 | /* sub-window placement & size in rxvt_term::resize_all_windows () */ |
1452 | attributes.background_pixel = pix_colors_focused [Color_border]; |
1435 | attributes.background_pixel = pix_colors_focused [Color_border]; |
1453 | attributes.border_pixel = pix_colors_focused [Color_border]; |
1436 | attributes.border_pixel = pix_colors_focused [Color_border]; |
1454 | attributes.colormap = cmap; |
1437 | attributes.colormap = cmap; |
1455 | |
1438 | |
1456 | top = XCreateWindow (dpy, parent, |
1439 | top = XCreateWindow (dpy, parent, |
… | |
… | |
1459 | ext_bwidth, |
1442 | ext_bwidth, |
1460 | depth, InputOutput, visual, |
1443 | depth, InputOutput, visual, |
1461 | CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect, |
1444 | CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect, |
1462 | &attributes); |
1445 | &attributes); |
1463 | |
1446 | |
1464 | this->parent[0] = top; |
1447 | this->parent = top; |
1465 | |
1448 | |
1466 | old_width = szHint.width; |
1449 | old_width = szHint.width; |
1467 | old_height = szHint.height; |
1450 | old_height = szHint.height; |
1468 | |
1451 | |
1469 | set_title (rs [Rs_title]); |
1452 | set_title (rs [Rs_title]); |
… | |
… | |
1502 | #if ENABLE_EWMH |
1485 | #if ENABLE_EWMH |
1503 | xa[XA_NET_WM_PING], |
1486 | xa[XA_NET_WM_PING], |
1504 | #endif |
1487 | #endif |
1505 | }; |
1488 | }; |
1506 | |
1489 | |
1507 | XSetWMProtocols (dpy, top, protocols, ARRAY_LENGTH(protocols)); |
1490 | XSetWMProtocols (dpy, top, protocols, ecb_array_length (protocols)); |
1508 | |
1491 | |
1509 | #if ENABLE_FRILLS |
1492 | #if ENABLE_FRILLS |
1510 | if (rs[Rs_transient_for]) |
1493 | if (rs[Rs_transient_for]) |
1511 | XSetTransientForHint (dpy, top, (Window)strtol (rs[Rs_transient_for], 0, 0)); |
1494 | XSetTransientForHint (dpy, top, (Window)strtol (rs[Rs_transient_for], 0, 0)); |
1512 | #endif |
1495 | #endif |