… | |
… | |
72 | free (p); |
72 | free (p); |
73 | } |
73 | } |
74 | |
74 | |
75 | rxvt_term::rxvt_term () |
75 | rxvt_term::rxvt_term () |
76 | : |
76 | : |
|
|
77 | #ifdef TRANSPARENT |
|
|
78 | rootwin_ev (this, &rxvt_term::rootwin_cb), |
|
|
79 | #endif |
|
|
80 | termwin_ev (this, &rxvt_term::x_cb), |
|
|
81 | vt_ev (this, &rxvt_term::x_cb), |
|
|
82 | #ifdef HAVE_SCROLLBARS |
|
|
83 | scrollbar_ev (this, &rxvt_term::x_cb), |
|
|
84 | #endif |
|
|
85 | #ifdef MENUBAR |
|
|
86 | menubar_ev (this, &rxvt_term::x_cb), fixme |
|
|
87 | #endif |
77 | #ifdef CURSOR_BLINK |
88 | #ifdef CURSOR_BLINK |
78 | cursor_blink_ev (this, &rxvt_term::cursor_blink_cb), |
89 | cursor_blink_ev (this, &rxvt_term::cursor_blink_cb), |
79 | #endif |
90 | #endif |
80 | #ifdef TEXT_BLINK |
91 | #ifdef TEXT_BLINK |
81 | text_blink_ev (this, &rxvt_term::text_blink_cb), |
92 | text_blink_ev (this, &rxvt_term::text_blink_cb), |
… | |
… | |
84 | pointer_ev (this, &rxvt_term::pointer_cb), |
95 | pointer_ev (this, &rxvt_term::pointer_cb), |
85 | #endif |
96 | #endif |
86 | check_ev (this, &rxvt_term::check_cb), |
97 | check_ev (this, &rxvt_term::check_cb), |
87 | destroy_ev (this, &rxvt_term::destroy_cb), |
98 | destroy_ev (this, &rxvt_term::destroy_cb), |
88 | pty_ev (this, &rxvt_term::pty_cb), |
99 | pty_ev (this, &rxvt_term::pty_cb), |
89 | x_ev (this, &rxvt_term::x_cb), |
|
|
90 | incr_ev (this, &rxvt_term::incr_cb) |
100 | incr_ev (this, &rxvt_term::incr_cb) |
91 | { |
101 | { |
92 | cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; |
102 | cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; |
93 | } |
103 | } |
94 | |
104 | |
… | |
… | |
104 | #endif |
114 | #endif |
105 | #ifdef UTMP_SUPPORT |
115 | #ifdef UTMP_SUPPORT |
106 | privileged_utmp (RESTORE); |
116 | privileged_utmp (RESTORE); |
107 | #endif |
117 | #endif |
108 | #ifdef USE_XIM |
118 | #ifdef USE_XIM |
109 | if (Input_Context != NULL) |
119 | if (Input_Context) |
110 | { |
120 | { |
111 | XDestroyIC (Input_Context); |
121 | XDestroyIC (Input_Context); |
112 | Input_Context = NULL; |
122 | Input_Context = NULL; |
113 | } |
123 | } |
114 | #endif |
124 | #endif |
115 | |
125 | |
|
|
126 | if (TermWin.parent[0]) |
|
|
127 | XDestroyWindow (display->display, TermWin.parent[0]); |
|
|
128 | |
|
|
129 | // TODO: free pixcolours, colours should become part of rxvt_display |
|
|
130 | |
|
|
131 | delete PixColors; |
|
|
132 | |
116 | if (cmd_fd >= 0) |
133 | if (cmd_fd >= 0) |
117 | close (cmd_fd); |
134 | close (cmd_fd); |
118 | |
135 | |
119 | if (Xfd >= 0) |
136 | if (display) |
120 | XCloseDisplay (Xdisplay); |
137 | displays.release (display); |
121 | |
|
|
122 | delete PixColors; |
|
|
123 | } |
138 | } |
124 | |
139 | |
125 | void |
140 | void |
126 | rxvt_term::destroy () |
141 | rxvt_term::destroy () |
127 | { |
142 | { |
|
|
143 | if (display) |
|
|
144 | { |
|
|
145 | termwin_ev.stop (display); |
|
|
146 | vt_ev.stop (display); |
|
|
147 | #ifdef HAVE_SCROLLBARS |
|
|
148 | scrollbar_ev.stop (display); |
|
|
149 | #endif |
|
|
150 | #ifdef MENUBAR |
|
|
151 | menubar_ev.stop (display); |
|
|
152 | #endif |
|
|
153 | } |
|
|
154 | |
128 | check_ev.stop (); |
155 | check_ev.stop (); |
129 | pty_ev.stop (); |
156 | pty_ev.stop (); |
130 | x_ev.stop (); |
|
|
131 | #ifdef CURSOR_BLINK |
157 | #ifdef CURSOR_BLINK |
132 | cursor_blink_ev.stop (); |
158 | cursor_blink_ev.stop (); |
133 | #endif |
159 | #endif |
134 | #ifdef TEXT_BLINK |
160 | #ifdef TEXT_BLINK |
135 | text_blink_ev.stop (); |
161 | text_blink_ev.stop (); |
… | |
… | |
163 | SET_R (0); |
189 | SET_R (0); |
164 | } |
190 | } |
165 | |
191 | |
166 | return GET_R; |
192 | return GET_R; |
167 | } |
193 | } |
|
|
194 | |
|
|
195 | static int (*old_xerror_handler)(Display *dpy, XErrorEvent *event); |
168 | |
196 | |
169 | void |
197 | void |
170 | rxvt_init_signals () |
198 | rxvt_init_signals () |
171 | { |
199 | { |
172 | /* install exit handler for cleanup */ |
200 | /* install exit handler for cleanup */ |
… | |
… | |
189 | sa.sa_handler = rxvt_Child_signal; sigaction (SIGCHLD, &sa, 0); |
217 | sa.sa_handler = rxvt_Child_signal; sigaction (SIGCHLD, &sa, 0); |
190 | |
218 | |
191 | /* need to trap SIGURG for SVR4 (Unixware) rlogin */ |
219 | /* need to trap SIGURG for SVR4 (Unixware) rlogin */ |
192 | /* signal (SIGURG, SIG_DFL); */ |
220 | /* signal (SIGURG, SIG_DFL); */ |
193 | |
221 | |
194 | XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler); |
222 | old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler); |
195 | //XSetIOErrorHandler ((XErrorHandler) rxvt_xioerror_handler); |
223 | //XSetIOErrorHandler ((XErrorHandler) rxvt_xioerror_handler); |
196 | } |
224 | } |
197 | |
225 | |
198 | bool |
226 | bool |
199 | rxvt_term::init (int argc, const char *const *argv) |
227 | rxvt_term::init (int argc, const char *const *argv) |
… | |
… | |
231 | Gr_reset (); /* reset graphics */ |
259 | Gr_reset (); /* reset graphics */ |
232 | #endif |
260 | #endif |
233 | |
261 | |
234 | #if 0 |
262 | #if 0 |
235 | #ifdef DEBUG_X |
263 | #ifdef DEBUG_X |
236 | XSynchronize(Xdisplay, True); |
264 | XSynchronize(display->display, True); |
237 | #endif |
265 | #endif |
238 | #endif |
266 | #endif |
239 | |
267 | |
240 | #ifdef HAVE_SCROLLBARS |
268 | #ifdef HAVE_SCROLLBARS |
241 | if (Options & Opt_scrollBar) |
269 | if (Options & Opt_scrollBar) |
242 | resize_scrollbar (); /* create and map scrollbar */ |
270 | resize_scrollbar (); /* create and map scrollbar */ |
243 | #endif |
271 | #endif |
244 | #if (MENUBAR_MAX) |
272 | #if (MENUBAR_MAX) |
245 | if (menubar_visible(r)) |
273 | if (menubar_visible(r)) |
246 | XMapWindow (Xdisplay, menuBar.win); |
274 | XMapWindow (display->display, menuBar.win); |
247 | #endif |
275 | #endif |
248 | #ifdef TRANSPARENT |
276 | #ifdef TRANSPARENT |
249 | if (Options & Opt_transparent) |
277 | if (Options & Opt_transparent) |
250 | { |
278 | { |
251 | XSelectInput (Xdisplay, Xroot, PropertyChangeMask); |
279 | XSelectInput (display->display, display->root, PropertyChangeMask); |
|
|
280 | rootwin_ev.start (display, display->root); |
252 | check_our_parents (); |
281 | check_our_parents (); |
253 | } |
282 | } |
254 | #endif |
283 | #endif |
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 | /* ------------------------------------------------------------------------- * |
… | |
… | |
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 | } |
… | |
… | |
637 | } |
658 | } |
638 | if (scrollbar_visible () && (Options & Opt_scrollBar_right)) |
659 | if (scrollbar_visible () && (Options & Opt_scrollBar_right)) |
639 | window_sb_x = szHint.width - sb_w; |
660 | window_sb_x = szHint.width - sb_w; |
640 | |
661 | |
641 | if (recalc_x) |
662 | if (recalc_x) |
642 | szHint.x += (DisplayWidth (Xdisplay, DefaultScreen (Xdisplay)) |
663 | szHint.x += (DisplayWidth (display->display, DefaultScreen (display->display)) |
643 | - szHint.width - 2 * TermWin.ext_bwidth); |
664 | - szHint.width - 2 * TermWin.ext_bwidth); |
644 | if (recalc_y) |
665 | if (recalc_y) |
645 | szHint.y += (DisplayHeight (Xdisplay, DefaultScreen (Xdisplay)) |
666 | szHint.y += (DisplayHeight (display->display, DefaultScreen (display->display)) |
646 | - szHint.height - 2 * TermWin.ext_bwidth); |
667 | - szHint.height - 2 * TermWin.ext_bwidth); |
647 | |
668 | |
648 | TermWin.ncol = TermWin.width / TermWin.fwidth; |
669 | TermWin.ncol = TermWin.width / TermWin.fwidth; |
649 | TermWin.nrow = TermWin.height / TermWin.fheight; |
670 | TermWin.nrow = TermWin.height / TermWin.fheight; |
650 | D_SIZE((stderr, "> Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d", |
671 | D_SIZE((stderr, "> Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d", |
… | |
… | |
702 | /* xterm sequences - title, iconName, color (exptl) */ |
723 | /* xterm sequences - title, iconName, color (exptl) */ |
703 | void |
724 | void |
704 | rxvt_term::set_title (const char *str) |
725 | rxvt_term::set_title (const char *str) |
705 | { |
726 | { |
706 | #ifndef SMART_WINDOW_TITLE |
727 | #ifndef SMART_WINDOW_TITLE |
707 | XStoreName(Xdisplay, TermWin.parent[0], str); |
728 | XStoreName(display->display, TermWin.parent[0], str); |
708 | #else |
729 | #else |
709 | char *name; |
730 | char *name; |
710 | |
731 | |
711 | if (XFetchName(Xdisplay, TermWin.parent[0], &name) == 0) |
732 | if (XFetchName(display->display, TermWin.parent[0], &name) == 0) |
712 | name = NULL; |
733 | name = NULL; |
713 | if (name == NULL || STRCMP(name, str)) |
734 | if (name == NULL || STRCMP(name, str)) |
714 | XStoreName(Xdisplay, TermWin.parent[0], str); |
735 | XStoreName(display->display, TermWin.parent[0], str); |
715 | if (name) |
736 | if (name) |
716 | XFree(name); |
737 | XFree(name); |
717 | #endif |
738 | #endif |
718 | } |
739 | } |
719 | |
740 | |
720 | void |
741 | void |
721 | rxvt_term::set_iconName (const char *str) |
742 | rxvt_term::set_iconName (const char *str) |
722 | { |
743 | { |
723 | #ifndef SMART_WINDOW_TITLE |
744 | #ifndef SMART_WINDOW_TITLE |
724 | XSetIconName(Xdisplay, TermWin.parent[0], str); |
745 | XSetIconName(display->display, TermWin.parent[0], str); |
725 | #else |
746 | #else |
726 | char *name; |
747 | char *name; |
727 | |
748 | |
728 | if (XGetIconName(Xdisplay, TermWin.parent[0], &name)) |
749 | if (XGetIconName(display->display, TermWin.parent[0], &name)) |
729 | name = NULL; |
750 | name = NULL; |
730 | if (name == NULL || STRCMP(name, str)) |
751 | if (name == NULL || STRCMP(name, str)) |
731 | XSetIconName(Xdisplay, TermWin.parent[0], str); |
752 | XSetIconName(display->display, TermWin.parent[0], str); |
732 | if (name) |
753 | if (name) |
733 | XFree(name); |
754 | XFree(name); |
734 | #endif |
755 | #endif |
735 | } |
756 | } |
736 | |
757 | |
… | |
… | |
765 | goto Done; |
786 | goto Done; |
766 | } |
787 | } |
767 | } |
788 | } |
768 | if (!rXParseAllocColor (& xcol, color)) |
789 | if (!rXParseAllocColor (& xcol, color)) |
769 | return; |
790 | return; |
770 | /* XStoreColor (Xdisplay, XCMAP, XColor*); */ |
791 | /* XStoreColor (display->display, XCMAP, XColor*); */ |
771 | |
792 | |
772 | /* |
793 | /* |
773 | * FIXME: should free colors here, but no idea how to do it so instead, |
794 | * FIXME: should free colors here, but no idea how to do it so instead, |
774 | * so just keep gobbling up the colormap |
795 | * so just keep gobbling up the colormap |
775 | */ |
796 | */ |
… | |
… | |
778 | if (PixColors[idx] == PixColors[i]) |
799 | if (PixColors[idx] == PixColors[i]) |
779 | break; |
800 | break; |
780 | if (i > Color_White) |
801 | if (i > Color_White) |
781 | { |
802 | { |
782 | /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */ |
803 | /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */ |
783 | XFreeColors(Xdisplay, XCMAP, (PixColors + idx), 1, |
804 | XFreeColors(display->display, XCMAP, (PixColors + idx), 1, |
784 | DisplayPlanes(Xdisplay, Xscreen)); |
805 | DisplayPlanes(display->display, display->screen)); |
785 | } |
806 | } |
786 | # endif |
807 | # endif |
787 | |
808 | |
788 | PixColors[idx] = xcol; |
809 | PixColors[idx] = xcol; |
789 | SET_PIXCOLOR(idx); |
810 | SET_PIXCOLOR(idx); |
790 | |
811 | |
791 | /* XSetWindowAttributes attr; */ |
812 | /* XSetWindowAttributes attr; */ |
792 | /* Cursor cursor; */ |
813 | /* Cursor cursor; */ |
793 | Done: |
814 | Done: |
794 | if (idx == Color_bg && !(Options & Opt_transparent)) |
815 | if (idx == Color_bg && !(Options & Opt_transparent)) |
795 | XSetWindowBackground(Xdisplay, TermWin.vt, |
816 | XSetWindowBackground(display->display, TermWin.vt, |
796 | PixColors[Color_bg]); |
817 | PixColors[Color_bg]); |
797 | |
818 | |
798 | /* handle Color_BD, scrollbar background, etc. */ |
819 | /* handle Color_BD, scrollbar background, etc. */ |
799 | |
820 | |
800 | set_colorfgbg (); |
821 | set_colorfgbg (); |
… | |
… | |
813 | #if TODO |
834 | #if TODO |
814 | rxvt_color xcol[2]; |
835 | rxvt_color xcol[2]; |
815 | |
836 | |
816 | xcol[0] = PixColors[Color_pointer]; |
837 | xcol[0] = PixColors[Color_pointer]; |
817 | xcol[1] = PixColors[Color_bg]; |
838 | xcol[1] = PixColors[Color_bg]; |
818 | XQueryColors (Xdisplay, XCMAP, xcol, 2); |
839 | XQueryColors (display->display, XCMAP, xcol, 2); |
819 | XRecolorCursor (Xdisplay, TermWin_cursor, &(xcol[0]), &(xcol[1])); |
840 | XRecolorCursor (display->display, TermWin_cursor, &(xcol[0]), &(xcol[1])); |
820 | #endif |
841 | #endif |
821 | } |
842 | } |
822 | |
843 | |
823 | /*----------------------------------------------------------------------*/ |
844 | /*----------------------------------------------------------------------*/ |
824 | /* |
845 | /* |
… | |
… | |
872 | */ |
893 | */ |
873 | |
894 | |
874 | int |
895 | int |
875 | rxvt_term::rXParseAllocColor (rxvt_color *screen_in_out, const char *colour) |
896 | rxvt_term::rXParseAllocColor (rxvt_color *screen_in_out, const char *colour) |
876 | { |
897 | { |
877 | if (!screen_in_out->set (this, colour)) |
898 | if (!screen_in_out->set (display, colour)) |
878 | { |
899 | { |
879 | rxvt_print_error("can't allocate colour: %s", colour); |
900 | rxvt_print_error("can't allocate colour: %s", colour); |
880 | return false; |
901 | return false; |
881 | } |
902 | } |
882 | |
903 | |
… | |
… | |
894 | #ifdef SMART_RESIZE |
915 | #ifdef SMART_RESIZE |
895 | int old_width = szHint.width, old_height = szHint.height; |
916 | int old_width = szHint.width, old_height = szHint.height; |
896 | #endif |
917 | #endif |
897 | |
918 | |
898 | window_calc (width, height); |
919 | window_calc (width, height); |
899 | XSetWMNormalHints (Xdisplay, TermWin.parent[0], &szHint); |
920 | XSetWMNormalHints (display->display, TermWin.parent[0], &szHint); |
900 | if (!ignoreparent) |
921 | if (!ignoreparent) |
901 | { |
922 | { |
902 | #ifdef SMART_RESIZE |
923 | #ifdef SMART_RESIZE |
903 | /* |
924 | /* |
904 | * resize by Marius Gedminas <marius.gedminas@uosis.mif.vu.lt> |
925 | * resize by Marius Gedminas <marius.gedminas@uosis.mif.vu.lt> |
… | |
… | |
907 | int x, y, x1, y1; |
928 | int x, y, x1, y1; |
908 | int dx, dy; |
929 | int dx, dy; |
909 | unsigned int unused_w1, unused_h1, unused_b1, unused_d1; |
930 | unsigned int unused_w1, unused_h1, unused_b1, unused_d1; |
910 | Window unused_cr; |
931 | Window unused_cr; |
911 | |
932 | |
912 | XTranslateCoordinates (Xdisplay, TermWin.parent[0], Xroot, |
933 | XTranslateCoordinates (display->display, TermWin.parent[0], display->root, |
913 | 0, 0, &x, &y, &unused_cr); |
934 | 0, 0, &x, &y, &unused_cr); |
914 | XGetGeometry (Xdisplay, TermWin.parent[0], &unused_cr, &x1, &y1, |
935 | XGetGeometry (display->display, TermWin.parent[0], &unused_cr, &x1, &y1, |
915 | &unused_w1, &unused_h1, &unused_b1, &unused_d1); |
936 | &unused_w1, &unused_h1, &unused_b1, &unused_d1); |
916 | /* |
937 | /* |
917 | * if Xroot isn't the parent window, a WM will probably have offset |
938 | * if display->root isn't the parent window, a WM will probably have offset |
918 | * our position for handles and decorations. Counter it |
939 | * our position for handles and decorations. Counter it |
919 | */ |
940 | */ |
920 | if (x1 != x || y1 != y) |
941 | if (x1 != x || y1 != y) |
921 | { |
942 | { |
922 | x -= x1; |
943 | x -= x1; |
923 | y -= y1; |
944 | y -= y1; |
924 | } |
945 | } |
925 | |
946 | |
926 | x1 = (DisplayWidth (Xdisplay, Xscreen) - old_width) / 2; |
947 | x1 = (DisplayWidth (display->display, display->screen) - old_width) / 2; |
927 | y1 = (DisplayHeight (Xdisplay, Xscreen) - old_height) / 2; |
948 | y1 = (DisplayHeight (display->display, display->screen) - old_height) / 2; |
928 | dx = old_width - szHint.width; |
949 | dx = old_width - szHint.width; |
929 | dy = old_height - szHint.height; |
950 | dy = old_height - szHint.height; |
930 | |
951 | |
931 | /* Check position of the center of the window */ |
952 | /* Check position of the center of the window */ |
932 | if (x < x1) /* left half */ |
953 | if (x < x1) /* left half */ |
… | |
… | |
936 | if (y < y1) /* top half */ |
957 | if (y < y1) /* top half */ |
937 | dy = 0; |
958 | dy = 0; |
938 | else if (y == y1) /* exact center */ |
959 | else if (y == y1) /* exact center */ |
939 | dy /= 2; |
960 | dy /= 2; |
940 | |
961 | |
941 | XMoveResizeWindow (Xdisplay, TermWin.parent[0], x + dx, y + dy, |
962 | XMoveResizeWindow (display->display, TermWin.parent[0], x + dx, y + dy, |
942 | szHint.width, szHint.height); |
963 | szHint.width, szHint.height); |
943 | #else |
964 | #else |
944 | XResizeWindow (Xdisplay, TermWin.parent[0], szHint.width, |
965 | XResizeWindow (display->display, TermWin.parent[0], szHint.width, |
945 | szHint.height); |
966 | szHint.height); |
946 | #endif |
967 | #endif |
947 | |
968 | |
948 | } |
969 | } |
949 | |
970 | |
… | |
… | |
952 | |
973 | |
953 | if (fix_screen || width != old_width || height != old_height) |
974 | if (fix_screen || width != old_width || height != old_height) |
954 | { |
975 | { |
955 | if (scrollbar_visible ()) |
976 | if (scrollbar_visible ()) |
956 | { |
977 | { |
957 | XMoveResizeWindow (Xdisplay, scrollBar.win, window_sb_x, |
978 | XMoveResizeWindow (display->display, scrollBar.win, window_sb_x, |
958 | 0, scrollbar_TotalWidth (), szHint.height); |
979 | 0, scrollbar_TotalWidth (), szHint.height); |
959 | resize_scrollbar (); |
980 | resize_scrollbar (); |
960 | } |
981 | } |
961 | |
982 | |
962 | if (menubar_visible ()) |
983 | if (menubar_visible ()) |
963 | XMoveResizeWindow (Xdisplay, menuBar.win, window_vt_x, |
984 | XMoveResizeWindow (display->display, menuBar.win, window_vt_x, |
964 | 0, TermWin_TotalWidth (), menuBar_TotalHeight ()); |
985 | 0, TermWin_TotalWidth (), menuBar_TotalHeight ()); |
965 | |
986 | |
966 | XMoveResizeWindow (Xdisplay, TermWin.vt, window_vt_x, |
987 | XMoveResizeWindow (display->display, TermWin.vt, window_vt_x, |
967 | window_vt_y, TermWin_TotalWidth (), |
988 | window_vt_y, TermWin_TotalWidth (), |
968 | TermWin_TotalHeight ()); |
989 | TermWin_TotalHeight ()); |
969 | #ifdef RXVT_GRAPHICS |
990 | #ifdef RXVT_GRAPHICS |
970 | if (old_height) |
991 | if (old_height) |
971 | Gr_Resize (old_width - szHint.base_width, |
992 | Gr_Resize (old_width - szHint.base_width, |
… | |
… | |
1018 | { |
1039 | { |
1019 | XWindowAttributes wattr; |
1040 | XWindowAttributes wattr; |
1020 | |
1041 | |
1021 | if (width == 0 || height == 0) |
1042 | if (width == 0 || height == 0) |
1022 | { |
1043 | { |
1023 | XGetWindowAttributes(Xdisplay, Xroot, &wattr); |
1044 | XGetWindowAttributes(display->display, display->root, &wattr); |
1024 | if (width == 0) |
1045 | if (width == 0) |
1025 | width = wattr.width - szHint.base_width; |
1046 | width = wattr.width - szHint.base_width; |
1026 | if (height == 0) |
1047 | if (height == 0) |
1027 | height = wattr.height - szHint.base_height; |
1048 | height = wattr.height - szHint.base_height; |
1028 | } |
1049 | } |
… | |
… | |
1069 | STRCPY(server, "@server="); |
1090 | STRCPY(server, "@server="); |
1070 | STRNCAT(server, &(p[4]), IMBUFSIZ - 9); /* skip "@im=" */ |
1091 | STRNCAT(server, &(p[4]), IMBUFSIZ - 9); /* skip "@im=" */ |
1071 | if ((p = STRCHR(server + 1, '@')) != NULL) /* first one only */ |
1092 | if ((p = STRCHR(server + 1, '@')) != NULL) /* first one only */ |
1072 | *p = '\0'; |
1093 | *p = '\0'; |
1073 | |
1094 | |
1074 | atom = XInternAtom(Xdisplay, server, False); |
1095 | atom = XInternAtom(display->display, server, False); |
1075 | win = XGetSelectionOwner(Xdisplay, atom); |
1096 | win = XGetSelectionOwner(display->display, atom); |
1076 | if (win != None) |
1097 | if (win != None) |
1077 | return True; |
1098 | return True; |
1078 | } |
1099 | } |
1079 | return False; |
1100 | return False; |
1080 | } |
1101 | } |
… | |
… | |
1135 | __attribute__ ((unused))) |
1156 | __attribute__ ((unused))) |
1136 | { |
1157 | { |
1137 | GET_R->Input_Context = NULL; |
1158 | GET_R->Input_Context = NULL; |
1138 | /* To avoid Segmentation Fault in C locale: Solaris only? */ |
1159 | /* To avoid Segmentation Fault in C locale: Solaris only? */ |
1139 | if (STRCMP (GET_R->locale, "C")) |
1160 | if (STRCMP (GET_R->locale, "C")) |
1140 | XRegisterIMInstantiateCallback(GET_R->Xdisplay, NULL, NULL, NULL, |
1161 | XRegisterIMInstantiateCallback(GET_R->display->display, NULL, NULL, NULL, |
1141 | rxvt_IMInstantiateCallback, NULL); |
1162 | rxvt_IMInstantiateCallback, NULL); |
1142 | } |
1163 | } |
1143 | |
1164 | |
1144 | /* |
1165 | /* |
1145 | * Try to open a XIM with the current modifiers, then see if we can |
1166 | * Try to open a XIM with the current modifiers, then see if we can |
… | |
… | |
1158 | XIMStyles *xim_styles; |
1179 | XIMStyles *xim_styles; |
1159 | XVaNestedList preedit_attr, status_attr; |
1180 | XVaNestedList preedit_attr, status_attr; |
1160 | XIMCallback ximcallback; |
1181 | XIMCallback ximcallback; |
1161 | |
1182 | |
1162 | D_MAIN((stderr, "rxvt_IM_get_IC()")); |
1183 | D_MAIN((stderr, "rxvt_IM_get_IC()")); |
1163 | xim = XOpenIM (Xdisplay, NULL, NULL, NULL); |
1184 | xim = XOpenIM (display->display, NULL, NULL, NULL); |
1164 | if (xim == NULL) |
1185 | if (xim == NULL) |
1165 | return False; |
1186 | return False; |
1166 | |
1187 | |
1167 | xim_styles = NULL; |
1188 | xim_styles = NULL; |
1168 | if (XGetIMValues (xim, XNQueryInputStyle, &xim_styles, NULL) |
1189 | if (XGetIMValues (xim, XNQueryInputStyle, &xim_styles, NULL) |