~ubuntu-branches/ubuntu/jaunty/rxvt-unicode/jaunty-proposed

« back to all changes in this revision

Viewing changes to src/command.C

  • Committer: Bazaar Package Importer
  • Author(s): Decklin Foster
  • Date: 2007-10-27 21:08:55 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20071027210855-t8uemvmx1g7juaed
Tags: 8.4-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
97
97
 
98
98
  XK_Shift_Lock,        0x21eb,
99
99
  XK_ISO_Lock,          0x21eb,
100
 
  XK_ISO_Lock,          0x21eb,
101
100
  XK_Caps_Lock,         0x21ec,
102
101
  XK_Num_Lock,          0x21ed,
103
102
  XK_ISO_Level3_Shift,  0x21ee,
550
549
      if (keysym >= 0xFF00 && keysym <= 0xFFFF)
551
550
        {
552
551
            {
 
552
              bool kp = priv_modes & PrivMode_aplKP ? !shft : shft;
553
553
              newlen = 1;
554
554
              switch (keysym)
555
555
                {
562
562
                        kbuf[1] = '\0';
563
563
                      }
564
564
                    else
565
 
                      strcpy (kbuf, key_backspace);
 
565
                      strcpy (kbuf, rs[Rs_backspace_key]);
566
566
                    break;
567
567
#endif
568
568
#ifndef NO_DELETE_KEY
569
 
# ifdef XK_KP_Prior
 
569
# ifdef XK_KP_Delete
570
570
                  case XK_KP_Delete:
571
571
                    /* allow shift to override */
572
 
                    if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
 
572
                    if (kp)
573
573
                      {
574
574
                        strcpy (kbuf, "\033On");
575
575
                        break;
577
577
                    /* FALLTHROUGH */
578
578
# endif
579
579
                  case XK_Delete:
580
 
                    strcpy (kbuf, key_delete);
 
580
                    strcpy (kbuf, rs[Rs_delete_key]);
581
581
                    break;
582
582
#endif
583
583
                  case XK_Tab:
602
602
                  case XK_KP_Down:      /* \033Or or standard */
603
603
                  case XK_KP_Right:     /* \033Ov or standard */
604
604
                  case XK_KP_Left:      /* \033Ot or standard */
605
 
                    if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
 
605
                    if (kp)
606
606
                      {
607
607
                        strcpy (kbuf, "\033OZ");
608
608
                        kbuf[2] = "txvr"[keysym - XK_KP_Left];
635
635
# ifdef XK_KP_Prior
636
636
                  case XK_KP_Prior:
637
637
                    /* allow shift to override */
638
 
                    if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
 
638
                    if (kp)
639
639
                      {
640
640
                        strcpy (kbuf, "\033Oy");
641
641
                        break;
648
648
# ifdef XK_KP_Next
649
649
                  case XK_KP_Next:
650
650
                    /* allow shift to override */
651
 
                    if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
 
651
                    if (kp)
652
652
                      {
653
653
                        strcpy (kbuf, "\033Os");
654
654
                        break;
661
661
#endif
662
662
                  case XK_KP_Enter:
663
663
                    /* allow shift to override */
664
 
                    if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
 
664
                    if (kp)
665
665
                      {
666
666
                        strcpy (kbuf, "\033OM");
667
667
                        break;
714
714
                  case XK_KP_8:         /* "\033Ox" : "8" */
715
715
                  case XK_KP_9:         /* "\033Oy" : "9" */
716
716
                    /* allow shift to override */
717
 
                    if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
 
717
                    if (kp)
718
718
                      {
719
719
                        strcpy (kbuf, "\033Oj");
720
720
                        kbuf[2] += (keysym - XK_KP_Multiply);
733
733
#ifdef XK_KP_Insert
734
734
                  case XK_KP_Insert:
735
735
                    /* allow shift to override */
736
 
                    if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
 
736
                    if (kp)
737
737
                      {
738
738
                        strcpy (kbuf, "\033Op");
739
739
                        break;
756
756
#ifdef XK_KP_End
757
757
                  case XK_KP_End:
758
758
                    /* allow shift to override */
759
 
                    if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
 
759
                    if (kp)
760
760
                      {
761
761
                        strcpy (kbuf, "\033Oq");
762
762
                        break;
769
769
#ifdef XK_KP_Home
770
770
                  case XK_KP_Home:
771
771
                    /* allow shift to override */
772
 
                    if ((priv_modes & PrivMode_aplKP) ? !shft : shft)
 
772
                    if (kp)
773
773
                      {
774
774
                        strcpy (kbuf, "\033Ow");
775
775
                        break;
1036
1036
rxvt_term::flush ()
1037
1037
{
1038
1038
  flush_ev.stop ();
1039
 
 
1040
 
#ifdef ENABLE_TRANSPARENCY
1041
 
  if (want_full_refresh)
 
1039
  
 
1040
#ifdef HAVE_BG_PIXMAP  
 
1041
  if (bgPixmap.check_clearChanged ())
1042
1042
    {
1043
 
      want_full_refresh = 0;
1044
 
      scr_clear ();
 
1043
//      scr_clear (true); This needs to be researched further!
1045
1044
      scr_touch (false);
1046
1045
    }
1047
1046
#endif
1304
1303
{
1305
1304
  int button_number, key_state = 0;
1306
1305
  int x, y;
 
1306
  int code = 32;
1307
1307
 
1308
 
  x = ev.x;
1309
 
  y = ev.y;
1310
 
  pixel_position (&x, &y);
 
1308
  x = Pixel2Col (ev.x);
 
1309
  y = Pixel2Row (ev.y);
 
1310
  if (ev.type == MotionNotify) {
 
1311
    if (x == mouse_row && y == mouse_col)
 
1312
      return;
 
1313
    mouse_row = x;
 
1314
    mouse_col = y;
 
1315
    code += 32;
 
1316
  }
1311
1317
 
1312
1318
  if (MEvent.button == AnyButton)
1313
1319
    button_number = 3;
1363
1369
#endif
1364
1370
 
1365
1371
  tt_printf ("\033[M%c%c%c",
1366
 
            (32 + button_number + key_state),
 
1372
            (code + button_number + key_state),
1367
1373
            (32 + x + 1),
1368
1374
            (32 + y + 1));
1369
1375
}
1477
1483
        break;
1478
1484
 
1479
1485
      case ConfigureNotify:
 
1486
      /* fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n",
 
1487
              ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y,
 
1488
              szHint.width, szHint.height); */
1480
1489
        if (ev.xconfigure.window == parent[0])
1481
1490
          {
1482
1491
            while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev))
1486
1495
              {
1487
1496
                seen_resize = 1;
1488
1497
                resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1489
 
#ifdef XPM_BACKGROUND
1490
 
                if (!option (Opt_transparent) && bgPixmap.auto_resize)
1491
 
                  {
1492
 
                    resize_pixmap ();
1493
 
                    scr_touch (true);
1494
 
                  }
 
1498
              }
 
1499
            else
 
1500
              {
 
1501
#ifdef HAVE_BG_PIXMAP
 
1502
                if (bgPixmap.window_position_sensitive ())
 
1503
                  update_background ();
1495
1504
#endif
1496
1505
              }
1497
 
 
1498
1506
            HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END));
1499
 
 
1500
 
#ifdef ENABLE_TRANSPARENCY
1501
 
            if (option (Opt_transparent))
1502
 
              check_our_parents ();
1503
 
#endif
1504
1507
          }
1505
1508
        break;
1506
1509
 
1541
1544
        HOOK_INVOKE ((this, HOOK_UNMAP_NOTIFY, DT_XEVENT, &ev, DT_END));
1542
1545
        break;
1543
1546
 
1544
 
#ifdef ENABLE_TRANSPARENCY
1545
 
      case ReparentNotify:
1546
 
        rootwin_cb (ev);
1547
 
        break;
1548
 
#endif                          /* ENABLE_TRANSPARENCY */
1549
 
 
1550
1547
      case GraphicsExpose:
1551
1548
      case Expose:
1552
1549
        if (ev.xany.window == vt)
1553
1550
          {
1554
1551
            do
1555
 
              scr_expose (ev.xexpose.x, ev.xexpose.y,
1556
 
                          ev.xexpose.width, ev.xexpose.height, False);
 
1552
              {
 
1553
                scr_expose (ev.xexpose.x, ev.xexpose.y,
 
1554
                            ev.xexpose.width, ev.xexpose.height, False);
 
1555
              }
1557
1556
            while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev));
1558
1557
 
1559
1558
            ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
1560
1559
 
1561
1560
            while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
1562
 
              scr_expose (ev.xexpose.x, ev.xexpose.y,
1563
 
                          ev.xexpose.width, ev.xexpose.height, False);
1564
 
 
 
1561
              {
 
1562
                scr_expose (ev.xexpose.x, ev.xexpose.y,
 
1563
                            ev.xexpose.width, ev.xexpose.height, False);
 
1564
              }
1565
1565
            want_refresh = 1;
1566
1566
          }
1567
1567
        else
1578
1578
                scrollBar.setIdle ();
1579
1579
                scrollbar_show (0);
1580
1580
              }
1581
 
 
1582
 
#ifdef ENABLE_TRANSPARENCY
1583
 
            if (am_transparent && ev.xany.window == parent[0])
1584
 
              XClearWindow (dpy, ev.xany.window);
1585
 
#endif
1586
1581
          }
1587
1582
        break;
1588
1583
 
1591
1586
        if (hidden_pointer)
1592
1587
          pointer_unblank ();
1593
1588
#endif
 
1589
        if ((priv_modes & PrivMode_MouseBtnEvent && ev.xbutton.state & (Button1Mask|Button2Mask|Button3Mask))
 
1590
            || priv_modes & PrivMode_MouseAnyEvent)
 
1591
          mouse_report (ev.xbutton);
1594
1592
        if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate)
1595
1593
          break;
1596
1594
 
1754
1752
#if ENABLE_FRILLS
1755
1753
      if (option (Opt_urgentOnBell))
1756
1754
        {
1757
 
          XWMHints *h;
1758
 
 
1759
 
          h = XGetWMHints(dpy, parent[0]);
1760
 
          if (h != NULL)
 
1755
          if (XWMHints *h = XGetWMHints(dpy, parent[0]))
1761
1756
            {
1762
1757
              h->flags &= ~XUrgencyHint;
1763
 
              XSetWMHints(dpy, parent[0], h);
 
1758
              XSetWMHints (dpy, parent[0], h);
1764
1759
            }
1765
1760
        }
1766
1761
#endif
1836
1831
         * if user used some Esetroot compatible prog to set the root bg,
1837
1832
         * use the property to determine the pixmap.  We use it later on.
1838
1833
         */
1839
 
        if (ev.xproperty.atom != xa[XA_XROOTPMAP_ID]
1840
 
            && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID])
1841
 
          return;
1842
 
 
1843
 
        /* FALLTHROUGH */
1844
 
      case ReparentNotify:
1845
 
        if (option (Opt_transparent))
1846
 
          check_our_parents ();
 
1834
        if (ev.xproperty.atom == xa[XA_XROOTPMAP_ID]
 
1835
            || ev.xproperty.atom == xa[XA_ESETROOT_PMAP_ID])
 
1836
          {
 
1837
            bgPixmap.set_root_pixmap ();
 
1838
            update_background ();
 
1839
          }
1847
1840
        break;
1848
1841
    }
1849
1842
# endif
2808
2801
  unicode_t ch, priv, i;
2809
2802
  unsigned int nargs, p;
2810
2803
  int n, ndef;
2811
 
  int arg[ESC_ARGS];
 
2804
  int arg[ESC_ARGS] = { };
2812
2805
 
2813
 
  memset (arg, 0, sizeof (arg));
2814
2806
  nargs = 0;
2815
2807
 
2816
2808
  priv = 0;
2869
2861
                // 'U' for rxvt-unicode != 7.[34] (where it was broken).
2870
2862
                //
2871
2863
                // second parameter is xterm patch level for xterm, MMmmpp (e.g. 20703) for rxvt
2872
 
                // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, and 94 for later versions, to signify
2873
 
                // that we do not support xterm mouse reporting (should be 95 when we do).
 
2864
                // and Mm (e.g. 72 for 7.2) for urxvt <= 7.2, 94 for urxvt <= 8.3, and 95 for later
 
2865
                // versions.
2874
2866
                //
2875
 
                tt_printf ("\033[>%d;94;0c", 'U');
 
2867
                tt_printf ("\033[>%d;95;0c", 'U');
2876
2868
              }
2877
2869
            break;
2878
2870
          case '?':
3433
3425
        process_color_seq (op, Color_IT, str, resp);
3434
3426
        break;
3435
3427
#endif
3436
 
#if ENABLE_TRANSPARENCY && TINTING
 
3428
#if ENABLE_TRANSPARENCY
3437
3429
      case URxvt_Color_tint:
3438
3430
        process_color_seq (op, Color_tint, str, resp);
3439
 
 
3440
 
        check_our_parents ();
3441
 
 
3442
 
        if (am_transparent)
3443
 
          want_full_refresh = want_refresh = 1;
 
3431
        {
 
3432
          bool changed = false;
 
3433
          if (ISSET_PIXCOLOR (Color_tint))
 
3434
            changed = bgPixmap.set_tint (pix_colors_focused [Color_tint]);
 
3435
          else
 
3436
            changed = bgPixmap.unset_tint ();
 
3437
          if (changed)
 
3438
            update_background ();
 
3439
        }
3444
3440
 
3445
3441
        break;
3446
3442
#endif
3447
3443
 
 
3444
#if BG_IMAGE_FROM_FILE
3448
3445
      case Rxvt_Pixmap:
3449
 
        {
3450
 
          if (*str != ';')
3451
 
            {
3452
 
#if XPM_BACKGROUND
3453
 
              scale_pixmap ("");        /* reset to default scaling */
3454
 
              set_bgPixmap (str);       /* change pixmap */
3455
 
              scr_touch (true);
3456
 
#endif
3457
 
            }
3458
 
 
3459
 
          int changed = 0;
3460
 
 
3461
 
          while ((str = strchr (str, ';')) != NULL)
3462
 
            {
3463
 
              str++;
3464
 
#if XPM_BACKGROUND
3465
 
              changed += scale_pixmap (str);
3466
 
#endif
3467
 
            }
3468
 
 
3469
 
          if (changed)
3470
 
            {
3471
 
#ifdef XPM_BACKGROUND
3472
 
              resize_pixmap ();
3473
 
              scr_touch (true);
3474
 
#endif
3475
 
            }
3476
 
#if ENABLE_TRANSPARENCY && defined(HAVE_AFTERIMAGE)
3477
 
          if (option (Opt_transparent))
3478
 
            check_our_parents ();
3479
 
#endif
3480
 
        }
 
3446
        if (!strcmp (str, "?"))
 
3447
          {
 
3448
            char str[256];
 
3449
 
 
3450
            sprintf (str, "[%dx%d+%d+%d]",      /* can't presume snprintf () ! */
 
3451
                     min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767),
 
3452
                     min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767));
 
3453
            process_xterm_seq (XTerm_title, str, CHAR_ST);
 
3454
          }
 
3455
        else
 
3456
          {
 
3457
            int changed = 0;
 
3458
 
 
3459
            if (*str != ';')
 
3460
              {
 
3461
                /* reset to default scaling :*/
 
3462
                bgPixmap.unset_geometry ();
 
3463
                if (bgPixmap.set_file (str))    /* change pixmap */
 
3464
                  changed++;
 
3465
                str = strchr (str, ';');
 
3466
                if (str == NULL)
 
3467
                  bgPixmap.set_defaultGeometry ();
 
3468
              }
 
3469
            while (str)
 
3470
              {
 
3471
                str++;
 
3472
                if (bgPixmap.set_geometry (str))
 
3473
                  changed++;
 
3474
                str = strchr (str, ';');
 
3475
              }
 
3476
            if (changed)
 
3477
                update_background ();
 
3478
          }
3481
3479
        break;
 
3480
#endif
3482
3481
 
3483
3482
      case Rxvt_restoreFG:
3484
3483
        set_window_color (Color_fg, str);
3610
3609
  int state;
3611
3610
 
3612
3611
  static const struct
3613
 
    {
3614
 
      const int       argval;
3615
 
      const unsigned long bit;
3616
 
    }
3617
 
 
3618
 
  argtopriv[] = {
 
3612
  {
 
3613
    const int       argval;
 
3614
    const unsigned long bit;
 
3615
  } argtopriv[] = {
3619
3616
                  { 1, PrivMode_aplCUR },
3620
3617
                  { 2, PrivMode_vt52 },
3621
3618
                  { 3, PrivMode_132 },
3642
3639
#endif
3643
3640
                  { 1000, PrivMode_MouseX11 },
3644
3641
                 // 1001 Use Hilite Mouse Tracking. NYI, TODO
3645
 
                 // 1002 Use Cell Motion Mouse Tracking. NYI, TODO
3646
 
                 // 1003 Use All Motion Mouse Tracking. NYI, TODO
 
3642
                  { 1002, PrivMode_MouseBtnEvent },
 
3643
                  { 1003, PrivMode_MouseAnyEvent },
3647
3644
                  { 1010, PrivMode_TtyOutputInh }, // rxvt extension
3648
3645
                  { 1011, PrivMode_Keypress }, // rxvt extension
3649
3646
                 // 1035 enable modifiers for alt, numlock NYI
3727
3724
            /* case 8:  - auto repeat, can't do on a per window basis */
3728
3725
            case 9:                     /* X10 mouse reporting */
3729
3726
              if (state)                /* orthogonal */
3730
 
                priv_modes &= ~PrivMode_MouseX11;
 
3727
                priv_modes &= ~(PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3731
3728
              break;
3732
3729
#ifdef scrollBar_esc
3733
3730
            case scrollBar_esc:
3750
3747
            /* case 67: - backspace key */
3751
3748
            case 1000:          /* X11 mouse reporting */
3752
3749
              if (state)                /* orthogonal */
3753
 
                priv_modes &= ~PrivMode_MouseX10;
 
3750
                priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent);
3754
3751
              break;
3755
3752
#if 0
3756
3753
            case 1001:
3757
3754
              break;            /* X11 mouse highlighting */
3758
3755
#endif
 
3756
            case 1002:
 
3757
            case 1003:
 
3758
              if (state) {
 
3759
                priv_modes &= ~(PrivMode_MouseX10|PrivMode_MouseX11);
 
3760
                priv_modes &= arg[i] == 1003 ? ~PrivMode_MouseBtnEvent : ~PrivMode_MouseAnyEvent;
 
3761
                vt_emask_mouse = PointerMotionMask;
 
3762
              } else
 
3763
                vt_emask_mouse = NoEventMask;
 
3764
              vt_select_input ();
 
3765
              break;
3759
3766
            case 1010:          /* scroll to bottom on TTY output inhibit */
3760
3767
              set_option (Opt_scrollTtyOutput, !state);
3761
3768
              break;
4017
4024
        {
4018
4025
          free (v_buffer);
4019
4026
          v_buffer = 0;
4020
 
          v_buflen = 0;
4021
4027
 
4022
4028
          pty_ev.set (EVENT_READ);
4023
4029
          return;