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.218 by root, Thu Feb 2 18:04:46 2006 UTC vs.
Revision 1.226 by root, Thu Jul 6 23:48:11 2006 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*----------------------------------------------------------------------*
2 * File: main.C 2 * File: main.C
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * 4 *
5 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> 6 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
143} 143}
144#endif 144#endif
145 145
146rxvt_term::rxvt_term () 146rxvt_term::rxvt_term ()
147 : 147 :
148#if TRANSPARENT 148#if TRANSPARENT || ENABLE_PERL
149 rootwin_ev (this, &rxvt_term::rootwin_cb), 149 rootwin_ev (this, &rxvt_term::rootwin_cb),
150#endif 150#endif
151#ifdef HAVE_SCROLLBARS 151#ifdef HAVE_SCROLLBARS
152 scrollbar_ev (this, &rxvt_term::x_cb), 152 scrollbar_ev (this, &rxvt_term::x_cb),
153#endif 153#endif
198void rxvt_term::emergency_cleanup () 198void rxvt_term::emergency_cleanup ()
199{ 199{
200 if (cmd_pid) 200 if (cmd_pid)
201 kill (-cmd_pid, SIGHUP); 201 kill (-cmd_pid, SIGHUP);
202 202
203 pty_ev.stop ();
203 delete pty; pty = 0; 204 delete pty; pty = 0;
204} 205}
205 206
206rxvt_term::~rxvt_term () 207rxvt_term::~rxvt_term ()
207{ 208{
325 im_ev.stop (display); 326 im_ev.stop (display);
326#endif 327#endif
327#if HAVE_SCROLLBARS 328#if HAVE_SCROLLBARS
328 scrollbar_ev.stop (display); 329 scrollbar_ev.stop (display);
329#endif 330#endif
330#if TRANSPARENT 331#if TRANSPARENT || ENABLE_PERL
331 rootwin_ev.stop (display); 332 rootwin_ev.stop (display);
332#endif 333#endif
333 incr_ev.stop (); 334 incr_ev.stop ();
334 termwin_ev.stop (display); 335 termwin_ev.stop (display);
335 vt_ev.stop (display); 336 vt_ev.stop (display);
503 XSelectInput (dpy, display->root, PropertyChangeMask); 504 XSelectInput (dpy, display->root, PropertyChangeMask);
504 check_our_parents (); 505 check_our_parents ();
505 rootwin_ev.start (display, display->root); 506 rootwin_ev.start (display, display->root);
506 } 507 }
507#endif 508#endif
509#if ENABLE_PERL
510 rootwin_ev.start (display, display->root);
511#endif
508 512
509 set_colorfgbg (); 513 set_colorfgbg ();
510 514
511 init_command (cmd_argv); 515 init_command (cmd_argv);
512 516
704 708
705 if (!OPTION (Opt_scrollBar_right)) 709 if (!OPTION (Opt_scrollBar_right))
706 window_vt_x += sb_w; 710 window_vt_x += sb_w;
707 } 711 }
708 712
709 szHint.width_inc = fwidth; 713 szHint.width_inc = fwidth;
710 szHint.height_inc = fheight; 714 szHint.height_inc = fheight;
711 szHint.min_width = szHint.base_width + szHint.width_inc; 715 szHint.min_width = szHint.base_width + szHint.width_inc;
712 szHint.min_height = szHint.base_height + szHint.height_inc; 716 szHint.min_height = szHint.base_height + szHint.height_inc;
713 717
714 if (newwidth && newwidth - szHint.base_width < max_width) 718 if (newwidth && newwidth - szHint.base_width < max_width)
715 { 719 {
716 szHint.width = newwidth; 720 szHint.width = newwidth;
935 pix_colors_focused[idx] = xcol; 939 pix_colors_focused[idx] = xcol;
936 940
937 /* XSetWindowAttributes attr; */ 941 /* XSetWindowAttributes attr; */
938 /* Cursor cursor; */ 942 /* Cursor cursor; */
939done: 943done:
940
941#if OFF_FOCUS_FADING
942 if (rs[Rs_fade])
943 {
944 rgba c;
945 pix_colors [Color_fade].get (c);
946 pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c);
947 }
948#endif
949
950 /*TODO: handle Color_BD, scrollbar background, etc. */ 944 /*TODO: handle Color_BD, scrollbar background, etc. */
951 945
946 update_fade_color (idx);
952 recolour_cursor (); 947 recolour_cursor ();
953 scr_recolour (); 948 scr_recolour ();
954} 949}
955 950
956#else 951#else
1033 int fix_screen; 1028 int fix_screen;
1034 int old_width = szHint.width; 1029 int old_width = szHint.width;
1035 int old_height = szHint.height; 1030 int old_height = szHint.height;
1036 1031
1037 window_calc (newwidth, newheight); 1032 window_calc (newwidth, newheight);
1033
1034 if (!HOOK_INVOKE ((this, HOOK_RESIZE_ALL_WINDOWS, DT_INT, newwidth, DT_INT, newheight, DT_END)))
1038 XSetWMNormalHints (dpy, parent[0], &szHint); 1035 XSetWMNormalHints (dpy, parent[0], &szHint);
1039 1036
1040 if (!ignoreparent) 1037 if (!ignoreparent)
1041 { 1038 {
1042#ifdef SMART_RESIZE 1039#ifdef SMART_RESIZE
1043 /* 1040 /*
1117 if (pixmap) 1114 if (pixmap)
1118 scr_touch (false); 1115 scr_touch (false);
1119#endif 1116#endif
1120 1117
1121#ifdef USE_XIM 1118#ifdef USE_XIM
1122 IMSetStatusPosition (); 1119 IMSetPosition ();
1123#endif 1120#endif
1124} 1121}
1125 1122
1126/* 1123/*
1127 * Set the width/height of the vt window in characters. Units are pixels. 1124 * Set the width/height of the vt window in characters. Units are pixels.
1524 preedit_attr, 1521 preedit_attr,
1525 status_attr ? XNStatusAttributes : NULL, 1522 status_attr ? XNStatusAttributes : NULL,
1526 status_attr, NULL); 1523 status_attr, NULL);
1527 1524
1528 if (preedit_attr) XFree (preedit_attr); 1525 if (preedit_attr) XFree (preedit_attr);
1529 if (status_attr) XFree (status_attr); 1526 if (status_attr) XFree (status_attr);
1530 if (fs) XFreeFontSet (dpy, fs); 1527 if (fs) XFreeFontSet (dpy, fs);
1531 1528
1532 if (Input_Context == NULL) 1529 if (Input_Context == NULL)
1533 { 1530 {
1534 rxvt_warn ("failed to create input context, continuing without XIM.\n"); 1531 rxvt_warn ("failed to create input context, continuing without XIM.\n");
1535 im_destroy (); 1532 im_destroy ();
1540 // unfortunately, only the focus window is used by XIM, hard to fix 1537 // unfortunately, only the focus window is used by XIM, hard to fix
1541 if (!XGetICValues (Input_Context, XNFilterEvents, &vt_emask_xim, NULL)) 1538 if (!XGetICValues (Input_Context, XNFilterEvents, &vt_emask_xim, NULL))
1542 vt_select_input (); 1539 vt_select_input ();
1543#endif 1540#endif
1544 1541
1545 if (input_style & XIMPreeditArea)
1546 IMSetStatusPosition (); 1542 IMSetPosition ();
1547 1543
1548 return true; 1544 return true;
1549} 1545}
1550 1546
1551void 1547void
1609 SET_LOCALE (locale); 1605 SET_LOCALE (locale);
1610#endif 1606#endif
1611} 1607}
1612 1608
1613void 1609void
1614rxvt_term::IMSetStatusPosition () 1610rxvt_term::IMSetPosition ()
1615{ 1611{
1616 XRectangle preedit_rect, status_rect, *needed_rect; 1612 XRectangle preedit_rect, status_rect, *needed_rect;
1617 XVaNestedList preedit_attr, status_attr; 1613 XVaNestedList preedit_attr, status_attr;
1618 1614
1619 if (!Input_Context 1615 if (!Input_Context
1620 || !focus 1616 || !focus
1621 || !(input_style & XIMPreeditArea) 1617 || !(input_style & (XIMPreeditArea | XIMPreeditPosition))
1622 || !IMisRunning ()) 1618 || !IMisRunning ())
1623 return; 1619 return;
1624 1620
1621 if (input_style & XIMPreeditPosition)
1622 {
1623 im_set_size (preedit_rect);
1624 preedit_attr = XVaCreateNestedList (0, XNArea, &preedit_rect, NULL);
1625
1626 XSetICValues (Input_Context,
1627 XNPreeditAttributes, preedit_attr, NULL);
1628 }
1629 else
1630 {
1625 /* Getting the necessary width of preedit area */ 1631 /* Getting the necessary width of preedit area */
1626 status_attr = XVaCreateNestedList (0, XNAreaNeeded, &needed_rect, NULL); 1632 status_attr = XVaCreateNestedList (0, XNAreaNeeded, &needed_rect, NULL);
1627 XGetICValues (Input_Context, XNStatusAttributes, status_attr, NULL); 1633 XGetICValues (Input_Context, XNStatusAttributes, status_attr, NULL);
1628 XFree (status_attr); 1634 XFree (status_attr);
1629 1635
1630 im_set_preedit_area (preedit_rect, status_rect, *needed_rect); 1636 im_set_preedit_area (preedit_rect, status_rect, *needed_rect);
1631 XFree (needed_rect); 1637 XFree (needed_rect);
1632 1638
1633 preedit_attr = XVaCreateNestedList (0, XNArea, &preedit_rect, NULL); 1639 preedit_attr = XVaCreateNestedList (0, XNArea, &preedit_rect, NULL);
1634 status_attr = XVaCreateNestedList (0, XNArea, &status_rect, NULL); 1640 status_attr = XVaCreateNestedList (0, XNArea, &status_rect, NULL);
1635 1641
1636 XSetICValues (Input_Context, 1642 XSetICValues (Input_Context,
1637 XNPreeditAttributes, preedit_attr, 1643 XNPreeditAttributes, preedit_attr,
1638 XNStatusAttributes, status_attr, NULL); 1644 XNStatusAttributes, status_attr,
1645 NULL);
1639 1646
1647 XFree (status_attr);
1648 }
1649
1640 XFree (preedit_attr); 1650 XFree (preedit_attr);
1641 XFree (status_attr);
1642} 1651}
1643#endif /* USE_XIM */ 1652#endif /* USE_XIM */
1644 1653
1645/*----------------------- end-of-file (C source) -----------------------*/ 1654/*----------------------- end-of-file (C source) -----------------------*/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines