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.16 by pcg, Thu Dec 18 07:31:19 2003 UTC vs.
Revision 1.17 by pcg, Thu Dec 18 13:33:02 2003 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*
2 * File: main.c 2 * File: main.c
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * $Id: main.C,v 1.16 2003/12/18 07:31:19 pcg Exp $ 4 * $Id: main.C,v 1.17 2003/12/18 13:33:02 pcg Exp $
5 * 5 *
6 * All portions of code are copyright by their respective author/s. 6 * All portions of code are copyright by their respective author/s.
7 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> 7 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
8 * - original version 8 * - original version
9 * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> 9 * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com>
216#ifdef HAVE_SCROLLBARS 216#ifdef HAVE_SCROLLBARS
217 if (Options & Opt_scrollBar) 217 if (Options & Opt_scrollBar)
218 scrollBar.setIdle (); /* set existence for size calculations */ 218 scrollBar.setIdle (); /* set existence for size calculations */
219#endif 219#endif
220 220
221 rxvt_Create_Windows (this, argc, argv); 221 create_windows (argc, argv);
222 222
223 init_xlocale (); 223 init_xlocale ();
224 224
225 scr_reset (); /* initialize screen */ 225 scr_reset (); /* initialize screen */
226#ifdef RXVT_GRAPHICS 226#ifdef RXVT_GRAPHICS
233#endif 233#endif
234#endif 234#endif
235 235
236#ifdef HAVE_SCROLLBARS 236#ifdef HAVE_SCROLLBARS
237 if (Options & Opt_scrollBar) 237 if (Options & Opt_scrollBar)
238 rxvt_Resize_scrollBar (this); /* create and map scrollbar */ 238 resize_scrollbar (); /* create and map scrollbar */
239#endif 239#endif
240#if (MENUBAR_MAX) 240#if (MENUBAR_MAX)
241 if (menubar_visible(r)) 241 if (menubar_visible(r))
242 XMapWindow (Xdisplay, menuBar.win); 242 XMapWindow (Xdisplay, menuBar.win);
243#endif 243#endif
521/*----------------------------------------------------------------------*/ 521/*----------------------------------------------------------------------*/
522/* 522/*
523 * window size/position calculcations for XSizeHint and other storage. 523 * window size/position calculcations for XSizeHint and other storage.
524 * if width/height are non-zero then override calculated width/height 524 * if width/height are non-zero then override calculated width/height
525 */ 525 */
526/* EXTPROTO */
527void 526void
528rxvt_window_calc(pR_ unsigned int width, unsigned int height) 527rxvt_term::window_calc (unsigned int width, unsigned int height)
529{ 528{
530 short recalc_x, recalc_y; 529 short recalc_x, recalc_y;
531 int x, y, sb_w, mb_h, flags; 530 int x, y, sb_w, mb_h, flags;
532 unsigned int w, h; 531 unsigned int w, h;
533 unsigned int max_width, max_height; 532 unsigned int max_width, max_height;
534 533
535 D_SIZE((stderr, "< Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d", 534 D_SIZE((stderr, "< Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d",
536 R->TermWin.ncol, R->TermWin.nrow, R->szHint.width, 535 TermWin.ncol, TermWin.nrow, szHint.width,
537 R->szHint.height)); 536 szHint.height));
538 R->szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; 537 szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity;
539 R->szHint.win_gravity = NorthWestGravity; 538 szHint.win_gravity = NorthWestGravity;
540/* R->szHint.min_aspect.x = R->szHint.min_aspect.y = 1; */ 539/* szHint.min_aspect.x = szHint.min_aspect.y = 1; */
541 540
542 recalc_x = recalc_y = 0; 541 recalc_x = recalc_y = 0;
543 flags = 0; 542 flags = 0;
544 if (!R->parsed_geometry) { 543 if (!parsed_geometry) {
545 R->parsed_geometry = 1; 544 parsed_geometry = 1;
546 if (R->rs[Rs_geometry]) 545 if (rs[Rs_geometry])
547 flags = XParseGeometry(R->rs[Rs_geometry], &x, &y, &w, &h); 546 flags = XParseGeometry(rs[Rs_geometry], &x, &y, &w, &h);
548 if (flags & WidthValue) { 547 if (flags & WidthValue) {
549 R->TermWin.ncol = BOUND_POSITIVE_INT16(w); 548 TermWin.ncol = BOUND_POSITIVE_INT16(w);
550 R->szHint.flags |= USSize; 549 szHint.flags |= USSize;
551 } 550 }
552 if (flags & HeightValue) { 551 if (flags & HeightValue) {
553 R->TermWin.nrow = BOUND_POSITIVE_INT16(h); 552 TermWin.nrow = BOUND_POSITIVE_INT16(h);
554 R->szHint.flags |= USSize; 553 szHint.flags |= USSize;
555 } 554 }
556 if (flags & XValue) { 555 if (flags & XValue) {
557 R->szHint.x = x; 556 szHint.x = x;
558 R->szHint.flags |= USPosition; 557 szHint.flags |= USPosition;
559 if (flags & XNegative) { 558 if (flags & XNegative) {
560 recalc_x = 1; 559 recalc_x = 1;
561 R->szHint.win_gravity = NorthEastGravity; 560 szHint.win_gravity = NorthEastGravity;
562 } 561 }
563 } 562 }
564 if (flags & YValue) { 563 if (flags & YValue) {
565 R->szHint.y = y; 564 szHint.y = y;
566 R->szHint.flags |= USPosition; 565 szHint.flags |= USPosition;
567 if (flags & YNegative) { 566 if (flags & YNegative) {
568 recalc_y = 1; 567 recalc_y = 1;
569 if (R->szHint.win_gravity == NorthEastGravity) 568 if (szHint.win_gravity == NorthEastGravity)
570 R->szHint.win_gravity = SouthEastGravity; 569 szHint.win_gravity = SouthEastGravity;
571 else 570 else
572 R->szHint.win_gravity = SouthWestGravity; 571 szHint.win_gravity = SouthWestGravity;
573 } 572 }
574 } 573 }
575 } 574 }
576/* TODO: BOUNDS */ 575/* TODO: BOUNDS */
577 R->TermWin.width = R->TermWin.ncol * R->TermWin.fwidth; 576 TermWin.width = TermWin.ncol * TermWin.fwidth;
578 R->TermWin.height = R->TermWin.nrow * R->TermWin.fheight; 577 TermWin.height = TermWin.nrow * TermWin.fheight;
579 max_width = MAX_COLS * R->TermWin.fwidth; 578 max_width = MAX_COLS * TermWin.fwidth;
580 max_height = MAX_ROWS * R->TermWin.fheight; 579 max_height = MAX_ROWS * TermWin.fheight;
581 580
582 R->szHint.base_width = R->szHint.base_height = 2 * R->TermWin.int_bwidth; 581 szHint.base_width = szHint.base_height = 2 * TermWin.int_bwidth;
583 582
584 sb_w = mb_h = 0; 583 sb_w = mb_h = 0;
585 R->window_vt_x = R->window_vt_y = 0; 584 window_vt_x = window_vt_y = 0;
586 if (scrollbar_visible(R)) { 585 if (scrollbar_visible (this)) {
587 sb_w = scrollbar_TotalWidth(); 586 sb_w = scrollbar_TotalWidth();
588 R->szHint.base_width += sb_w; 587 szHint.base_width += sb_w;
589 if (!(R->Options & Opt_scrollBar_right)) 588 if (!(Options & Opt_scrollBar_right))
590 R->window_vt_x = sb_w; 589 window_vt_x = sb_w;
591 } 590 }
592 if (menubar_visible(R)) { 591 if (menubar_visible (this)) {
593 mb_h = menuBar_TotalHeight(); 592 mb_h = menuBar_TotalHeight();
594 R->szHint.base_height += mb_h; 593 szHint.base_height += mb_h;
595 R->window_vt_y = mb_h; 594 window_vt_y = mb_h;
596 } 595 }
597 R->szHint.width_inc = R->TermWin.fwidth; 596 szHint.width_inc = TermWin.fwidth;
598 R->szHint.height_inc = R->TermWin.fheight; 597 szHint.height_inc = TermWin.fheight;
599 R->szHint.min_width = R->szHint.base_width + R->szHint.width_inc; 598 szHint.min_width = szHint.base_width + szHint.width_inc;
600 R->szHint.min_height = R->szHint.base_height + R->szHint.height_inc; 599 szHint.min_height = szHint.base_height + szHint.height_inc;
601 600
602 if (width && width - R->szHint.base_width < max_width) { 601 if (width && width - szHint.base_width < max_width) {
603 R->szHint.width = width; 602 szHint.width = width;
604 R->TermWin.width = width - R->szHint.base_width; 603 TermWin.width = width - szHint.base_width;
605 } else { 604 } else {
606 MIN_IT(R->TermWin.width, max_width); 605 MIN_IT(TermWin.width, max_width);
607 R->szHint.width = R->szHint.base_width + R->TermWin.width; 606 szHint.width = szHint.base_width + TermWin.width;
608 } 607 }
609 if (height && height - R->szHint.base_height < max_height) { 608 if (height && height - szHint.base_height < max_height) {
610 R->szHint.height = height; 609 szHint.height = height;
611 R->TermWin.height = height - R->szHint.base_height; 610 TermWin.height = height - szHint.base_height;
612 } else { 611 } else {
613 MIN_IT(R->TermWin.height, max_height); 612 MIN_IT(TermWin.height, max_height);
614 R->szHint.height = R->szHint.base_height + R->TermWin.height; 613 szHint.height = szHint.base_height + TermWin.height;
615 } 614 }
616 if (scrollbar_visible(R) && (R->Options & Opt_scrollBar_right)) 615 if (scrollbar_visible (this) && (Options & Opt_scrollBar_right))
617 R->window_sb_x = R->szHint.width - sb_w; 616 window_sb_x = szHint.width - sb_w;
618 617
619 if (recalc_x) 618 if (recalc_x)
620 R->szHint.x += (DisplayWidth(R->Xdisplay, Xscreen) 619 szHint.x += (DisplayWidth (Xdisplay, DefaultScreen (Xdisplay))
621 - R->szHint.width - 2 * R->TermWin.ext_bwidth); 620 - szHint.width - 2 * TermWin.ext_bwidth);
622 if (recalc_y) 621 if (recalc_y)
623 R->szHint.y += (DisplayHeight(R->Xdisplay, Xscreen) 622 szHint.y += (DisplayHeight (Xdisplay, DefaultScreen (Xdisplay))
624 - R->szHint.height - 2 * R->TermWin.ext_bwidth); 623 - szHint.height - 2 * TermWin.ext_bwidth);
625 624
626 R->TermWin.ncol = R->TermWin.width / R->TermWin.fwidth; 625 TermWin.ncol = TermWin.width / TermWin.fwidth;
627 R->TermWin.nrow = R->TermWin.height / R->TermWin.fheight; 626 TermWin.nrow = TermWin.height / TermWin.fheight;
628 D_SIZE((stderr, "> Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d", 627 D_SIZE((stderr, "> Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d",
629 R->TermWin.ncol, R->TermWin.nrow, R->szHint.width, 628 TermWin.ncol, TermWin.nrow, szHint.width,
630 R->szHint.height)); 629 szHint.height));
631 return; 630 return;
632} 631}
633 632
634/*----------------------------------------------------------------------*/ 633/*----------------------------------------------------------------------*/
635/* 634/*
864} 863}
865 864
866/* -------------------------------------------------------------------- * 865/* -------------------------------------------------------------------- *
867 * - WINDOW RESIZING - * 866 * - WINDOW RESIZING - *
868 * -------------------------------------------------------------------- */ 867 * -------------------------------------------------------------------- */
869/* EXTPROTO */
870void 868void
871rxvt_resize_all_windows(pR_ unsigned int width, unsigned int height, 869rxvt_term::resize_all_windows (unsigned int width, unsigned int height, int ignoreparent)
872 int ignoreparent)
873{ 870{
874 int fix_screen; 871 int fix_screen;
875 872
876#ifdef SMART_RESIZE 873#ifdef SMART_RESIZE
877 int old_width = R->szHint.width, old_height = R->szHint.height; 874 int old_width = szHint.width, old_height = szHint.height;
878#endif 875#endif
879 876
880 rxvt_window_calc(aR_ width, height); 877 window_calc (width, height);
881 XSetWMNormalHints(R->Xdisplay, R->TermWin.parent[0], &R->szHint); 878 XSetWMNormalHints (Xdisplay, TermWin.parent[0], &szHint);
882 if (!ignoreparent) { 879 if (!ignoreparent)
880 {
883#ifdef SMART_RESIZE 881#ifdef SMART_RESIZE
884/* 882 /*
885 * resize by Marius Gedminas <marius.gedminas@uosis.mif.vu.lt> 883 * resize by Marius Gedminas <marius.gedminas@uosis.mif.vu.lt>
886 * reposition window on resize depending on placement on screen 884 * reposition window on resize depending on placement on screen
887 */ 885 */
888 int x, y, x1, y1; 886 int x, y, x1, y1;
889 int dx, dy; 887 int dx, dy;
890 unsigned int unused_w1, unused_h1, unused_b1, unused_d1; 888 unsigned int unused_w1, unused_h1, unused_b1, unused_d1;
891 Window unused_cr; 889 Window unused_cr;
892 890
893 XTranslateCoordinates(R->Xdisplay, R->TermWin.parent[0], Xroot, 891 XTranslateCoordinates (Xdisplay, TermWin.parent[0], Xroot,
894 0, 0, &x, &y, &unused_cr); 892 0, 0, &x, &y, &unused_cr);
895 XGetGeometry(R->Xdisplay, R->TermWin.parent[0], &unused_cr, &x1, &y1, 893 XGetGeometry (Xdisplay, TermWin.parent[0], &unused_cr, &x1, &y1,
896 &unused_w1, &unused_h1, &unused_b1, &unused_d1); 894 &unused_w1, &unused_h1, &unused_b1, &unused_d1);
897 /* 895 /*
898 * if Xroot isn't the parent window, a WM will probably have offset 896 * if Xroot isn't the parent window, a WM will probably have offset
899 * our position for handles and decorations. Counter it 897 * our position for handles and decorations. Counter it
900 */ 898 */
901 if (x1 != x || y1 != y) { 899 if (x1 != x || y1 != y) {
902 x -= x1; 900 x -= x1;
903 y -= y1; 901 y -= y1;
902 }
903
904 x1 = (DisplayWidth (Xdisplay, Xscreen) - old_width) / 2;
905 y1 = (DisplayHeight (Xdisplay, Xscreen) - old_height) / 2;
906 dx = old_width - szHint.width;
907 dy = old_height - szHint.height;
908
909 /* Check position of the center of the window */
910 if (x < x1) /* left half */
911 dx = 0;
912 else if (x == x1) /* exact center */
913 dx /= 2;
914 if (y < y1) /* top half */
915 dy = 0;
916 else if (y == y1) /* exact center */
917 dy /= 2;
918
919 XMoveResizeWindow (Xdisplay, TermWin.parent[0], x + dx, y + dy,
920 szHint.width, szHint.height);
921#else
922 XResizeWindow (Xdisplay, TermWin.parent[0], szHint.width,
923 szHint.height);
924#endif
925 }
926
927 fix_screen = (TermWin.ncol != prev_ncol
928 || TermWin.nrow != prev_nrow);
929
930 if (fix_screen || width != old_width || height != old_height)
931 {
932 if (scrollbar_visible (this))
933 {
934 XMoveResizeWindow (Xdisplay, scrollBar.win, window_sb_x,
935 0, scrollbar_TotalWidth (), szHint.height);
936 resize_scrollbar ();
904 } 937 }
905 938
906 x1 = (DisplayWidth(R->Xdisplay, Xscreen) - old_width) / 2; 939 if (menubar_visible (this))
907 y1 = (DisplayHeight(R->Xdisplay, Xscreen) - old_height) / 2; 940 XMoveResizeWindow (Xdisplay, menuBar.win, window_vt_x,
908 dx = old_width - R->szHint.width; 941 0, TermWin_TotalWidth (), menuBar_TotalHeight ());
909 dy = old_height - R->szHint.height;
910 942
911 /* Check position of the center of the window */ 943 XMoveResizeWindow (Xdisplay, TermWin.vt, window_vt_x,
912 if (x < x1) /* left half */ 944 window_vt_y, TermWin_TotalWidth (),
913 dx = 0; 945 TermWin_TotalHeight ());
914 else if (x == x1) /* exact center */ 946#ifdef RXVT_GRAPHICS
915 dx /= 2; 947 if (old_height)
916 if (y < y1) /* top half */ 948 rxvt_Gr_Resize (this, old_width - szHint.base_width,
917 dy = 0;
918 else if (y == y1) /* exact center */
919 dy /= 2;
920
921 XMoveResizeWindow(R->Xdisplay, R->TermWin.parent[0], x + dx, y + dy,
922 R->szHint.width, R->szHint.height);
923#else
924 XResizeWindow(R->Xdisplay, R->TermWin.parent[0], R->szHint.width,
925 R->szHint.height); 949 old_height - szHint.base_height);
926#endif 950#endif
951 scr_clear ();
952#ifdef XPM_BACKGROUND
953 rxvt_resize_pixmap (this);
954#endif
955 }
956
957 if (fix_screen || old_height == 0)
927 } 958 {
959 int curr_screen = -1;
960 uint16_t old_ncol = prev_ncol;
928 961
929 fix_screen = (R->TermWin.ncol != R->prev_ncol 962 /* scr_reset only works on the primary screen */
930 || R->TermWin.nrow != R->prev_nrow); 963 if (old_height) /* this is not the first time through */
931 if (fix_screen || width != R->old_width || height != R->old_height) { 964 curr_screen = rxvt_scr_change_screen (this, PRIMARY);
932 if (scrollbar_visible(R)) { 965
933 XMoveResizeWindow(R->Xdisplay, R->scrollBar.win, R->window_sb_x, 966 scr_reset();
934 0, scrollbar_TotalWidth(), R->szHint.height); 967
935 rxvt_Resize_scrollBar(aR); 968 if (curr_screen >= 0) /* this is not the first time through */
969 {
970 rxvt_scr_change_screen (this, curr_screen);
971 rxvt_selection_check (this, old_ncol != TermWin.ncol ? 4 : 0);
936 } 972 }
937 if (menubar_visible(R))
938 XMoveResizeWindow(R->Xdisplay, R->menuBar.win, R->window_vt_x,
939 0, TermWin_TotalWidth(), menuBar_TotalHeight());
940 XMoveResizeWindow(R->Xdisplay, R->TermWin.vt, R->window_vt_x,
941 R->window_vt_y, TermWin_TotalWidth(),
942 TermWin_TotalHeight());
943#ifdef RXVT_GRAPHICS
944 if (R->old_height)
945 rxvt_Gr_Resize(aR_ R->old_width - R->szHint.base_width,
946 R->old_height - R->szHint.base_height);
947#endif
948 rxvt_scr_clear(aR);
949#ifdef XPM_BACKGROUND
950 rxvt_resize_pixmap(aR);
951#endif
952 } 973 }
953 974
954 if (fix_screen || R->old_height == 0) {
955 int curr_screen = -1;
956 uint16_t old_ncol = R->prev_ncol;
957
958 /* scr_reset only works on the primary screen */
959 if (R->old_height) /* this is not the first time through */
960 curr_screen = rxvt_scr_change_screen(aR_ PRIMARY);
961
962 R->scr_reset();
963
964 if (curr_screen >= 0) { /* this is not the first time through */
965 rxvt_scr_change_screen(aR_ curr_screen);
966 rxvt_selection_check(aR_(old_ncol != R->TermWin.ncol ? 4 : 0));
967 }
968 }
969
970 R->old_width = R->szHint.width; 975 old_width = szHint.width;
971 R->old_height = R->szHint.height; 976 old_height = szHint.height;
972 977
973#ifdef USE_XIM 978#ifdef USE_XIM
974 rxvt_IMSetStatusPosition(aR); 979 rxvt_IMSetStatusPosition (this);
975#endif 980#endif
976} 981}
977 982
978/* 983/*
979 * Set the width/height of the vt window in characters. Units are pixels. 984 * Set the width/height of the vt window in characters. Units are pixels.
993 height = wattr.height - R->szHint.base_height; 998 height = wattr.height - R->szHint.base_height;
994 } 999 }
995 if (width != R->TermWin.width || height != R->TermWin.height) { 1000 if (width != R->TermWin.width || height != R->TermWin.height) {
996 width += R->szHint.base_width; 1001 width += R->szHint.base_width;
997 height += R->szHint.base_height; 1002 height += R->szHint.base_height;
998 rxvt_resize_all_windows(aR_ width, height, 0); 1003 R->resize_all_windows (width, height, 0);
999 } 1004 }
1000} 1005}
1001 1006
1002/* -------------------------------------------------------------------- * 1007/* -------------------------------------------------------------------- *
1003 * - X INPUT METHOD ROUTINES - * 1008 * - X INPUT METHOD ROUTINES - *
1004 * -------------------------------------------------------------------- */ 1009 * -------------------------------------------------------------------- */
1005#ifdef USE_XIM 1010#ifdef USE_XIM
1006/* INTPROTO */
1007void 1011void
1008rxvt_setSize(pR_ XRectangle * size) 1012rxvt_term::set_size (XRectangle *size)
1009{ 1013{
1010 size->x = R->TermWin.int_bwidth; 1014 size->x = TermWin.int_bwidth;
1011 size->y = R->TermWin.int_bwidth; 1015 size->y = TermWin.int_bwidth;
1012 size->width = Width2Pixel(R->TermWin.ncol); 1016 size->width = Width2Pixel(TermWin.ncol);
1013 size->height = Height2Pixel(R->TermWin.nrow); 1017 size->height = Height2Pixel(TermWin.nrow);
1014} 1018}
1015 1019
1016/* INTPROTO */
1017void 1020void
1018rxvt_setColor(pR_ unsigned long *fg, unsigned long *bg) 1021rxvt_term::set_color (unsigned long *fg, unsigned long *bg)
1019{ 1022{
1020 *fg = R->PixColors[Color_fg]; 1023 *fg = PixColors[Color_fg];
1021 *bg = R->PixColors[Color_bg]; 1024 *bg = PixColors[Color_bg];
1022} 1025}
1023 1026
1024/* Checking whether input method is running. */ 1027/* Checking whether input method is running. */
1025/* INTPROTO */ 1028/* INTPROTO */
1026Bool 1029Bool
1061 || R->event_type == SelectionNotify 1064 || R->event_type == SelectionNotify
1062 || R->event_type == ButtonRelease || R->event_type == FocusIn) 1065 || R->event_type == ButtonRelease || R->event_type == FocusIn)
1063 || !rxvt_IMisRunning(aR)) 1066 || !rxvt_IMisRunning(aR))
1064 return; 1067 return;
1065 1068
1066 rxvt_setPosition(aR_ & spot); 1069 R->set_position (&spot);
1067 1070
1068 preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL); 1071 preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL);
1069 XSetICValues(R->Input_Context, XNPreeditAttributes, preedit_attr, NULL); 1072 XSetICValues(R->Input_Context, XNPreeditAttributes, preedit_attr, NULL);
1070 XFree(preedit_attr); 1073 XFree(preedit_attr);
1071} 1074}
1072 1075
1073/* INTPROTO */
1074void 1076void
1075rxvt_setPreeditArea (pR_ XRectangle * preedit_rect, XRectangle * status_rect, 1077rxvt_term::set_preedit_area (XRectangle * preedit_rect, XRectangle * status_rect,
1076 XRectangle * needed_rect) 1078 XRectangle * needed_rect)
1077{ 1079{
1078 int mbh, vtx = 0; 1080 int mbh, vtx = 0;
1079 1081
1080 if (scrollbar_visible(R) && !(R->Options & Opt_scrollBar_right)) 1082 if (scrollbar_visible (this) && !(Options & Opt_scrollBar_right))
1081 vtx = scrollbar_TotalWidth(); 1083 vtx = scrollbar_TotalWidth();
1084
1082 mbh = menubar_visible(R) ? menuBar_TotalHeight() : 0; 1085 mbh = menubar_visible (this) ? menuBar_TotalHeight() : 0;
1083 mbh -= R->TermWin.lineSpace; 1086 mbh -= TermWin.lineSpace;
1084 1087
1085 preedit_rect->x = needed_rect->width + vtx; 1088 preedit_rect->x = needed_rect->width + vtx;
1086 preedit_rect->y = Height2Pixel(R->TermWin.nrow - 1) + mbh; 1089 preedit_rect->y = Height2Pixel(TermWin.nrow - 1) + mbh;
1087 1090
1088 preedit_rect->width = Width2Pixel(R->TermWin.ncol + 1) - needed_rect->width 1091 preedit_rect->width = Width2Pixel(TermWin.ncol + 1) - needed_rect->width + vtx;
1089 + vtx;
1090 preedit_rect->height = Height2Pixel(1); 1092 preedit_rect->height = Height2Pixel(1);
1091 1093
1092 status_rect->x = vtx; 1094 status_rect->x = vtx;
1093 status_rect->y = Height2Pixel(R->TermWin.nrow - 1) + mbh; 1095 status_rect->y = Height2Pixel(TermWin.nrow - 1) + mbh;
1094 1096
1095 status_rect->width = needed_rect->width ? needed_rect->width 1097 status_rect->width = needed_rect->width ? needed_rect->width : Width2Pixel(TermWin.ncol + 1);
1096 : Width2Pixel(R->TermWin.ncol + 1);
1097 status_rect->height = Height2Pixel(1); 1098 status_rect->height = Height2Pixel(1);
1098} 1099}
1099 1100
1100/* ARGSUSED */ 1101/* ARGSUSED */
1101/* INTPROTO */ 1102/* INTPROTO */
1102void 1103void
1176 XSetIMValues(xim, XNDestroyCallback, &ximcallback, NULL); 1177 XSetIMValues(xim, XNDestroyCallback, &ximcallback, NULL);
1177 1178
1178 preedit_attr = status_attr = NULL; 1179 preedit_attr = status_attr = NULL;
1179 1180
1180 if (R->input_style & XIMPreeditPosition) { 1181 if (R->input_style & XIMPreeditPosition) {
1181 rxvt_setSize(aR_ & rect); 1182 R->set_size (&rect);
1182 rxvt_setPosition(aR_ & spot); 1183 R->set_position (&spot);
1183 rxvt_setColor(aR_ & fg, &bg); 1184 R->set_color (&fg, &bg);
1184 1185
1185 preedit_attr = XVaCreateNestedList(0, XNArea, &rect, 1186 preedit_attr = XVaCreateNestedList(0, XNArea, &rect,
1186 XNSpotLocation, &spot, 1187 XNSpotLocation, &spot,
1187 XNForeground, fg, XNBackground, bg, 1188 XNForeground, fg, XNBackground, bg,
1188 //XNFontSet, R->TermWin.fontset, 1189 //XNFontSet, R->TermWin.fontset,
1189 NULL); 1190 NULL);
1190 } else if (R->input_style & XIMPreeditArea) { 1191 } else if (R->input_style & XIMPreeditArea) {
1191 rxvt_setColor(aR_ & fg, &bg); 1192 R->set_color (&fg, &bg);
1192 1193
1193 /* 1194 /*
1194 * The necessary width of preedit area is unknown 1195 * The necessary width of preedit area is unknown
1195 * until create input context. 1196 * until create input context.
1196 */ 1197 */
1197 needed_rect.width = 0; 1198 needed_rect.width = 0;
1198 1199
1199 rxvt_setPreeditArea(aR_ & rect, &status_rect, &needed_rect); 1200 R->set_preedit_area(&rect, &status_rect, &needed_rect);
1200 1201
1201 preedit_attr = XVaCreateNestedList(0, XNArea, &rect, 1202 preedit_attr = XVaCreateNestedList(0, XNArea, &rect,
1202 XNForeground, fg, XNBackground, bg, 1203 XNForeground, fg, XNBackground, bg,
1203 //XNFontSet, R->TermWin.fontset, 1204 //XNFontSet, R->TermWin.fontset,
1204 NULL); 1205 NULL);
1319/* Getting the necessary width of preedit area */ 1320/* Getting the necessary width of preedit area */
1320 status_attr = XVaCreateNestedList(0, XNAreaNeeded, &needed_rect, NULL); 1321 status_attr = XVaCreateNestedList(0, XNAreaNeeded, &needed_rect, NULL);
1321 XGetICValues(R->Input_Context, XNStatusAttributes, status_attr, NULL); 1322 XGetICValues(R->Input_Context, XNStatusAttributes, status_attr, NULL);
1322 XFree(status_attr); 1323 XFree(status_attr);
1323 1324
1324 rxvt_setPreeditArea(aR_ & preedit_rect, &status_rect, needed_rect); 1325 R->set_preedit_area(&preedit_rect, &status_rect, needed_rect);
1325 1326
1326 preedit_attr = XVaCreateNestedList(0, XNArea, &preedit_rect, NULL); 1327 preedit_attr = XVaCreateNestedList(0, XNArea, &preedit_rect, NULL);
1327 status_attr = XVaCreateNestedList(0, XNArea, &status_rect, NULL); 1328 status_attr = XVaCreateNestedList(0, XNArea, &status_rect, NULL);
1328 1329
1329 XSetICValues(R->Input_Context, 1330 XSetICValues(R->Input_Context,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines