… | |
… | |
241 | scrollBar.destroy (); |
241 | scrollBar.destroy (); |
242 | if (gc) XFreeGC (dpy, gc); |
242 | if (gc) XFreeGC (dpy, gc); |
243 | |
243 | |
244 | delete drawable; |
244 | delete drawable; |
245 | // destroy all windows |
245 | // destroy all windows |
246 | if (parent[0]) |
246 | if (parent) |
247 | XDestroyWindow (dpy, parent[0]); |
247 | XDestroyWindow (dpy, parent); |
248 | |
248 | |
249 | for (int i = 0; i < TOTAL_COLORS; i++) |
249 | for (int i = 0; i < TOTAL_COLORS; i++) |
250 | if (ISSET_PIXCOLOR (i)) |
250 | if (ISSET_PIXCOLOR (i)) |
251 | { |
251 | { |
252 | pix_colors_focused [i].free (this); |
252 | pix_colors_focused [i].free (this); |
… | |
… | |
808 | #else |
808 | #else |
809 | fontset[style] = fontset[0]; |
809 | fontset[style] = fontset[0]; |
810 | #endif |
810 | #endif |
811 | } |
811 | } |
812 | |
812 | |
813 | if (parent[0]) |
813 | if (parent) |
814 | { |
814 | { |
815 | resize_all_windows (0, 0, 0); |
815 | resize_all_windows (0, 0, 0); |
816 | scr_remap_chars (); |
816 | scr_remap_chars (); |
817 | scr_touch (true); |
817 | scr_touch (true); |
818 | } |
818 | } |
… | |
… | |
821 | } |
821 | } |
822 | |
822 | |
823 | void |
823 | void |
824 | rxvt_term::set_string_property (Atom prop, const char *str, int len) |
824 | rxvt_term::set_string_property (Atom prop, const char *str, int len) |
825 | { |
825 | { |
826 | XChangeProperty (dpy, parent[0], |
826 | XChangeProperty (dpy, parent, |
827 | prop, XA_STRING, 8, PropModeReplace, |
827 | prop, XA_STRING, 8, PropModeReplace, |
828 | (const unsigned char *)str, len >= 0 ? len : strlen (str)); |
828 | (const unsigned char *)str, len >= 0 ? len : strlen (str)); |
829 | } |
829 | } |
830 | |
830 | |
831 | void |
831 | void |
… | |
… | |
833 | { |
833 | { |
834 | XTextProperty ct; |
834 | XTextProperty ct; |
835 | |
835 | |
836 | if (XmbTextListToTextProperty (dpy, (char **)&str, 1, XStdICCTextStyle, &ct) >= 0) |
836 | if (XmbTextListToTextProperty (dpy, (char **)&str, 1, XStdICCTextStyle, &ct) >= 0) |
837 | { |
837 | { |
838 | XSetTextProperty (dpy, parent[0], &ct, prop); |
838 | XSetTextProperty (dpy, parent, &ct, prop); |
839 | XFree (ct.value); |
839 | XFree (ct.value); |
840 | } |
840 | } |
841 | } |
841 | } |
842 | |
842 | |
843 | void |
843 | void |
844 | rxvt_term::set_utf8_property (Atom prop, const char *str, int len) |
844 | rxvt_term::set_utf8_property (Atom prop, const char *str, int len) |
845 | { |
845 | { |
846 | wchar_t *ws = rxvt_mbstowcs (str, len); |
846 | wchar_t *ws = rxvt_mbstowcs (str, len); |
847 | char *s = rxvt_wcstoutf8 (ws); |
847 | char *s = rxvt_wcstoutf8 (ws); |
848 | |
848 | |
849 | XChangeProperty (dpy, parent[0], |
849 | XChangeProperty (dpy, parent, |
850 | prop, xa[XA_UTF8_STRING], 8, PropModeReplace, |
850 | prop, xa[XA_UTF8_STRING], 8, PropModeReplace, |
851 | (const unsigned char *)s, strlen (s)); |
851 | (const unsigned char *)s, strlen (s)); |
852 | |
852 | |
853 | free (s); |
853 | free (s); |
854 | free (ws); |
854 | free (ws); |
… | |
… | |
1008 | |
1008 | |
1009 | // to avoid races between us and the wm, we clear the incremental size hints around the xresizewindow |
1009 | // to avoid races between us and the wm, we clear the incremental size hints around the xresizewindow |
1010 | if (set_hint) |
1010 | if (set_hint) |
1011 | { |
1011 | { |
1012 | szHint.flags &= ~(PBaseSize | PResizeInc); |
1012 | szHint.flags &= ~(PBaseSize | PResizeInc); |
1013 | XSetWMNormalHints (dpy, parent[0], &szHint); |
1013 | XSetWMNormalHints (dpy, parent, &szHint); |
1014 | szHint.flags |= PBaseSize | PResizeInc; |
1014 | szHint.flags |= PBaseSize | PResizeInc; |
1015 | } |
1015 | } |
1016 | |
1016 | |
1017 | if (!ignoreparent) |
1017 | if (!ignoreparent) |
1018 | { |
1018 | { |
… | |
… | |
1024 | int x, y, x1, y1; |
1024 | int x, y, x1, y1; |
1025 | int dx, dy; |
1025 | int dx, dy; |
1026 | unsigned int unused_w1, unused_h1, unused_b1, unused_d1; |
1026 | unsigned int unused_w1, unused_h1, unused_b1, unused_d1; |
1027 | Window unused_cr; |
1027 | Window unused_cr; |
1028 | |
1028 | |
1029 | XTranslateCoordinates (dpy, parent[0], display->root, |
1029 | XTranslateCoordinates (dpy, parent, display->root, |
1030 | 0, 0, &x, &y, &unused_cr); |
1030 | 0, 0, &x, &y, &unused_cr); |
1031 | XGetGeometry (dpy, parent[0], &unused_cr, &x1, &y1, |
1031 | XGetGeometry (dpy, parent, &unused_cr, &x1, &y1, |
1032 | &unused_w1, &unused_h1, &unused_b1, &unused_d1); |
1032 | &unused_w1, &unused_h1, &unused_b1, &unused_d1); |
1033 | /* |
1033 | /* |
1034 | * if display->root isn't the parent window, a WM will probably have offset |
1034 | * if display->root isn't the parent window, a WM will probably have offset |
1035 | * our position for handles and decorations. Counter it |
1035 | * our position for handles and decorations. Counter it |
1036 | */ |
1036 | */ |
… | |
… | |
1053 | if (y < y1) /* top half */ |
1053 | if (y < y1) /* top half */ |
1054 | dy = 0; |
1054 | dy = 0; |
1055 | else if (y == y1) /* exact center */ |
1055 | else if (y == y1) /* exact center */ |
1056 | dy /= 2; |
1056 | dy /= 2; |
1057 | |
1057 | |
1058 | XMoveResizeWindow (dpy, parent[0], x + dx, y + dy, |
1058 | XMoveResizeWindow (dpy, parent, x + dx, y + dy, |
1059 | szHint.width, szHint.height); |
1059 | szHint.width, szHint.height); |
1060 | #else |
1060 | #else |
1061 | XResizeWindow (dpy, parent[0], szHint.width, szHint.height); |
1061 | XResizeWindow (dpy, parent, szHint.width, szHint.height); |
1062 | #endif |
1062 | #endif |
1063 | } |
1063 | } |
1064 | |
1064 | |
1065 | if (set_hint) |
1065 | if (set_hint) |
1066 | XSetWMNormalHints (dpy, parent[0], &szHint); |
1066 | XSetWMNormalHints (dpy, parent, &szHint); |
1067 | |
1067 | |
1068 | fix_screen = ncol != prev_ncol || nrow != prev_nrow; |
1068 | fix_screen = ncol != prev_ncol || nrow != prev_nrow; |
1069 | |
1069 | |
1070 | if (fix_screen || newwidth != old_width || newheight != old_height) |
1070 | if (fix_screen || newwidth != old_width || newheight != old_height) |
1071 | { |
1071 | { |
… | |
… | |
1483 | #endif |
1483 | #endif |
1484 | |
1484 | |
1485 | Input_Context = XCreateIC (xim, |
1485 | Input_Context = XCreateIC (xim, |
1486 | XNInputStyle, input_style, |
1486 | XNInputStyle, input_style, |
1487 | XNClientWindow, vt, |
1487 | XNClientWindow, vt, |
1488 | XNFocusWindow, parent[0], |
1488 | XNFocusWindow, parent, |
1489 | preedit_attr ? XNPreeditAttributes : NULL, |
1489 | preedit_attr ? XNPreeditAttributes : NULL, |
1490 | preedit_attr, |
1490 | preedit_attr, |
1491 | status_attr ? XNStatusAttributes : NULL, |
1491 | status_attr ? XNStatusAttributes : NULL, |
1492 | status_attr, NULL); |
1492 | status_attr, NULL); |
1493 | |
1493 | |
… | |
… | |
1622 | |
1622 | |
1623 | void |
1623 | void |
1624 | rxvt_term::get_window_origin (int &x, int &y) |
1624 | rxvt_term::get_window_origin (int &x, int &y) |
1625 | { |
1625 | { |
1626 | Window cr; |
1626 | Window cr; |
1627 | XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr); |
1627 | XTranslateCoordinates (dpy, parent, display->root, 0, 0, &x, &y, &cr); |
1628 | } |
1628 | } |
1629 | |
1629 | |
1630 | Pixmap |
1630 | Pixmap |
1631 | rxvt_term::get_pixmap_property (Atom property) |
1631 | rxvt_term::get_pixmap_property (Atom property) |
1632 | { |
1632 | { |