… | |
… | |
72 | free (p); |
72 | free (p); |
73 | } |
73 | } |
74 | |
74 | |
75 | rxvt_term::rxvt_term () |
75 | rxvt_term::rxvt_term () |
76 | : |
76 | : |
|
|
77 | rootwin_ev (this, &rxvt_term::rootwin_cb), |
|
|
78 | termwin_ev (this, &rxvt_term::x_cb), |
|
|
79 | vt_ev (this, &rxvt_term::x_cb), |
|
|
80 | #ifdef HAVE_SCROLLBARS |
|
|
81 | scrollbar_ev (this, &rxvt_term::x_cb), |
|
|
82 | #endif |
|
|
83 | #ifdef MENUBAR |
|
|
84 | menubar_ev (this, &rxvt_term::x_cb), fixme |
|
|
85 | #endif |
77 | #ifdef CURSOR_BLINK |
86 | #ifdef CURSOR_BLINK |
78 | cursor_blink_ev (this, &rxvt_term::cursor_blink_cb), |
87 | cursor_blink_ev (this, &rxvt_term::cursor_blink_cb), |
79 | #endif |
88 | #endif |
80 | #ifdef TEXT_BLINK |
89 | #ifdef TEXT_BLINK |
81 | text_blink_ev (this, &rxvt_term::text_blink_cb), |
90 | text_blink_ev (this, &rxvt_term::text_blink_cb), |
… | |
… | |
84 | pointer_ev (this, &rxvt_term::pointer_cb), |
93 | pointer_ev (this, &rxvt_term::pointer_cb), |
85 | #endif |
94 | #endif |
86 | check_ev (this, &rxvt_term::check_cb), |
95 | check_ev (this, &rxvt_term::check_cb), |
87 | destroy_ev (this, &rxvt_term::destroy_cb), |
96 | destroy_ev (this, &rxvt_term::destroy_cb), |
88 | pty_ev (this, &rxvt_term::pty_cb), |
97 | pty_ev (this, &rxvt_term::pty_cb), |
89 | x_ev (this, &rxvt_term::x_cb), |
|
|
90 | incr_ev (this, &rxvt_term::incr_cb) |
98 | incr_ev (this, &rxvt_term::incr_cb), |
|
|
99 | #ifdef USE_XIM |
|
|
100 | im_ev (this, &rxvt_term::im_cb) |
|
|
101 | #endif |
91 | { |
102 | { |
92 | cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; |
103 | cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; |
93 | } |
104 | } |
94 | |
105 | |
95 | rxvt_term::~rxvt_term () |
106 | rxvt_term::~rxvt_term () |
96 | { |
107 | { |
|
|
108 | if (cmd_fd >= 0) |
|
|
109 | close (cmd_fd); |
|
|
110 | |
97 | scr_release (); |
111 | scr_release (); |
98 | |
112 | |
99 | free (locale); |
113 | free (locale); |
100 | free (codeset); |
114 | free (codeset); |
101 | |
115 | |
… | |
… | |
103 | privileged_ttydev (RESTORE); |
117 | privileged_ttydev (RESTORE); |
104 | #endif |
118 | #endif |
105 | #ifdef UTMP_SUPPORT |
119 | #ifdef UTMP_SUPPORT |
106 | privileged_utmp (RESTORE); |
120 | privileged_utmp (RESTORE); |
107 | #endif |
121 | #endif |
|
|
122 | |
|
|
123 | // TODO: free pixcolours, colours should become part of rxvt_display |
|
|
124 | |
|
|
125 | delete PixColors; |
|
|
126 | |
|
|
127 | displays.put (display); |
|
|
128 | } |
|
|
129 | |
|
|
130 | void |
|
|
131 | rxvt_term::destroy () |
|
|
132 | { |
|
|
133 | if (display) |
|
|
134 | { |
|
|
135 | if (TermWin.parent[0]) |
|
|
136 | XDestroyWindow (display->display, TermWin.parent[0]); |
|
|
137 | |
|
|
138 | termwin_ev.stop (display); |
|
|
139 | vt_ev.stop (display); |
|
|
140 | |
108 | #ifdef USE_XIM |
141 | #ifdef USE_XIM |
109 | if (Input_Context != NULL) |
142 | im_destroy (); |
|
|
143 | im_ev.stop (display); |
|
|
144 | #endif |
|
|
145 | #ifdef HAVE_SCROLLBARS |
|
|
146 | scrollbar_ev.stop (display); |
|
|
147 | #endif |
|
|
148 | #ifdef MENUBAR |
|
|
149 | menubar_ev.stop (display); |
|
|
150 | #endif |
110 | { |
151 | } |
111 | XDestroyIC (Input_Context); |
|
|
112 | Input_Context = NULL; |
|
|
113 | } |
|
|
114 | #endif |
|
|
115 | |
152 | |
116 | if (cmd_fd >= 0) |
|
|
117 | close (cmd_fd); |
|
|
118 | |
|
|
119 | if (Xfd >= 0) |
|
|
120 | XCloseDisplay (Xdisplay); |
|
|
121 | |
|
|
122 | delete PixColors; |
|
|
123 | } |
|
|
124 | |
|
|
125 | void |
|
|
126 | rxvt_term::destroy () |
|
|
127 | { |
|
|
128 | check_ev.stop (); |
153 | check_ev.stop (); |
129 | pty_ev.stop (); |
154 | pty_ev.stop (); |
130 | x_ev.stop (); |
|
|
131 | #ifdef CURSOR_BLINK |
155 | #ifdef CURSOR_BLINK |
132 | cursor_blink_ev.stop (); |
156 | cursor_blink_ev.stop (); |
133 | #endif |
157 | #endif |
134 | #ifdef TEXT_BLINK |
158 | #ifdef TEXT_BLINK |
135 | text_blink_ev.stop (); |
159 | text_blink_ev.stop (); |
… | |
… | |
163 | SET_R (0); |
187 | SET_R (0); |
164 | } |
188 | } |
165 | |
189 | |
166 | return GET_R; |
190 | return GET_R; |
167 | } |
191 | } |
|
|
192 | |
|
|
193 | static int (*old_xerror_handler)(Display *dpy, XErrorEvent *event); |
168 | |
194 | |
169 | void |
195 | void |
170 | rxvt_init_signals () |
196 | rxvt_init_signals () |
171 | { |
197 | { |
172 | /* install exit handler for cleanup */ |
198 | /* install exit handler for cleanup */ |
… | |
… | |
189 | sa.sa_handler = rxvt_Child_signal; sigaction (SIGCHLD, &sa, 0); |
215 | sa.sa_handler = rxvt_Child_signal; sigaction (SIGCHLD, &sa, 0); |
190 | |
216 | |
191 | /* need to trap SIGURG for SVR4 (Unixware) rlogin */ |
217 | /* need to trap SIGURG for SVR4 (Unixware) rlogin */ |
192 | /* signal (SIGURG, SIG_DFL); */ |
218 | /* signal (SIGURG, SIG_DFL); */ |
193 | |
219 | |
194 | XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler); |
220 | old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler); |
195 | //XSetIOErrorHandler ((XErrorHandler) rxvt_xioerror_handler); |
221 | //XSetIOErrorHandler ((XErrorHandler) rxvt_xioerror_handler); |
196 | } |
222 | } |
197 | |
223 | |
198 | bool |
224 | bool |
199 | rxvt_term::init (int argc, const char *const *argv) |
225 | rxvt_term::init (int argc, const char *const *argv) |
… | |
… | |
231 | Gr_reset (); /* reset graphics */ |
257 | Gr_reset (); /* reset graphics */ |
232 | #endif |
258 | #endif |
233 | |
259 | |
234 | #if 0 |
260 | #if 0 |
235 | #ifdef DEBUG_X |
261 | #ifdef DEBUG_X |
236 | XSynchronize(Xdisplay, True); |
262 | XSynchronize(display->display, True); |
237 | #endif |
263 | #endif |
238 | #endif |
264 | #endif |
239 | |
265 | |
240 | #ifdef HAVE_SCROLLBARS |
266 | #ifdef HAVE_SCROLLBARS |
241 | if (Options & Opt_scrollBar) |
267 | if (Options & Opt_scrollBar) |
242 | resize_scrollbar (); /* create and map scrollbar */ |
268 | resize_scrollbar (); /* create and map scrollbar */ |
243 | #endif |
269 | #endif |
244 | #if (MENUBAR_MAX) |
270 | #if (MENUBAR_MAX) |
245 | if (menubar_visible(r)) |
271 | if (menubar_visible(r)) |
246 | XMapWindow (Xdisplay, menuBar.win); |
272 | XMapWindow (display->display, menuBar.win); |
247 | #endif |
273 | #endif |
248 | #ifdef TRANSPARENT |
274 | #ifdef TRANSPARENT |
249 | if (Options & Opt_transparent) |
275 | if (Options & Opt_transparent) |
250 | { |
276 | { |
251 | XSelectInput (Xdisplay, Xroot, PropertyChangeMask); |
277 | XSelectInput (display->display, display->root, PropertyChangeMask); |
252 | check_our_parents (); |
278 | check_our_parents (); |
253 | } |
279 | } |
254 | #endif |
280 | #endif |
|
|
281 | |
|
|
282 | rootwin_ev.start (display, display->root); |
|
|
283 | |
255 | XMapWindow (Xdisplay, TermWin.vt); |
284 | XMapWindow (display->display, TermWin.vt); |
256 | XMapWindow (Xdisplay, TermWin.parent[0]); |
285 | XMapWindow (display->display, TermWin.parent[0]); |
257 | |
286 | |
258 | init_env (); |
287 | init_env (); |
259 | init_command (cmd_argv); |
288 | init_command (cmd_argv); |
260 | |
289 | |
261 | x_ev.start (Xfd, EVENT_READ); |
|
|
262 | pty_ev.start (cmd_fd, EVENT_READ); |
290 | pty_ev.start (cmd_fd, EVENT_READ); |
263 | |
291 | |
264 | check_ev.start (); |
292 | check_ev.start (); |
265 | |
|
|
266 | process_x_events (); |
|
|
267 | |
293 | |
268 | return true; |
294 | return true; |
269 | } |
295 | } |
270 | |
296 | |
271 | /* ------------------------------------------------------------------------- * |
297 | /* ------------------------------------------------------------------------- * |
… | |
… | |
295 | */ |
321 | */ |
296 | /* EXTPROTO */ |
322 | /* EXTPROTO */ |
297 | RETSIGTYPE |
323 | RETSIGTYPE |
298 | rxvt_Exit_signal(int sig) |
324 | rxvt_Exit_signal(int sig) |
299 | { |
325 | { |
300 | signal(sig, SIG_DFL); |
326 | signal (sig, SIG_DFL); |
301 | #ifdef DEBUG_CMD |
327 | #ifdef DEBUG_CMD |
302 | rxvt_print_error("signal %d", sig); |
328 | rxvt_print_error ("signal %d", sig); |
303 | #endif |
329 | #endif |
304 | rxvt_clean_exit(); |
330 | rxvt_clean_exit(); |
305 | kill(getpid(), sig); |
331 | kill (getpid (), sig); |
306 | } |
332 | } |
307 | |
333 | |
308 | /* ARGSUSED */ |
|
|
309 | /* EXTPROTO */ |
334 | /* INTPROTO */ |
310 | int |
335 | int |
311 | rxvt_xerror_handler(const Display * display |
336 | rxvt_xerror_handler (Display *display, XErrorEvent *event) |
312 | __attribute__ ((unused)), const XErrorEvent * event) |
|
|
313 | { |
337 | { |
314 | if (GET_R->allowedxerror == -1) |
338 | if (GET_R->allowedxerror == -1) |
315 | GET_R->allowedxerror = event->error_code; |
339 | GET_R->allowedxerror = event->error_code; |
316 | else |
340 | else |
317 | { |
341 | { |
318 | rxvt_print_error("XError: Request: %d . %d, Error: %d", |
342 | old_xerror_handler (display, event); |
319 | event->request_code, event->minor_code, |
|
|
320 | event->error_code); |
|
|
321 | |
|
|
322 | GET_R->destroy (); |
343 | GET_R->destroy (); |
323 | } |
344 | } |
324 | |
345 | |
325 | return 0; |
346 | return 0; |
326 | } |
347 | } |
… | |
… | |
332 | */ |
353 | */ |
333 | /* EXTPROTO */ |
354 | /* EXTPROTO */ |
334 | void |
355 | void |
335 | rxvt_clean_exit () |
356 | rxvt_clean_exit () |
336 | { |
357 | { |
|
|
358 | // TODO: rxvtd should clean up all ressources |
|
|
359 | if (GET_R) |
337 | GET_R->destroy (); |
360 | GET_R->destroy (); |
338 | } |
361 | } |
339 | |
362 | |
340 | /* ------------------------------------------------------------------------- * |
363 | /* ------------------------------------------------------------------------- * |
341 | * MEMORY ALLOCATION WRAPPERS * |
364 | * MEMORY ALLOCATION WRAPPERS * |
342 | * ------------------------------------------------------------------------- */ |
365 | * ------------------------------------------------------------------------- */ |
… | |
… | |
637 | } |
660 | } |
638 | if (scrollbar_visible () && (Options & Opt_scrollBar_right)) |
661 | if (scrollbar_visible () && (Options & Opt_scrollBar_right)) |
639 | window_sb_x = szHint.width - sb_w; |
662 | window_sb_x = szHint.width - sb_w; |
640 | |
663 | |
641 | if (recalc_x) |
664 | if (recalc_x) |
642 | szHint.x += (DisplayWidth (Xdisplay, DefaultScreen (Xdisplay)) |
665 | szHint.x += (DisplayWidth (display->display, DefaultScreen (display->display)) |
643 | - szHint.width - 2 * TermWin.ext_bwidth); |
666 | - szHint.width - 2 * TermWin.ext_bwidth); |
644 | if (recalc_y) |
667 | if (recalc_y) |
645 | szHint.y += (DisplayHeight (Xdisplay, DefaultScreen (Xdisplay)) |
668 | szHint.y += (DisplayHeight (display->display, DefaultScreen (display->display)) |
646 | - szHint.height - 2 * TermWin.ext_bwidth); |
669 | - szHint.height - 2 * TermWin.ext_bwidth); |
647 | |
670 | |
648 | TermWin.ncol = TermWin.width / TermWin.fwidth; |
671 | TermWin.ncol = TermWin.width / TermWin.fwidth; |
649 | TermWin.nrow = TermWin.height / TermWin.fheight; |
672 | TermWin.nrow = TermWin.height / TermWin.fheight; |
650 | D_SIZE((stderr, "> Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d", |
673 | D_SIZE((stderr, "> Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d", |
… | |
… | |
702 | /* xterm sequences - title, iconName, color (exptl) */ |
725 | /* xterm sequences - title, iconName, color (exptl) */ |
703 | void |
726 | void |
704 | rxvt_term::set_title (const char *str) |
727 | rxvt_term::set_title (const char *str) |
705 | { |
728 | { |
706 | #ifndef SMART_WINDOW_TITLE |
729 | #ifndef SMART_WINDOW_TITLE |
707 | XStoreName(Xdisplay, TermWin.parent[0], str); |
730 | XStoreName(display->display, TermWin.parent[0], str); |
708 | #else |
731 | #else |
709 | char *name; |
732 | char *name; |
710 | |
733 | |
711 | if (XFetchName(Xdisplay, TermWin.parent[0], &name) == 0) |
734 | if (XFetchName(display->display, TermWin.parent[0], &name) == 0) |
712 | name = NULL; |
735 | name = NULL; |
713 | if (name == NULL || STRCMP(name, str)) |
736 | if (name == NULL || STRCMP(name, str)) |
714 | XStoreName(Xdisplay, TermWin.parent[0], str); |
737 | XStoreName(display->display, TermWin.parent[0], str); |
715 | if (name) |
738 | if (name) |
716 | XFree(name); |
739 | XFree(name); |
717 | #endif |
740 | #endif |
718 | } |
741 | } |
719 | |
742 | |
720 | void |
743 | void |
721 | rxvt_term::set_iconName (const char *str) |
744 | rxvt_term::set_iconName (const char *str) |
722 | { |
745 | { |
723 | #ifndef SMART_WINDOW_TITLE |
746 | #ifndef SMART_WINDOW_TITLE |
724 | XSetIconName(Xdisplay, TermWin.parent[0], str); |
747 | XSetIconName(display->display, TermWin.parent[0], str); |
725 | #else |
748 | #else |
726 | char *name; |
749 | char *name; |
727 | |
750 | |
728 | if (XGetIconName(Xdisplay, TermWin.parent[0], &name)) |
751 | if (XGetIconName(display->display, TermWin.parent[0], &name)) |
729 | name = NULL; |
752 | name = NULL; |
730 | if (name == NULL || STRCMP(name, str)) |
753 | if (name == NULL || STRCMP(name, str)) |
731 | XSetIconName(Xdisplay, TermWin.parent[0], str); |
754 | XSetIconName(display->display, TermWin.parent[0], str); |
732 | if (name) |
755 | if (name) |
733 | XFree(name); |
756 | XFree(name); |
734 | #endif |
757 | #endif |
735 | } |
758 | } |
736 | |
759 | |
… | |
… | |
765 | goto Done; |
788 | goto Done; |
766 | } |
789 | } |
767 | } |
790 | } |
768 | if (!rXParseAllocColor (& xcol, color)) |
791 | if (!rXParseAllocColor (& xcol, color)) |
769 | return; |
792 | return; |
770 | /* XStoreColor (Xdisplay, XCMAP, XColor*); */ |
793 | /* XStoreColor (display->display, XCMAP, XColor*); */ |
771 | |
794 | |
772 | /* |
795 | /* |
773 | * FIXME: should free colors here, but no idea how to do it so instead, |
796 | * FIXME: should free colors here, but no idea how to do it so instead, |
774 | * so just keep gobbling up the colormap |
797 | * so just keep gobbling up the colormap |
775 | */ |
798 | */ |
… | |
… | |
778 | if (PixColors[idx] == PixColors[i]) |
801 | if (PixColors[idx] == PixColors[i]) |
779 | break; |
802 | break; |
780 | if (i > Color_White) |
803 | if (i > Color_White) |
781 | { |
804 | { |
782 | /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */ |
805 | /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */ |
783 | XFreeColors(Xdisplay, XCMAP, (PixColors + idx), 1, |
806 | XFreeColors(display->display, XCMAP, (PixColors + idx), 1, |
784 | DisplayPlanes(Xdisplay, Xscreen)); |
807 | DisplayPlanes(display->display, display->screen)); |
785 | } |
808 | } |
786 | # endif |
809 | # endif |
787 | |
810 | |
788 | PixColors[idx] = xcol; |
811 | PixColors[idx] = xcol; |
789 | SET_PIXCOLOR(idx); |
812 | SET_PIXCOLOR(idx); |
790 | |
813 | |
791 | /* XSetWindowAttributes attr; */ |
814 | /* XSetWindowAttributes attr; */ |
792 | /* Cursor cursor; */ |
815 | /* Cursor cursor; */ |
793 | Done: |
816 | Done: |
794 | if (idx == Color_bg && !(Options & Opt_transparent)) |
817 | if (idx == Color_bg && !(Options & Opt_transparent)) |
795 | XSetWindowBackground(Xdisplay, TermWin.vt, |
818 | XSetWindowBackground(display->display, TermWin.vt, |
796 | PixColors[Color_bg]); |
819 | PixColors[Color_bg]); |
797 | |
820 | |
798 | /* handle Color_BD, scrollbar background, etc. */ |
821 | /* handle Color_BD, scrollbar background, etc. */ |
799 | |
822 | |
800 | set_colorfgbg (); |
823 | set_colorfgbg (); |
… | |
… | |
813 | #if TODO |
836 | #if TODO |
814 | rxvt_color xcol[2]; |
837 | rxvt_color xcol[2]; |
815 | |
838 | |
816 | xcol[0] = PixColors[Color_pointer]; |
839 | xcol[0] = PixColors[Color_pointer]; |
817 | xcol[1] = PixColors[Color_bg]; |
840 | xcol[1] = PixColors[Color_bg]; |
818 | XQueryColors (Xdisplay, XCMAP, xcol, 2); |
841 | XQueryColors (display->display, XCMAP, xcol, 2); |
819 | XRecolorCursor (Xdisplay, TermWin_cursor, &(xcol[0]), &(xcol[1])); |
842 | XRecolorCursor (display->display, TermWin_cursor, &(xcol[0]), &(xcol[1])); |
820 | #endif |
843 | #endif |
821 | } |
844 | } |
822 | |
845 | |
823 | /*----------------------------------------------------------------------*/ |
846 | /*----------------------------------------------------------------------*/ |
824 | /* |
847 | /* |
… | |
… | |
872 | */ |
895 | */ |
873 | |
896 | |
874 | int |
897 | int |
875 | rxvt_term::rXParseAllocColor (rxvt_color *screen_in_out, const char *colour) |
898 | rxvt_term::rXParseAllocColor (rxvt_color *screen_in_out, const char *colour) |
876 | { |
899 | { |
877 | if (!screen_in_out->set (this, colour)) |
900 | if (!screen_in_out->set (display, colour)) |
878 | { |
901 | { |
879 | rxvt_print_error("can't allocate colour: %s", colour); |
902 | rxvt_print_error("can't allocate colour: %s", colour); |
880 | return false; |
903 | return false; |
881 | } |
904 | } |
882 | |
905 | |
… | |
… | |
894 | #ifdef SMART_RESIZE |
917 | #ifdef SMART_RESIZE |
895 | int old_width = szHint.width, old_height = szHint.height; |
918 | int old_width = szHint.width, old_height = szHint.height; |
896 | #endif |
919 | #endif |
897 | |
920 | |
898 | window_calc (width, height); |
921 | window_calc (width, height); |
899 | XSetWMNormalHints (Xdisplay, TermWin.parent[0], &szHint); |
922 | XSetWMNormalHints (display->display, TermWin.parent[0], &szHint); |
900 | if (!ignoreparent) |
923 | if (!ignoreparent) |
901 | { |
924 | { |
902 | #ifdef SMART_RESIZE |
925 | #ifdef SMART_RESIZE |
903 | /* |
926 | /* |
904 | * resize by Marius Gedminas <marius.gedminas@uosis.mif.vu.lt> |
927 | * resize by Marius Gedminas <marius.gedminas@uosis.mif.vu.lt> |
… | |
… | |
907 | int x, y, x1, y1; |
930 | int x, y, x1, y1; |
908 | int dx, dy; |
931 | int dx, dy; |
909 | unsigned int unused_w1, unused_h1, unused_b1, unused_d1; |
932 | unsigned int unused_w1, unused_h1, unused_b1, unused_d1; |
910 | Window unused_cr; |
933 | Window unused_cr; |
911 | |
934 | |
912 | XTranslateCoordinates (Xdisplay, TermWin.parent[0], Xroot, |
935 | XTranslateCoordinates (display->display, TermWin.parent[0], display->root, |
913 | 0, 0, &x, &y, &unused_cr); |
936 | 0, 0, &x, &y, &unused_cr); |
914 | XGetGeometry (Xdisplay, TermWin.parent[0], &unused_cr, &x1, &y1, |
937 | XGetGeometry (display->display, TermWin.parent[0], &unused_cr, &x1, &y1, |
915 | &unused_w1, &unused_h1, &unused_b1, &unused_d1); |
938 | &unused_w1, &unused_h1, &unused_b1, &unused_d1); |
916 | /* |
939 | /* |
917 | * if Xroot isn't the parent window, a WM will probably have offset |
940 | * if display->root isn't the parent window, a WM will probably have offset |
918 | * our position for handles and decorations. Counter it |
941 | * our position for handles and decorations. Counter it |
919 | */ |
942 | */ |
920 | if (x1 != x || y1 != y) |
943 | if (x1 != x || y1 != y) |
921 | { |
944 | { |
922 | x -= x1; |
945 | x -= x1; |
923 | y -= y1; |
946 | y -= y1; |
924 | } |
947 | } |
925 | |
948 | |
926 | x1 = (DisplayWidth (Xdisplay, Xscreen) - old_width) / 2; |
949 | x1 = (DisplayWidth (display->display, display->screen) - old_width) / 2; |
927 | y1 = (DisplayHeight (Xdisplay, Xscreen) - old_height) / 2; |
950 | y1 = (DisplayHeight (display->display, display->screen) - old_height) / 2; |
928 | dx = old_width - szHint.width; |
951 | dx = old_width - szHint.width; |
929 | dy = old_height - szHint.height; |
952 | dy = old_height - szHint.height; |
930 | |
953 | |
931 | /* Check position of the center of the window */ |
954 | /* Check position of the center of the window */ |
932 | if (x < x1) /* left half */ |
955 | if (x < x1) /* left half */ |
… | |
… | |
936 | if (y < y1) /* top half */ |
959 | if (y < y1) /* top half */ |
937 | dy = 0; |
960 | dy = 0; |
938 | else if (y == y1) /* exact center */ |
961 | else if (y == y1) /* exact center */ |
939 | dy /= 2; |
962 | dy /= 2; |
940 | |
963 | |
941 | XMoveResizeWindow (Xdisplay, TermWin.parent[0], x + dx, y + dy, |
964 | XMoveResizeWindow (display->display, TermWin.parent[0], x + dx, y + dy, |
942 | szHint.width, szHint.height); |
965 | szHint.width, szHint.height); |
943 | #else |
966 | #else |
944 | XResizeWindow (Xdisplay, TermWin.parent[0], szHint.width, |
967 | XResizeWindow (display->display, TermWin.parent[0], szHint.width, |
945 | szHint.height); |
968 | szHint.height); |
946 | #endif |
969 | #endif |
947 | |
970 | |
948 | } |
971 | } |
949 | |
972 | |
… | |
… | |
952 | |
975 | |
953 | if (fix_screen || width != old_width || height != old_height) |
976 | if (fix_screen || width != old_width || height != old_height) |
954 | { |
977 | { |
955 | if (scrollbar_visible ()) |
978 | if (scrollbar_visible ()) |
956 | { |
979 | { |
957 | XMoveResizeWindow (Xdisplay, scrollBar.win, window_sb_x, |
980 | XMoveResizeWindow (display->display, scrollBar.win, window_sb_x, |
958 | 0, scrollbar_TotalWidth (), szHint.height); |
981 | 0, scrollbar_TotalWidth (), szHint.height); |
959 | resize_scrollbar (); |
982 | resize_scrollbar (); |
960 | } |
983 | } |
961 | |
984 | |
962 | if (menubar_visible ()) |
985 | if (menubar_visible ()) |
963 | XMoveResizeWindow (Xdisplay, menuBar.win, window_vt_x, |
986 | XMoveResizeWindow (display->display, menuBar.win, window_vt_x, |
964 | 0, TermWin_TotalWidth (), menuBar_TotalHeight ()); |
987 | 0, TermWin_TotalWidth (), menuBar_TotalHeight ()); |
965 | |
988 | |
966 | XMoveResizeWindow (Xdisplay, TermWin.vt, window_vt_x, |
989 | XMoveResizeWindow (display->display, TermWin.vt, window_vt_x, |
967 | window_vt_y, TermWin_TotalWidth (), |
990 | window_vt_y, TermWin_TotalWidth (), |
968 | TermWin_TotalHeight ()); |
991 | TermWin_TotalHeight ()); |
969 | #ifdef RXVT_GRAPHICS |
992 | #ifdef RXVT_GRAPHICS |
970 | if (old_height) |
993 | if (old_height) |
971 | Gr_Resize (old_width - szHint.base_width, |
994 | Gr_Resize (old_width - szHint.base_width, |
… | |
… | |
1018 | { |
1041 | { |
1019 | XWindowAttributes wattr; |
1042 | XWindowAttributes wattr; |
1020 | |
1043 | |
1021 | if (width == 0 || height == 0) |
1044 | if (width == 0 || height == 0) |
1022 | { |
1045 | { |
1023 | XGetWindowAttributes(Xdisplay, Xroot, &wattr); |
1046 | XGetWindowAttributes(display->display, display->root, &wattr); |
1024 | if (width == 0) |
1047 | if (width == 0) |
1025 | width = wattr.width - szHint.base_width; |
1048 | width = wattr.width - szHint.base_width; |
1026 | if (height == 0) |
1049 | if (height == 0) |
1027 | height = wattr.height - szHint.base_height; |
1050 | height = wattr.height - szHint.base_height; |
1028 | } |
1051 | } |
… | |
… | |
1036 | |
1059 | |
1037 | /* -------------------------------------------------------------------- * |
1060 | /* -------------------------------------------------------------------- * |
1038 | * - X INPUT METHOD ROUTINES - * |
1061 | * - X INPUT METHOD ROUTINES - * |
1039 | * -------------------------------------------------------------------- */ |
1062 | * -------------------------------------------------------------------- */ |
1040 | #ifdef USE_XIM |
1063 | #ifdef USE_XIM |
|
|
1064 | |
1041 | void |
1065 | void |
1042 | rxvt_term::set_size (XRectangle *size) |
1066 | rxvt_term::im_set_size (XRectangle *size) |
1043 | { |
1067 | { |
1044 | size->x = TermWin.int_bwidth; |
1068 | size->x = TermWin.int_bwidth; |
1045 | size->y = TermWin.int_bwidth; |
1069 | size->y = TermWin.int_bwidth; |
1046 | size->width = Width2Pixel(TermWin.ncol); |
1070 | size->width = Width2Pixel(TermWin.ncol); |
1047 | size->height = Height2Pixel(TermWin.nrow); |
1071 | size->height = Height2Pixel(TermWin.nrow); |
1048 | } |
1072 | } |
1049 | |
1073 | |
1050 | void |
1074 | void |
1051 | rxvt_term::set_color (unsigned long *fg, unsigned long *bg) |
1075 | rxvt_term::im_set_color (unsigned long *fg, unsigned long *bg) |
1052 | { |
1076 | { |
1053 | *fg = PixColors[Color_fg]; |
1077 | *fg = PixColors[Color_fg]; |
1054 | *bg = PixColors[Color_bg]; |
1078 | *bg = PixColors[Color_bg]; |
1055 | } |
1079 | } |
1056 | |
1080 | |
… | |
… | |
1069 | STRCPY(server, "@server="); |
1093 | STRCPY(server, "@server="); |
1070 | STRNCAT(server, &(p[4]), IMBUFSIZ - 9); /* skip "@im=" */ |
1094 | STRNCAT(server, &(p[4]), IMBUFSIZ - 9); /* skip "@im=" */ |
1071 | if ((p = STRCHR(server + 1, '@')) != NULL) /* first one only */ |
1095 | if ((p = STRCHR(server + 1, '@')) != NULL) /* first one only */ |
1072 | *p = '\0'; |
1096 | *p = '\0'; |
1073 | |
1097 | |
1074 | atom = XInternAtom(Xdisplay, server, False); |
1098 | atom = XInternAtom(display->display, server, False); |
1075 | win = XGetSelectionOwner(Xdisplay, atom); |
1099 | win = XGetSelectionOwner(display->display, atom); |
1076 | if (win != None) |
1100 | if (win != None) |
1077 | return True; |
1101 | return True; |
1078 | } |
1102 | } |
1079 | return False; |
1103 | return False; |
1080 | } |
1104 | } |
… | |
… | |
1093 | || event_type == SelectionNotify |
1117 | || event_type == SelectionNotify |
1094 | || event_type == ButtonRelease || event_type == FocusIn) |
1118 | || event_type == ButtonRelease || event_type == FocusIn) |
1095 | || !IMisRunning ()) |
1119 | || !IMisRunning ()) |
1096 | return; |
1120 | return; |
1097 | |
1121 | |
1098 | set_position (&spot); |
1122 | im_set_position (&spot); |
1099 | |
1123 | |
1100 | preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL); |
1124 | preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL); |
1101 | XSetICValues(Input_Context, XNPreeditAttributes, preedit_attr, NULL); |
1125 | XSetICValues(Input_Context, XNPreeditAttributes, preedit_attr, NULL); |
1102 | XFree(preedit_attr); |
1126 | XFree(preedit_attr); |
1103 | } |
1127 | } |
1104 | |
1128 | |
1105 | void |
1129 | void |
1106 | rxvt_term::set_preedit_area (XRectangle * preedit_rect, XRectangle * status_rect, |
1130 | rxvt_term::im_set_preedit_area (XRectangle * preedit_rect, XRectangle * status_rect, |
1107 | XRectangle * needed_rect) |
1131 | XRectangle * needed_rect) |
1108 | { |
1132 | { |
1109 | int mbh, vtx = 0; |
1133 | int mbh, vtx = 0; |
1110 | |
1134 | |
1111 | if (scrollbar_visible () && !(Options & Opt_scrollBar_right)) |
1135 | if (scrollbar_visible () && !(Options & Opt_scrollBar_right)) |
1112 | vtx = scrollbar_TotalWidth(); |
1136 | vtx = scrollbar_TotalWidth(); |
… | |
… | |
1125 | |
1149 | |
1126 | status_rect->width = needed_rect->width ? needed_rect->width : Width2Pixel(TermWin.ncol + 1); |
1150 | status_rect->width = needed_rect->width ? needed_rect->width : Width2Pixel(TermWin.ncol + 1); |
1127 | status_rect->height = Height2Pixel(1); |
1151 | status_rect->height = Height2Pixel(1); |
1128 | } |
1152 | } |
1129 | |
1153 | |
1130 | /* ARGSUSED */ |
|
|
1131 | /* EXTPROTO */ |
|
|
1132 | void |
1154 | void |
1133 | rxvt_IMDestroyCallback(XIM xim __attribute__ ((unused)), XPointer client_data |
1155 | rxvt_term::im_destroy () |
1134 | __attribute__ ((unused)), XPointer call_data |
|
|
1135 | __attribute__ ((unused))) |
|
|
1136 | { |
1156 | { |
|
|
1157 | if (Input_Context) |
|
|
1158 | { |
|
|
1159 | XDestroyIC (Input_Context); |
1137 | GET_R->Input_Context = NULL; |
1160 | Input_Context = NULL; |
1138 | /* To avoid Segmentation Fault in C locale: Solaris only? */ |
1161 | } |
1139 | if (STRCMP (GET_R->locale, "C")) |
1162 | |
1140 | XRegisterIMInstantiateCallback(GET_R->Xdisplay, NULL, NULL, NULL, |
1163 | if (input_method) |
1141 | rxvt_IMInstantiateCallback, NULL); |
1164 | { |
|
|
1165 | display->put_xim (input_method); |
|
|
1166 | input_method = 0; |
|
|
1167 | } |
1142 | } |
1168 | } |
1143 | |
1169 | |
1144 | /* |
1170 | /* |
1145 | * Try to open a XIM with the current modifiers, then see if we can |
1171 | * Try to open a XIM with the current modifiers, then see if we can |
1146 | * open a suitable preedit type |
1172 | * open a suitable preedit type |
1147 | */ |
1173 | */ |
1148 | bool |
1174 | bool |
1149 | rxvt_term::IM_get_IC () |
1175 | rxvt_term::IM_get_IC (const char *modifiers) |
1150 | { |
1176 | { |
1151 | int i, j, found; |
1177 | int i, j, found; |
1152 | XIM xim; |
1178 | XIM xim; |
1153 | XPoint spot; |
1179 | XPoint spot; |
1154 | XRectangle rect, status_rect, needed_rect; |
1180 | XRectangle rect, status_rect, needed_rect; |
1155 | unsigned long fg, bg; |
1181 | unsigned long fg, bg; |
1156 | const char *p; |
1182 | const char *p; |
1157 | char **s; |
1183 | char **s; |
1158 | XIMStyles *xim_styles; |
1184 | XIMStyles *xim_styles; |
1159 | XVaNestedList preedit_attr, status_attr; |
1185 | XVaNestedList preedit_attr, status_attr; |
1160 | XIMCallback ximcallback; |
1186 | |
|
|
1187 | if (!((p = XSetLocaleModifiers (modifiers)) && *p)) |
|
|
1188 | return false; |
1161 | |
1189 | |
1162 | D_MAIN((stderr, "rxvt_IM_get_IC()")); |
1190 | D_MAIN((stderr, "rxvt_IM_get_IC()")); |
1163 | xim = XOpenIM (Xdisplay, NULL, NULL, NULL); |
1191 | input_method = display->get_xim (locale, modifiers); |
1164 | if (xim == NULL) |
1192 | if (input_method == NULL) |
1165 | return False; |
1193 | return false; |
|
|
1194 | |
|
|
1195 | xim = input_method->xim; |
1166 | |
1196 | |
1167 | xim_styles = NULL; |
1197 | xim_styles = NULL; |
1168 | if (XGetIMValues (xim, XNQueryInputStyle, &xim_styles, NULL) |
1198 | if (XGetIMValues (xim, XNQueryInputStyle, &xim_styles, NULL) |
1169 | || !xim_styles || !xim_styles->count_styles) |
1199 | || !xim_styles || !xim_styles->count_styles) |
1170 | { |
1200 | { |
1171 | XCloseIM(xim); |
1201 | display->put_xim (input_method); |
1172 | return False; |
1202 | return false; |
1173 | } |
1203 | } |
1174 | |
1204 | |
1175 | p = rs[Rs_preeditType] ? rs[Rs_preeditType] |
1205 | p = rs[Rs_preeditType] ? rs[Rs_preeditType] : "OverTheSpot,OffTheSpot,Root"; |
1176 | : "OverTheSpot,OffTheSpot,Root"; |
|
|
1177 | s = rxvt_splitcommastring(p); |
1206 | s = rxvt_splitcommastring(p); |
1178 | for (i = found = 0; !found && s[i]; i++) |
1207 | for (i = found = 0; !found && s[i]; i++) |
1179 | { |
1208 | { |
1180 | if (!STRCMP(s[i], "OverTheSpot")) |
1209 | if (!STRCMP(s[i], "OverTheSpot")) |
1181 | input_style = (XIMPreeditPosition | XIMStatusNothing); |
1210 | input_style = (XIMPreeditPosition | XIMStatusNothing); |
… | |
… | |
1189 | { |
1218 | { |
1190 | found = 1; |
1219 | found = 1; |
1191 | break; |
1220 | break; |
1192 | } |
1221 | } |
1193 | } |
1222 | } |
|
|
1223 | |
1194 | for (i = 0; s[i]; i++) |
1224 | for (i = 0; s[i]; i++) |
1195 | free(s[i]); |
1225 | free (s[i]); |
|
|
1226 | |
1196 | free(s); |
1227 | free (s); |
1197 | XFree(xim_styles); |
1228 | XFree (xim_styles); |
1198 | |
1229 | |
1199 | if (!found) |
1230 | if (!found) |
1200 | { |
1231 | { |
1201 | XCloseIM(xim); |
1232 | display->put_xim (input_method); |
1202 | return False; |
1233 | return false; |
1203 | } |
1234 | } |
1204 | |
|
|
1205 | ximcallback.callback = rxvt_IMDestroyCallback; |
|
|
1206 | |
|
|
1207 | /* XXX: not sure why we need this (as well as IC one below) */ |
|
|
1208 | XSetIMValues(xim, XNDestroyCallback, &ximcallback, NULL); |
|
|
1209 | |
1235 | |
1210 | preedit_attr = status_attr = NULL; |
1236 | preedit_attr = status_attr = NULL; |
1211 | |
1237 | |
1212 | if (input_style & XIMPreeditPosition) |
1238 | if (input_style & XIMPreeditPosition) |
1213 | { |
1239 | { |
1214 | set_size (&rect); |
1240 | im_set_size (&rect); |
1215 | set_position (&spot); |
1241 | im_set_position (&spot); |
1216 | set_color (&fg, &bg); |
1242 | im_set_color (&fg, &bg); |
1217 | |
1243 | |
1218 | preedit_attr = XVaCreateNestedList(0, XNArea, &rect, |
1244 | preedit_attr = XVaCreateNestedList(0, XNArea, &rect, |
1219 | XNSpotLocation, &spot, |
1245 | XNSpotLocation, &spot, |
1220 | XNForeground, fg, XNBackground, bg, |
1246 | XNForeground, fg, XNBackground, bg, |
1221 | //XNFontSet, TermWin.fontset, |
1247 | //XNFontSet, TermWin.fontset, |
1222 | NULL); |
1248 | NULL); |
1223 | } |
1249 | } |
1224 | else if (input_style & XIMPreeditArea) |
1250 | else if (input_style & XIMPreeditArea) |
1225 | { |
1251 | { |
1226 | set_color (&fg, &bg); |
1252 | im_set_color (&fg, &bg); |
1227 | |
1253 | |
1228 | /* |
1254 | /* |
1229 | * The necessary width of preedit area is unknown |
1255 | * The necessary width of preedit area is unknown |
1230 | * until create input context. |
1256 | * until create input context. |
1231 | */ |
1257 | */ |
1232 | needed_rect.width = 0; |
1258 | needed_rect.width = 0; |
1233 | |
1259 | |
1234 | set_preedit_area(&rect, &status_rect, &needed_rect); |
1260 | im_set_preedit_area (&rect, &status_rect, &needed_rect); |
1235 | |
1261 | |
1236 | preedit_attr = XVaCreateNestedList(0, XNArea, &rect, |
1262 | preedit_attr = XVaCreateNestedList(0, XNArea, &rect, |
1237 | XNForeground, fg, XNBackground, bg, |
1263 | XNForeground, fg, XNBackground, bg, |
1238 | //XNFontSet, TermWin.fontset, |
1264 | //XNFontSet, TermWin.fontset, |
1239 | NULL); |
1265 | NULL); |
1240 | status_attr = XVaCreateNestedList(0, XNArea, &status_rect, |
1266 | status_attr = XVaCreateNestedList(0, XNArea, &status_rect, |
1241 | XNForeground, fg, XNBackground, bg, |
1267 | XNForeground, fg, XNBackground, bg, |
1242 | //XNFontSet, TermWin.fontset, |
1268 | //XNFontSet, TermWin.fontset, |
1243 | NULL); |
1269 | NULL); |
1244 | } |
1270 | } |
|
|
1271 | |
1245 | Input_Context = XCreateIC(xim, XNInputStyle, input_style, |
1272 | Input_Context = XCreateIC(xim, XNInputStyle, input_style, |
1246 | XNClientWindow, TermWin.parent[0], |
1273 | XNClientWindow, TermWin.parent[0], |
1247 | XNFocusWindow, TermWin.parent[0], |
1274 | XNFocusWindow, TermWin.parent[0], |
1248 | XNDestroyCallback, &ximcallback, |
|
|
1249 | preedit_attr ? XNPreeditAttributes : NULL, |
1275 | preedit_attr ? XNPreeditAttributes : NULL, |
1250 | preedit_attr, |
1276 | preedit_attr, |
1251 | status_attr ? XNStatusAttributes : NULL, |
1277 | status_attr ? XNStatusAttributes : NULL, |
1252 | status_attr, NULL); |
1278 | status_attr, NULL); |
1253 | if (preedit_attr) |
1279 | if (preedit_attr) XFree(preedit_attr); |
1254 | XFree(preedit_attr); |
1280 | if (status_attr) XFree(status_attr); |
1255 | if (status_attr) |
1281 | |
1256 | XFree(status_attr); |
|
|
1257 | if (Input_Context == NULL) |
1282 | if (Input_Context == NULL) |
1258 | { |
1283 | { |
1259 | rxvt_print_error("failed to create input context"); |
1284 | rxvt_print_error("failed to create input context"); |
1260 | XCloseIM(xim); |
1285 | display->put_xim (input_method); |
1261 | return False; |
1286 | return false; |
1262 | } |
1287 | } |
|
|
1288 | |
1263 | if (input_style & XIMPreeditArea) |
1289 | if (input_style & XIMPreeditArea) |
1264 | IMSetStatusPosition (); |
1290 | IMSetStatusPosition (); |
|
|
1291 | |
1265 | D_MAIN((stderr, "rxvt_IM_get_IC() - successful connection")); |
1292 | D_MAIN((stderr, "rxvt_IM_get_IC() - successful connection")); |
1266 | return True; |
1293 | return true; |
1267 | } |
1294 | } |
1268 | |
1295 | |
1269 | /* |
|
|
1270 | * X manual pages and include files don't match on some systems: |
|
|
1271 | * some think this is an XIDProc and others an XIMProc so we can't |
|
|
1272 | * use the first argument - need to update this to be nice for |
|
|
1273 | * both types via some sort of configure detection |
|
|
1274 | */ |
|
|
1275 | /* ARGSUSED */ |
|
|
1276 | /* EXTPROTO */ |
|
|
1277 | void |
1296 | void |
1278 | rxvt_IMInstantiateCallback(Display * unused |
1297 | rxvt_term::im_cb () |
1279 | __attribute__ ((unused)), XPointer client_data |
|
|
1280 | __attribute__ ((unused)), XPointer call_data |
|
|
1281 | __attribute__ ((unused))) |
|
|
1282 | { |
1298 | { |
1283 | int i, found, had_im; |
1299 | int i, found, had_im; |
1284 | const char *p; |
1300 | const char *p; |
1285 | char **s; |
1301 | char **s; |
1286 | char buf[IMBUFSIZ]; |
1302 | char buf[IMBUFSIZ]; |
1287 | |
1303 | |
|
|
1304 | im_destroy (); |
|
|
1305 | |
1288 | D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); |
1306 | D_MAIN((stderr, "rxvt_IMInstantiateCallback()")); |
1289 | if (GET_R->Input_Context) |
1307 | if (Input_Context) |
1290 | return; |
1308 | return; |
1291 | |
1309 | |
1292 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1310 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1293 | if (GET_R->rs[Rs_imLocale]) |
1311 | if (rs[Rs_imLocale]) |
1294 | setlocale (LC_CTYPE, GET_R->rs[Rs_imLocale]); |
1312 | setlocale (LC_CTYPE, rs[Rs_imLocale]); |
1295 | #endif |
1313 | #endif |
1296 | |
1314 | |
1297 | p = GET_R->rs[Rs_inputMethod]; |
1315 | p = rs[Rs_inputMethod]; |
1298 | if (p && *p) |
1316 | if (p && *p) |
1299 | { |
1317 | { |
1300 | bool found = false; |
1318 | bool found = false; |
1301 | |
1319 | |
1302 | s = rxvt_splitcommastring (p); |
1320 | s = rxvt_splitcommastring (p); |
… | |
… | |
1304 | { |
1322 | { |
1305 | if (*s[i]) |
1323 | if (*s[i]) |
1306 | { |
1324 | { |
1307 | STRCPY (buf, "@im="); |
1325 | STRCPY (buf, "@im="); |
1308 | STRNCAT (buf, s[i], IMBUFSIZ - 5); |
1326 | STRNCAT (buf, s[i], IMBUFSIZ - 5); |
1309 | if ((p = XSetLocaleModifiers (buf)) && *p && GET_R->IM_get_IC ()) |
1327 | if (IM_get_IC (buf)) |
1310 | { |
1328 | { |
1311 | found = true; |
1329 | found = true; |
1312 | break; |
1330 | break; |
1313 | } |
1331 | } |
1314 | } |
1332 | } |
… | |
… | |
1320 | if (found) |
1338 | if (found) |
1321 | goto done; |
1339 | goto done; |
1322 | } |
1340 | } |
1323 | |
1341 | |
1324 | /* try with XMODIFIERS env. var. */ |
1342 | /* try with XMODIFIERS env. var. */ |
1325 | if ((p = XSetLocaleModifiers ("")) && *p |
1343 | if (IM_get_IC ("")) |
1326 | && GET_R->IM_get_IC ()) |
|
|
1327 | goto done; |
1344 | goto done; |
1328 | |
1345 | |
1329 | /* try with no modifiers base IF the user didn't specify an IM */ |
1346 | /* try with no modifiers base IF the user didn't specify an IM */ |
1330 | if ((p = XSetLocaleModifiers ("@im=none")) && *p |
1347 | if (IM_get_IC ("@im=none")) |
1331 | && GET_R->IM_get_IC () == True) |
|
|
1332 | goto done; |
1348 | goto done; |
1333 | |
1349 | |
1334 | done: |
1350 | done: |
1335 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1351 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
1336 | if (GET_R->rs[Rs_imLocale]) |
1352 | if (rs[Rs_imLocale]) |
1337 | setlocale (LC_CTYPE, GET_R->locale); |
1353 | setlocale (LC_CTYPE, locale); |
1338 | #endif |
1354 | #endif |
1339 | } |
1355 | } |
1340 | |
1356 | |
1341 | void |
1357 | void |
1342 | rxvt_term::IMSetStatusPosition () |
1358 | rxvt_term::IMSetStatusPosition () |
… | |
… | |
1352 | /* Getting the necessary width of preedit area */ |
1368 | /* Getting the necessary width of preedit area */ |
1353 | status_attr = XVaCreateNestedList(0, XNAreaNeeded, &needed_rect, NULL); |
1369 | status_attr = XVaCreateNestedList(0, XNAreaNeeded, &needed_rect, NULL); |
1354 | XGetICValues(Input_Context, XNStatusAttributes, status_attr, NULL); |
1370 | XGetICValues(Input_Context, XNStatusAttributes, status_attr, NULL); |
1355 | XFree(status_attr); |
1371 | XFree(status_attr); |
1356 | |
1372 | |
1357 | set_preedit_area(&preedit_rect, &status_rect, needed_rect); |
1373 | im_set_preedit_area (&preedit_rect, &status_rect, needed_rect); |
1358 | |
1374 | |
1359 | preedit_attr = XVaCreateNestedList(0, XNArea, &preedit_rect, NULL); |
1375 | preedit_attr = XVaCreateNestedList(0, XNArea, &preedit_rect, NULL); |
1360 | status_attr = XVaCreateNestedList(0, XNArea, &status_rect, NULL); |
1376 | status_attr = XVaCreateNestedList(0, XNArea, &status_rect, NULL); |
1361 | |
1377 | |
1362 | XSetICValues(Input_Context, |
1378 | XSetICValues(Input_Context, |