IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3465


Ignore:
Timestamp:
Mar 18, 2005, 4:42:27 PM (21 years ago)
Author:
eugene
Message:

loneos.h to dvo.h, fixed event handling (like kii)

Location:
trunk/Ohana/src/kapa
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/kapa/Makefile

    r2510 r3465  
    44
    55default: $(PROGRAM)
    6 CC      =       gcc -g
     6CC      =       gcc -g -Wall
    77
    88INC     =       $(HOME)/include
  • trunk/Ohana/src/kapa/event/CheckPipe.c

    r2473 r3465  
    7373 
    7474  if (!strcmp (buffer, "LIMS")) {
    75     sprintf (buffer, "LIMS: %8.1f %8.1f \0",
     75    sprintf (buffer, "LIMS: %8.1f %8.1f ",
    7676             section[TheSection].axis[0].dfx, section[TheSection].axis[1].dfy);
    7777    write (sock, buffer, 30);
  • trunk/Ohana/src/kapa/event/EventLoop.c

    r2473 r3465  
    11# include "Ximage.h"
    2 # define EventMask (long) (KeyPressMask | ExposureMask | StructureNotifyMask)
    3 # define EMask (long) (KeyPressMask | ExposureMask | StructureNotifyMask | PointerMotionMask)
     2
     3int LastEvent (Display *display, int type, XEvent *event) {
     4
     5  int found;
     6
     7  found = FALSE;
     8  while (XCheckTypedEvent (display, type, event)) {
     9    found = TRUE;
     10  }
     11  return (found);
     12}
    413
    514int EventLoop () {
    615 
    7   XEvent          event, reconfig_event;
    8   int             status, Ne;
    9   int  NeedRefresh, NeedReconfig;
     16  XEvent          event;
     17  int             status;
     18  Display        *display;
    1019 
    1120  Refresh (1);
    1221
    13   NeedReconfig = FALSE;
    14   NeedRefresh = FALSE;
    1522  status = TRUE;
    1623  while (status) {
    17 
     24   
    1825    if (!CheckPipe ()) return (FALSE);
    19 
     26   
    2027    if (XEventsQueued (graphic.display, QueuedAfterFlush) < 1) {
    21       if (NeedReconfig) status = Reconfig (&reconfig_event);
    22       if (NeedRefresh && !NeedReconfig) Refresh (1);
    23       NeedRefresh = FALSE;
    24       NeedReconfig = FALSE;
    2528      usleep (10000);
    2629      continue;
    2730    }
    2831
    29     if (XCheckMaskEvent (graphic.display, EVENT_MASK, &event)) {
     32    display = graphic.display;
    3033
    31       switch (event.type)  {
    32 
    33       case MotionNotify:
    34         break;
    35 
    36       case Expose:
    37         if (HAVE_BACKING) continue;
    38         NeedRefresh = TRUE;
    39         break;
    40        
    41       case ConfigureNotify:
    42         /* Ne = XEventsQueued (graphic.display, QueuedAlready); */
    43         reconfig_event = event;
    44         NeedReconfig = TRUE;
    45         break;
    46        
    47       case KeyPress:
    48         status = InterpretKeys (&event);
    49         break;
    50 
    51       case MappingNotify:
    52         if (XEventsQueued (graphic.display, QueuedAlready) < 2) {
    53           XRefreshKeyboardMapping ((XMappingEvent *) &event);
    54         }
    55         break;
    56        
    57       }
    58     }
     34    /* only do the last entry for these events */
     35    /* this ignores the return status from these functions */
     36    if (LastEvent (display, ConfigureNotify, &event)) Reconfig (&event);
     37    if (LastEvent (display, Expose,          &event)) Refresh (1);
     38    if (LastEvent (display, MappingNotify,   &event)) XRefreshKeyboardMapping ((XMappingEvent *) &event);
    5939  }
    6040  return (status);
    6141}
    62 
  • trunk/Ohana/src/kapa/include/structures.h

    r2473 r3465  
    22# define NGRAPHCOLORS 23
    33static char GRAPHCOLORS[NGRAPHCOLORS][2][15] = {
    4 "black",    "0.00 0.00 0.00",
    5 "white",    "1.00 1.00 1.00",
    6 "red",      "1.00 0.00 0.00",
    7 "pink",     "1.00 0.75 0.80",
    8 "orange",   "1.00 0.65 0.00",
    9 "yellow",   "1.00 1.00 0.00",
    10 "wheat",    "0.96 0.87 0.70",
    11 "gold",     "1.00 0.84 0.00",
    12 "green",    "0.00 1.00 0.00",
    13 "darkgreen","0.00 0.40 0.00",
    14 "blue",     "0.00 0.00 1.00",
    15 "skyblue",  "0.53 0.81 0.92",
    16 "indigo",   "0.56 0.16 0.87",
    17 "violet",   "1.00 0.00 0.00",
    18 "grey10",   "0.10 0.10 0.10",
    19 "grey20",   "0.20 0.20 0.20",
    20 "grey30",   "0.30 0.30 0.30",
    21 "grey40",   "0.40 0.40 0.40",
    22 "grey50",   "0.50 0.50 0.50",
    23 "grey60",   "0.60 0.60 0.60",
    24 "grey70",   "0.70 0.70 0.70",
    25 "grey80",   "0.80 0.80 0.80",
    26 "grey90",   "0.90 0.90 0.90"};
     4{"black",    "0.00 0.00 0.00"},
     5{"white",    "1.00 1.00 1.00"},
     6{"red",      "1.00 0.00 0.00"},
     7{"pink",     "1.00 0.75 0.80"},
     8{"orange",   "1.00 0.65 0.00"},
     9{"yellow",   "1.00 1.00 0.00"},
     10{"wheat",    "0.96 0.87 0.70"},
     11{"gold",     "1.00 0.84 0.00"},
     12{"green",    "0.00 1.00 0.00"},
     13{"darkgreen","0.00 0.40 0.00"},
     14{"blue",     "0.00 0.00 1.00"},
     15{"skyblue",  "0.53 0.81 0.92"},
     16{"indigo",   "0.56 0.16 0.87"},
     17{"violet",   "1.00 0.00 0.00"},
     18{"grey10",   "0.10 0.10 0.10"},
     19{"grey20",   "0.20 0.20 0.20"},
     20{"grey30",   "0.30 0.30 0.30"},
     21{"grey40",   "0.40 0.40 0.40"},
     22{"grey50",   "0.50 0.50 0.50"},
     23{"grey60",   "0.60 0.60 0.60"},
     24{"grey70",   "0.70 0.70 0.70"},
     25{"grey80",   "0.80 0.80 0.80"},
     26{"grey90",   "0.90 0.90 0.90"}};
    2727
    2828/**************** Graphic carries X info around ****************/
Note: See TracChangeset for help on using the changeset viewer.