IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 15, 2005, 2:41:53 PM (21 years ago)
Author:
eugene
Message:

cursor now returns a string for key

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/kii/picture/cursor.c

    r3464 r5349  
    1010  int             status;
    1111  XComposeStatus  composestatus;
    12   char            string[10], line[500];
     12  char            string[10], line[40], *name;
    1313  double          x, y;
    1414 
     
    3535    if (LastEvent (display, MotionNotify,    &event)) UpdatePointer (graphic, layout, (XMotionEvent *) &event);
    3636    if (LastEvent (display, ButtonPress,     &event)) InterpretPresses (graphic, layout, (XButtonEvent *) &event);
    37 
    3837    if (LastEvent (display, KeyPress,        &event)) {
    3938      status = XLookupString ((XKeyEvent *) &event, string, 9, &keysym, &composestatus);
    4039
    41       if (!status) continue;
    4240      if (event.xkey.x < layout[0].picture.x) continue;
    4341      if (event.xkey.x > layout[0].picture.x + layout[0].picture.dx) continue;
     
    4644       
    4745      Screen_to_Image (&x, &y, (double)event.xkey.x, (double)event.xkey.y, layout);
     46      name = XKeysymToString (keysym);
    4847
    49       if (isprint(string[0]))
    50         sprintf (line, "%c %6.1f %6.1f ", string[0], x, y);
    51       else {
    52         sprintf (line, "X %6.1f %6.1f ", x, y);
    53       }
    54       write (layout[0].Ximage, line, 16);
     48      // skip the following keys:
     49      if (!strcmp (name, "Shift_L")) continue;
     50      if (!strcmp (name, "Shift_R")) continue;
     51      if (!strcmp (name, "Control_L")) continue;
     52      if (!strcmp (name, "Control_R")) continue;
     53      if (!strcmp (name, "Alt_L")) continue;
     54      if (!strcmp (name, "Alt_R")) continue;
     55      if (!strcmp (name, "Super_L")) continue;
     56      if (!strcmp (name, "Super_R")) continue;
     57      if (!strcmp (name, "Caps_Lock")) continue;
     58      if (!strcmp (name, "Pause")) continue;
     59      if (!strcmp (name, "Continue")) continue;
     60      if (!strcmp (name, "Num_Lock")) continue;
     61      if (!strcmp (name, "Scroll_Lock")) continue;
     62      if (!strcmp (name, "Print")) continue;
     63      if (!strcmp (name, "(null)")) continue;
     64
     65      snprintf (line, 40, "%12s %12.6f %12.6f ", name, x, y);
     66      write (layout[0].Ximage, line, 40);
    5567    }
    5668  }
Note: See TracChangeset for help on using the changeset viewer.