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.316 by root, Sun Apr 26 01:51:20 2009 UTC vs.
Revision 1.327 by root, Sun May 23 00:25:48 2010 UTC

35#include "keyboard.h" 35#include "keyboard.h"
36#include "rxvtperl.h" 36#include "rxvtperl.h"
37 37
38#include <limits> 38#include <limits>
39 39
40#include <cassert>
40#include <csignal> 41#include <csignal>
41#include <cstring> 42#include <cstring>
42 43
43#include <termios.h> 44#include <termios.h>
44 45
101 { 102 {
102 if (cc->c2 == c2) return c1; 103 if (cc->c2 == c2) return c1;
103 cc = (*this)[cc->c1]; 104 cc = (*this)[cc->c1];
104 } 105 }
105 106
106 // check to see wether this combination already exists otherwise 107 // check to see whether this combination already exists otherwise
107 for (cc = v.end (); cc-- > v.begin (); ) 108 for (cc = v.end (); cc-- > v.begin (); )
108 { 109 {
109 if (cc->c1 == c1 && cc->c2 == c2) 110 if (cc->c1 == c1 && cc->c2 == c2)
110 return COMPOSE_LO + (cc - v.begin ()); 111 return COMPOSE_LO + (cc - v.begin ());
111 } 112 }
237#endif 238#endif
238 239
239 if (display) 240 if (display)
240 { 241 {
241 selection_clear (); 242 selection_clear ();
243 selection_clear (true);
242 244
243#ifdef USE_XIM 245#ifdef USE_XIM
244 im_destroy (); 246 im_destroy ();
245#endif 247#endif
246 scrollBar.destroy (); 248 scrollBar.destroy ();
271 /* clear all resources */ 273 /* clear all resources */
272 for (int i = 0; i < allocated.size (); i++) 274 for (int i = 0; i < allocated.size (); i++)
273 free (allocated [i]); 275 free (allocated [i]);
274 276
275 free (selection.text); 277 free (selection.text);
278 free (selection.clip_text);
276 // TODO: manage env vars in child only(!) 279 // TODO: manage env vars in child only(!)
277 free (env_display); 280 free (env_display);
278 free (env_term); 281 free (env_term);
279 free (locale); 282 free (locale);
280 free (v_buffer); 283 free (v_buffer);
388 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->request_code); 391 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->request_code);
389 sprintf(number, "%d", event->request_code); 392 sprintf(number, "%d", event->request_code);
390 XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); 393 XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ);
391 rxvt_warn ("(which is %s)\n", buffer); 394 rxvt_warn ("(which is %s)\n", buffer);
392 if (event->request_code >= 128) { 395 if (event->request_code >= 128) {
393 XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", 396 XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d",
394 mesg, BUFSIZ); 397 mesg, BUFSIZ);
395 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->minor_code); 398 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->minor_code);
396 } 399 }
397 if ((event->error_code == BadWindow) || 400 if ((event->error_code == BadWindow) ||
398 (event->error_code == BadPixmap) || 401 (event->error_code == BadPixmap) ||
399 (event->error_code == BadCursor) || 402 (event->error_code == BadCursor) ||
400 (event->error_code == BadFont) || 403 (event->error_code == BadFont) ||
401 (event->error_code == BadDrawable) || 404 (event->error_code == BadDrawable) ||
402 (event->error_code == BadColor) || 405 (event->error_code == BadColor) ||
403 (event->error_code == BadGC) || 406 (event->error_code == BadGC) ||
404 (event->error_code == BadIDChoice) || 407 (event->error_code == BadIDChoice) ||
405 (event->error_code == BadValue) || 408 (event->error_code == BadValue) ||
406 (event->error_code == BadAtom)) { 409 (event->error_code == BadAtom)) {
407 if (event->error_code == BadValue) 410 if (event->error_code == BadValue)
408 XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", 411 XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x",
409 mesg, BUFSIZ); 412 mesg, BUFSIZ);
410 else if (event->error_code == BadAtom) 413 else if (event->error_code == BadAtom)
411 XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", 414 XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x",
412 mesg, BUFSIZ); 415 mesg, BUFSIZ);
413 else 416 else
414 XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", 417 XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x",
415 mesg, BUFSIZ); 418 mesg, BUFSIZ);
416 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->resourceid); 419 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->resourceid);
417 } 420 }
418 XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", 421 XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d",
419 mesg, BUFSIZ); 422 mesg, BUFSIZ);
420 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->serial); 423 rxvt_warn (strncat (mesg, "\n", BUFSIZ), event->serial);
421} 424}
422#endif 425#endif
423 426
424int 427int
476char **rxvt_environ; // startup environment 479char **rxvt_environ; // startup environment
477 480
478void 481void
479rxvt_init () 482rxvt_init ()
480{ 483{
484 assert (("fontMask must not overlap other RS masks",
485 0 == (RS_fontMask & (RS_Sel | RS_baseattrMask | RS_customMask | RS_bgMask | RS_fgMask))));
486
481 ptytty::init (); 487 ptytty::init ();
482 488
483 if (!ev_default_loop (0)) 489 if (!ev_default_loop (0))
484 rxvt_fatal ("cannot initialise libev (bad value for LIBEV_METHODS?)\n"); 490 rxvt_fatal ("cannot initialise libev (bad value for LIBEV_METHODS?)\n");
485 491
646 652
647 ws.ws_col = ncol; 653 ws.ws_col = ncol;
648 ws.ws_row = nrow; 654 ws.ws_row = nrow;
649 ws.ws_xpixel = width; 655 ws.ws_xpixel = width;
650 ws.ws_ypixel = height; 656 ws.ws_ypixel = height;
651 (void)ioctl (pty->pty, TIOCSWINSZ, &ws); 657 ioctl (pty->pty, TIOCSWINSZ, &ws);
652 658
653#if 0 659#if 0
654 // TIOCSWINSZ is supposed to do this automatically and correctly 660 // TIOCSWINSZ is supposed to do this automatically and correctly
655 if (cmd_pid) /* force through to the command */ 661 if (cmd_pid) /* force through to the command */
656 kill (-cmd_pid, SIGWINCH); 662 kill (-cmd_pid, SIGWINCH);
686#endif 692#endif
687 693
688 delete fontset[0]; 694 delete fontset[0];
689 fontset[0] = fs; 695 fontset[0] = fs;
690 696
691 prop = (*fs)[1]->properties (); 697 prop = (*fs)[rxvt_fontset::firstFont]->properties ();
692 prop.height += lineSpace; 698 prop.height += lineSpace;
699 prop.width += letterSpace;
693 700
694 fs->set_prop (prop, false); 701 fs->set_prop (prop, false);
695 702
696 fwidth = prop.width; 703 fwidth = prop.width;
697 fheight = prop.height; 704 fheight = prop.height;
992 } 999 }
993 1000
994 if (fix_screen || old_height == 0) 1001 if (fix_screen || old_height == 0)
995 scr_reset (); 1002 scr_reset ();
996 1003
997 // TODO, with nvidia-8178, resizes kill the alpha channel, report if not fixed in newer version
998 //scr_touch (false);
999
1000#ifdef HAVE_BG_PIXMAP 1004#ifdef HAVE_BG_PIXMAP
1001// TODO: this don't seem to have any effect - do we still need it ? If so - in which case exactly ? 1005// TODO: this don't seem to have any effect - do we still need it ? If so - in which case exactly ?
1002// if (bgPixmap.pixmap) 1006// if (bgPixmap.pixmap)
1003// scr_touch (false); 1007// scr_touch (false);
1004#endif 1008#endif
1162 1166
1163 term->make_current (); 1167 term->make_current ();
1164 1168
1165 if (text) 1169 if (text)
1166 { 1170 {
1167 void *str; 1171 wchar_t *str;
1168 1172
1169 if (!text->encoding_is_wchar && text->string.multi_byte) 1173 if (!text->encoding_is_wchar && text->string.multi_byte)
1170 { 1174 {
1171 // of course, X makes it ugly again 1175 // of course, X makes it ugly again
1172 if (term->rs[Rs_imLocale]) 1176 if (term->rs[Rs_imLocale])
1173 SET_LOCALE (term->rs[Rs_imLocale]); 1177 SET_LOCALE (term->rs[Rs_imLocale]);
1174 1178
1175 str = rxvt_temp_buf ((text->length + 1) * sizeof (wchar_t)); 1179 str = rxvt_temp_buf<wchar_t> (text->length + 1);
1176 mbstowcs ((wchar_t *)str, text->string.multi_byte, text->length + 1); 1180 mbstowcs (str, text->string.multi_byte, text->length + 1);
1177 1181
1178 if (term->rs[Rs_imLocale]) 1182 if (term->rs[Rs_imLocale])
1179 SET_LOCALE (term->locale); 1183 SET_LOCALE (term->locale);
1180 } 1184 }
1181 else 1185 else
1182 str = (void *)text->string.wide_char; 1186 str = text->string.wide_char;
1183 1187
1184 HOOK_INVOKE ((term, HOOK_XIM_PREEDIT_DRAW, 1188 HOOK_INVOKE ((term, HOOK_XIM_PREEDIT_DRAW,
1185 DT_INT, call_data->caret, 1189 DT_INT, call_data->caret,
1186 DT_INT, call_data->chg_first, 1190 DT_INT, call_data->chg_first,
1187 DT_INT, call_data->chg_length, 1191 DT_INT, call_data->chg_length,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines