ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/main.C
(Generate patch)

Comparing rxvt-unicode/src/main.C (file contents):
Revision 1.351 by sf-exg, Tue Feb 1 00:41:01 2011 UTC vs.
Revision 1.355 by sf-exg, Thu Apr 7 12:19:40 2011 UTC

11 * Copyright (c) 1997 mj olesen <olesen@me.QueensU.CA> 11 * Copyright (c) 1997 mj olesen <olesen@me.QueensU.CA>
12 * - extensive modifications 12 * - extensive modifications
13 * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> 13 * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de>
14 * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> 14 * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com>
15 * - extensive modifications 15 * - extensive modifications
16 * Copyright (c) 2003-2010 Marc Lehmann <pcg@goof.com> 16 * Copyright (c) 2003-2010 Marc Lehmann <schmorp@schmorp.de>
17 * 17 *
18 * This program is free software; you can redistribute it and/or modify 18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by 19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or 20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version. 21 * (at your option) any later version.
187#endif 187#endif
188 child_ev.set <rxvt_term, &rxvt_term::child_cb> (this); 188 child_ev.set <rxvt_term, &rxvt_term::child_cb> (this);
189 flush_ev.set <rxvt_term, &rxvt_term::flush_cb> (this); 189 flush_ev.set <rxvt_term, &rxvt_term::flush_cb> (this);
190 destroy_ev.set <rxvt_term, &rxvt_term::destroy_cb> (this); 190 destroy_ev.set <rxvt_term, &rxvt_term::destroy_cb> (this);
191 pty_ev.set <rxvt_term, &rxvt_term::pty_cb> (this); 191 pty_ev.set <rxvt_term, &rxvt_term::pty_cb> (this);
192 incr_ev.set <rxvt_term, &rxvt_term::incr_cb> (this);
193 termwin_ev.set <rxvt_term, &rxvt_term::x_cb> (this); 192 termwin_ev.set <rxvt_term, &rxvt_term::x_cb> (this);
194 vt_ev.set <rxvt_term, &rxvt_term::x_cb> (this); 193 vt_ev.set <rxvt_term, &rxvt_term::x_cb> (this);
195 194
196 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; 195 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base;
197 196
242 scrollBar.destroy (); 241 scrollBar.destroy ();
243 if (gc) XFreeGC (dpy, gc); 242 if (gc) XFreeGC (dpy, gc);
244 243
245 delete drawable; 244 delete drawable;
246 // destroy all windows 245 // destroy all windows
247 if (parent[0]) 246 if (parent)
248 XDestroyWindow (dpy, parent[0]); 247 XDestroyWindow (dpy, parent);
249 248
250 for (int i = 0; i < TOTAL_COLORS; i++) 249 for (int i = 0; i < TOTAL_COLORS; i++)
251 if (ISSET_PIXCOLOR (i)) 250 if (ISSET_PIXCOLOR (i))
252 { 251 {
253 pix_colors_focused [i].free (this); 252 pix_colors_focused [i].free (this);
273 // TODO: manage env vars in child only(!) 272 // TODO: manage env vars in child only(!)
274 free (env_display); 273 free (env_display);
275 free (env_term); 274 free (env_term);
276 free (locale); 275 free (locale);
277 free (v_buffer); 276 free (v_buffer);
278 free (incr_buf); 277
278 delete selection_req;
279 279
280 delete envv; 280 delete envv;
281 delete argv; 281 delete argv;
282 282
283#ifdef KEYSYM_RESOURCE 283#ifdef KEYSYM_RESOURCE
319#endif 319#endif
320 scrollbar_ev.stop (display); 320 scrollbar_ev.stop (display);
321#if ENABLE_TRANSPARENCY || ENABLE_PERL 321#if ENABLE_TRANSPARENCY || ENABLE_PERL
322 rootwin_ev.stop (display); 322 rootwin_ev.stop (display);
323#endif 323#endif
324 incr_ev.stop ();
325 termwin_ev.stop (display); 324 termwin_ev.stop (display);
326 vt_ev.stop (display); 325 vt_ev.stop (display);
327 } 326 }
328 327
329 flush_ev.stop (); 328 flush_ev.stop ();
809#else 808#else
810 fontset[style] = fontset[0]; 809 fontset[style] = fontset[0];
811#endif 810#endif
812 } 811 }
813 812
814 if (parent[0]) 813 if (parent)
815 { 814 {
816 resize_all_windows (0, 0, 0); 815 resize_all_windows (0, 0, 0);
817 scr_remap_chars (); 816 scr_remap_chars ();
818 scr_touch (true); 817 scr_touch (true);
819 } 818 }
822} 821}
823 822
824void 823void
825rxvt_term::set_string_property (Atom prop, const char *str, int len) 824rxvt_term::set_string_property (Atom prop, const char *str, int len)
826{ 825{
827 XChangeProperty (dpy, parent[0], 826 XChangeProperty (dpy, parent,
828 prop, XA_STRING, 8, PropModeReplace, 827 prop, XA_STRING, 8, PropModeReplace,
829 (const unsigned char *)str, len >= 0 ? len : strlen (str)); 828 (const unsigned char *)str, len >= 0 ? len : strlen (str));
830} 829}
831 830
832void 831void
834{ 833{
835 XTextProperty ct; 834 XTextProperty ct;
836 835
837 if (XmbTextListToTextProperty (dpy, (char **)&str, 1, XStdICCTextStyle, &ct) >= 0) 836 if (XmbTextListToTextProperty (dpy, (char **)&str, 1, XStdICCTextStyle, &ct) >= 0)
838 { 837 {
839 XSetTextProperty (dpy, parent[0], &ct, prop); 838 XSetTextProperty (dpy, parent, &ct, prop);
840 XFree (ct.value); 839 XFree (ct.value);
841 } 840 }
842} 841}
843 842
844void 843void
845rxvt_term::set_utf8_property (Atom prop, const char *str, int len) 844rxvt_term::set_utf8_property (Atom prop, const char *str, int len)
846{ 845{
847 wchar_t *ws = rxvt_mbstowcs (str, len); 846 wchar_t *ws = rxvt_mbstowcs (str, len);
848 char *s = rxvt_wcstoutf8 (ws); 847 char *s = rxvt_wcstoutf8 (ws);
849 848
850 XChangeProperty (dpy, parent[0], 849 XChangeProperty (dpy, parent,
851 prop, xa[XA_UTF8_STRING], 8, PropModeReplace, 850 prop, xa[XA_UTF8_STRING], 8, PropModeReplace,
852 (const unsigned char *)s, strlen (s)); 851 (const unsigned char *)s, strlen (s));
853 852
854 free (s); 853 free (s);
855 free (ws); 854 free (ws);
1009 1008
1010 // 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
1011 if (set_hint) 1010 if (set_hint)
1012 { 1011 {
1013 szHint.flags &= ~(PBaseSize | PResizeInc); 1012 szHint.flags &= ~(PBaseSize | PResizeInc);
1014 XSetWMNormalHints (dpy, parent[0], &szHint); 1013 XSetWMNormalHints (dpy, parent, &szHint);
1015 szHint.flags |= PBaseSize | PResizeInc; 1014 szHint.flags |= PBaseSize | PResizeInc;
1016 } 1015 }
1017 1016
1018 if (!ignoreparent) 1017 if (!ignoreparent)
1019 { 1018 {
1025 int x, y, x1, y1; 1024 int x, y, x1, y1;
1026 int dx, dy; 1025 int dx, dy;
1027 unsigned int unused_w1, unused_h1, unused_b1, unused_d1; 1026 unsigned int unused_w1, unused_h1, unused_b1, unused_d1;
1028 Window unused_cr; 1027 Window unused_cr;
1029 1028
1030 XTranslateCoordinates (dpy, parent[0], display->root, 1029 XTranslateCoordinates (dpy, parent, display->root,
1031 0, 0, &x, &y, &unused_cr); 1030 0, 0, &x, &y, &unused_cr);
1032 XGetGeometry (dpy, parent[0], &unused_cr, &x1, &y1, 1031 XGetGeometry (dpy, parent, &unused_cr, &x1, &y1,
1033 &unused_w1, &unused_h1, &unused_b1, &unused_d1); 1032 &unused_w1, &unused_h1, &unused_b1, &unused_d1);
1034 /* 1033 /*
1035 * 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
1036 * our position for handles and decorations. Counter it 1035 * our position for handles and decorations. Counter it
1037 */ 1036 */
1054 if (y < y1) /* top half */ 1053 if (y < y1) /* top half */
1055 dy = 0; 1054 dy = 0;
1056 else if (y == y1) /* exact center */ 1055 else if (y == y1) /* exact center */
1057 dy /= 2; 1056 dy /= 2;
1058 1057
1059 XMoveResizeWindow (dpy, parent[0], x + dx, y + dy, 1058 XMoveResizeWindow (dpy, parent, x + dx, y + dy,
1060 szHint.width, szHint.height); 1059 szHint.width, szHint.height);
1061#else 1060#else
1062 XResizeWindow (dpy, parent[0], szHint.width, szHint.height); 1061 XResizeWindow (dpy, parent, szHint.width, szHint.height);
1063#endif 1062#endif
1064 } 1063 }
1065 1064
1066 if (set_hint) 1065 if (set_hint)
1067 XSetWMNormalHints (dpy, parent[0], &szHint); 1066 XSetWMNormalHints (dpy, parent, &szHint);
1068 1067
1069 fix_screen = ncol != prev_ncol || nrow != prev_nrow; 1068 fix_screen = ncol != prev_ncol || nrow != prev_nrow;
1070 1069
1071 if (fix_screen || newwidth != old_width || newheight != old_height) 1070 if (fix_screen || newwidth != old_width || newheight != old_height)
1072 { 1071 {
1484#endif 1483#endif
1485 1484
1486 Input_Context = XCreateIC (xim, 1485 Input_Context = XCreateIC (xim,
1487 XNInputStyle, input_style, 1486 XNInputStyle, input_style,
1488 XNClientWindow, vt, 1487 XNClientWindow, vt,
1489 XNFocusWindow, parent[0], 1488 XNFocusWindow, parent,
1490 preedit_attr ? XNPreeditAttributes : NULL, 1489 preedit_attr ? XNPreeditAttributes : NULL,
1491 preedit_attr, 1490 preedit_attr,
1492 status_attr ? XNStatusAttributes : NULL, 1491 status_attr ? XNStatusAttributes : NULL,
1493 status_attr, NULL); 1492 status_attr, NULL);
1494 1493
1623 1622
1624void 1623void
1625rxvt_term::get_window_origin (int &x, int &y) 1624rxvt_term::get_window_origin (int &x, int &y)
1626{ 1625{
1627 Window cr; 1626 Window cr;
1628 XTranslateCoordinates (dpy, parent[0], display->root, 0, 0, &x, &y, &cr); 1627 XTranslateCoordinates (dpy, parent, display->root, 0, 0, &x, &y, &cr);
1629} 1628}
1630 1629
1631Pixmap 1630Pixmap
1632rxvt_term::get_pixmap_property (Atom property) 1631rxvt_term::get_pixmap_property (Atom property)
1633{ 1632{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines