home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gwm18a.zip / screen.c < prev    next >
C/C++ Source or Header  |  1995-07-03  |  18KB  |  642 lines

  1. /* Copyright 1989 GROUPE BULL -- See license conditions in file COPYRIGHT
  2.  * Copyright 1989 Massachusetts Institute of Technology
  3.  */
  4. /************************************************\
  5. *                          *
  6. *     BULL WINDOW MANAGER for X11 .         *
  7. *                          *
  8. *     MODULE defining the Screen Wob Class.     *
  9. *                          *
  10. \************************************************/
  11.  
  12. /*  include  */
  13.  
  14. #include    <stdio.h>
  15. #include     "EXTERN.h"
  16. #include     "wool.h"
  17. #include    "wl_atom.h"    
  18. #include    "wl_list.h"
  19. #include    "wl_number.h"
  20. #include    "wl_string.h"
  21. #include     "gwm.h"
  22. #include    "wl_fsm.h"
  23. #include    "wl_pixmap.h"
  24. #include    "wl_cursor.h"
  25. #include    "wl_client.h"
  26.  
  27. /*  local constants  */
  28.  
  29. /* external */
  30.  
  31. extern Wob      NewWob();
  32. extern ClientWindow LookUpClient(), DecorateWindow();
  33.  
  34.  
  35. extern ScreenOpen(), ScreenClose(), ScreenEventHandler(), ReconfigureScreen();
  36.  
  37. WOB_METHOD    ScreenClass[] = {
  38.                  0,    /* METHODS_ARRAY */
  39.                  WobEval,
  40.                  WobPrint,
  41.                  WobRelease,
  42.                  WobExecute,
  43.                  WobSet,
  44.                  WobGetCValue,
  45.                  ScreenOpen,
  46.                  ScreenClose,
  47.                  ScreenEventHandler,
  48.                                  (WOB_METHOD) wool_undefined_method_1,
  49.                                  WobGetDimensions,
  50.                                  (WOB_METHOD) wool_undefined_method_2,
  51.                                  (WOB_METHOD) wool_undefined_method_2,
  52.                  (WOB_METHOD) ReconfigureScreen,
  53.             (WOB_METHOD) wool_undefined_method_2,
  54.             (WOB_METHOD) wool_undefined_method_1,
  55.             (WOB_METHOD) wool_undefined_method_1,
  56.             (WOB_METHOD) wool_undefined_method_1,
  57.             (WOB_METHOD) wool_undefined_method_1,
  58.             (WOB_METHOD) wool_undefined_method_1
  59. };
  60.  
  61. /*
  62.  * Set up Screen Wob. Usually called from SetUpWob.
  63.  */
  64.  
  65. ScreenOpen(screen)
  66. ClientWindow       screen;
  67. {
  68.     screen -> curstate = (int)
  69.     WOOL_send(WOOL_open, screen -> fsm, (screen -> fsm));
  70.     if (screen -> cursor != NIL)
  71.     XDefineCursor(dpy, screen -> hook,
  72.               ((WOOL_Cursor) screen -> cursor) -> cursor);
  73.     if (screen -> tile != NIL)
  74.     wool_set_screen_background(screen -> tile);
  75.     screen -> input_mask = RootMask | ((WOOL_Fsm) screen -> fsm) -> mask;
  76.     XSelectInput(dpy, screen -> hook, screen -> input_mask);
  77.     SetTarget(screen);
  78. }
  79.  
  80. /* Initialize screen data in the list of managed screens
  81.  * This function is called BEFORE user profile
  82.  */
  83.  
  84. GWMScreenContext
  85. RegisterScreen(screen_number)
  86. int     screen_number;
  87. {
  88.     XSetWindowAttributes wa;
  89.  
  90.     Context = (GWMScreenContext) Malloc(sizeof(struct _GWMScreenContext));
  91.     bzero(Context, sizeof(struct _GWMScreenContext));
  92.  
  93.     Context -> screen = screen_number;
  94.     Context -> x_screen = ScreenOfDisplay(dpy, screen_number);
  95.     Context -> width = DisplayWidth(dpy, screen_number);
  96.     Context -> height = DisplayHeight(dpy, screen_number);
  97.     Context -> depth = DisplayPlanes(dpy, screen_number);
  98.     Context -> widthMM = DisplayWidthMM(dpy, screen_number);
  99.     Context -> heightMM = DisplayHeightMM(dpy, screen_number);
  100.  
  101.     Context -> root = RootWindow(dpy, screen_number);
  102.     Context -> rootWob = (ClientWindow) NewWob(sizeof(struct _ClientWindow));
  103.     Context -> rootWob -> parent = (Wob) NULL;    /* to stop recursion */
  104.     Context -> rootWob -> type = ScreenClass;
  105.     Context -> rootWob -> hook = Context -> root;
  106.     Context -> rootWob -> client = Context -> root;
  107.     Context -> rootWob -> status = RootStatus;
  108.     Context -> rootWob -> window = Context -> rootWob;
  109.     Context -> rootWob -> icon = Context -> rootWob;
  110.     Context -> rootWob -> box.width = Context -> width;
  111.     Context -> rootWob -> box.height = Context -> height;
  112.     Context -> rootWob -> screen = Context;
  113.  
  114.     /* init root window colormap */
  115.     wa.colormap = Context -> rootWob -> colormap =
  116.     DefaultColormap(dpy, Context -> screen);
  117.     XChangeWindowAttributes(dpy, Context -> root, CWColormap, &wa);
  118.     XInstallColormap(dpy, wa.colormap);
  119.     Context -> InstalledColormapCW = Context -> rootWob;
  120.  
  121.     WobRecordHook(Context -> rootWob);
  122.  
  123.     return    Context;
  124. }
  125.  
  126. /* initialize screen AFTER user profile & root window
  127.  */
  128.  
  129. SetUpScreen(screen, wl_client)
  130. ClientWindow    screen;
  131. WOOL_Client    wl_client;
  132. {
  133.     if (wl_client -> type != WLClient) {
  134.     wool_puts("\007GWM: screen not described! -- check your .gwmrc!\n");
  135.     exit(1);
  136.     }
  137.     screen -> box.x = 0;
  138.     screen -> box.y = 0;
  139.     screen -> box.borderwidth = 0;
  140.     screen -> box.width = Context -> width;
  141.     screen -> box.height = Context -> height;
  142.     screen -> box.background = wl_client -> background;
  143.     increase_reference(screen -> cursor = wl_client -> cursor);
  144.     increase_reference(screen -> fsm = wl_client -> fsm);
  145.     increase_reference(screen -> menu = wl_client -> menu);
  146.     increase_reference(screen -> property =
  147.                (WOOL_OBJECT) wl_client -> property);
  148.     /* bordertile is used to store the background */
  149.     increase_reference(screen -> tile = wl_client -> tile);
  150.     increase_reference(screen -> opening = wl_client -> opening);
  151.     increase_reference(screen -> closing = wl_client -> closing);
  152.     increase_reference(screen -> grabs = (WOOL_OBJECT) wl_client -> grabs);
  153.     increase_reference(screen -> icon_plug =
  154.                (WOOL_OBJECT) wl_client -> icon_plug);
  155.     fix_fsm(&(screen -> fsm));
  156.     screen -> cached_props = (CWCachedProperties)
  157.     Malloc(sizeof(struct _CWCachedProperties));
  158.     bzero(screen -> cached_props, sizeof(struct _CWCachedProperties));
  159. #define update_cached_field(name, val) \
  160.     increase_reference(screen -> cached_props -> name = (WOOL_OBJECT) val)
  161.     update_cached_field(clientclass, NIL_STRING);
  162.     update_cached_field(clientname, NIL_STRING);
  163.     update_cached_field(machinename, NIL_STRING);
  164.     update_cached_field(windowname, NIL_STRING);
  165.     update_cached_field(iconname, NIL_STRING);
  166.  
  167.     CreateGwmLabelWindow();
  168. }
  169.  
  170. /* Called when an event is reported to rootWindow.
  171.  * There we detect and decorate newly created windows on first map
  172.  */
  173.  
  174. ScreenEventHandler(screen, evt)
  175.     ClientWindow screen;
  176.     Event evt;
  177. {
  178.     ClientWindow wob;
  179.  
  180.     switch (evt->type) {
  181.  
  182.     case MapRequest:            /* look if this window is not yet
  183.                      * managed to decorate it */
  184.     SetTarget(screen);
  185.     if (evt->xmaprequest.parent == Context->root)
  186.         if (wob = (ClientWindow) LookUpWob(evt->xmaprequest.window)) {
  187.         if (!(wob->opening))    /* has already been mapped */
  188.             XMapWindow(dpy, evt->xmaprequest.window);
  189.         } else {
  190.         if (wob = LookUpClient(evt->xmaprequest.window)) {
  191.             if (wob->opening) {
  192.             ClientWindowExecuteOpening(wob);
  193.             }
  194.             ClientWindowInitialMap(wob);
  195.         } else {
  196.             wob = DecorateWindow(evt->xmaprequest.window,
  197.             screen, 1, 1);
  198.             ClientWindowInitialMap(wob);
  199.         }
  200.         }
  201.     break;
  202.  
  203.     case ColormapNotify:        /* the screen colormap has changed:
  204.                      * reflect it if the current wob has
  205.                      * no defined colormap */
  206.     if (evt->xcolormap.new) {    /* colormap has changed */
  207.         SetTarget(screen);
  208.         screen->colormap = (evt->xcolormap.colormap == None ?
  209.         DefaultColormap(dpy, Context->screen) :
  210.         evt->xcolormap.colormap);
  211.         if (Context->InstalledColormapCW == screen ||
  212.         Context->InstalledColormapCW->colormap == None)
  213.         XInstallColormap(dpy, screen->colormap);
  214.     }
  215.     break;
  216.  
  217.     case UnmapNotify:{            /* iccc: to withdraw a window */
  218.         ClientWindow cw;
  219.  
  220.         if (evt->xunmap.send_event
  221.         && evt->xunmap.from_configure == False
  222.         && (cw = LookUpClient(evt->xunmap.window))) {
  223.         if (cw->icon)
  224.             ClientWindowUnmap(cw->icon);
  225.         ClientWindowUnmap(cw);
  226.         cw->cached_props->user_icon = 0;
  227.         UnDecorateWindow(cw, 1, 0);
  228.         }
  229.     }
  230.     break;
  231.  
  232.     case ConfigureRequest:{        /* unmapped window */
  233.         ClientWindow cw;
  234.  
  235.         /* warning: window may have been redecorated meanwhile */
  236.         if (cw = (ClientWindow)
  237.         LookUpClient(evt->xconfigurerequest.window)) {
  238.         ConfigureRequestEventHandler(cw, evt);    /* was remapped */
  239.         } else if (evt->xconfigurerequest.window != Context->root) {
  240.         ConfigureUnmappedWindow(evt);    /* not yet known, obey */
  241.         }
  242.     }
  243.     break;
  244.  
  245.     case PropertyNotify:        /* GWM_EXECUTE */
  246.     SetTarget(screen);
  247.     if (evt->xproperty.atom == XA_GWM_EXECUTE) {
  248.         WlExecGWM_EXECUTE();
  249.     } else {
  250.         WLFsm_action(screen->fsm, screen, evt);
  251.     }
  252.     break;
  253.  
  254.     default:
  255.     WLFsm_action(screen->fsm, screen, evt);
  256.     }
  257. }
  258.  
  259. /* Here we clean up everything for the next WM
  260.  */
  261.  
  262. int
  263. ScreenClose(screen)
  264. ClientWindow       screen;
  265. {
  266.     ClientWindow    cw;
  267.  
  268.     if (screen -> closing)
  269.     WOOL_send(WOOL_eval, screen -> closing, (screen -> closing));
  270.     if (Context -> WindowCount) {
  271.     cw = Context -> rootWob -> next;
  272.     while (cw) {
  273.         if (cw -> status & ClientWindowStatus) {
  274.         SetTarget(cw);
  275.         UnDecorateWindow(cw, 1, 1);
  276.         }
  277.         cw = cw -> next;
  278.     }
  279.     }
  280.     decrease_reference(screen -> opening);
  281.     decrease_reference(screen -> closing);
  282.     decrease_reference(screen -> grabs);
  283.     decrease_reference(screen -> icon_plug);
  284.     WobRelease(screen);
  285.     return OK;
  286. }
  287.  
  288. /* the "current screen" functions 
  289.  */
  290.  
  291. WOOL_OBJECT
  292. wool_current_screen_get()
  293. {
  294.     return (WOOL_OBJECT) WLNumber_make(Context -> screen);
  295. }
  296.  
  297. WOOL_OBJECT
  298. wool_current_screen_set(number)
  299. WOOL_Number    number;
  300. {
  301.     must_be_number(number, 0);
  302.     if(GWMManagedScreens[number -> number]) {
  303.     SetTarget(GWMManagedScreens[number -> number] -> rootWob);
  304.     return (WOOL_OBJECT) number;
  305.     }else{
  306.     return NIL;
  307.     }
  308. }
  309.  
  310. /* same with "current root-window" */
  311.  
  312. WOOL_OBJECT
  313. wool_get_root_window()
  314. {
  315.     return (WOOL_OBJECT) WLNumber_make(Context -> rootWob);
  316. }
  317.  
  318. WOOL_OBJECT
  319. wool_set_root_window(number)
  320. WOOL_Number     number;
  321. {
  322.     must_be_number(number, 0);
  323.     SetTarget(number -> number);
  324.     return (WOOL_OBJECT) WLNumber_make(Context -> rootWob);
  325. }
  326.  
  327. /* sets Context to DefaultScreen, or first one... */
  328.  
  329. SetDefaultScreen()
  330. {
  331.     if (GWMManagedScreens[DefaultScreen(dpy)]) {
  332.     SetTarget(GWMManagedScreens[DefaultScreen(dpy)] -> rootWob);
  333.     GWM_DefaultScreen = DefaultScreen(dpy);
  334.     } else {
  335.     for (ContextPtr = GWMManagedScreens;; ContextPtr++)
  336.         if (*ContextPtr) {
  337.         SetTarget((*ContextPtr) -> rootWob);
  338.         GWM_DefaultScreen = (*ContextPtr) -> screen;
  339.         return;
  340.         }
  341.     }
  342. }
  343.  
  344. int
  345. ScreenOfRoot(window)
  346. Window    window;
  347. {
  348.     int             screen;
  349.  
  350.     for (screen = 0; screen < ScreenCount(dpy); screen++)
  351.     if (RootWindow(dpy, screen) == window)
  352.         return screen;
  353.     return -1;
  354. }
  355.  
  356. /* does nothing
  357.  */
  358.  
  359. ReconfigureScreen(screen, culprit)
  360. Wob screen, culprit;
  361. {}
  362.  
  363. /********************************************\
  364. *                          *
  365. * "Meter" gestion (window to display infos)  *
  366. *                          *
  367. \********************************************/
  368.  
  369. /* create the X window for the meter. called at screen initialization
  370.  */
  371.  
  372. MeterCreate()
  373. {
  374.     XGCValues       gcv;
  375.     XSetWindowAttributes wa;
  376.  
  377.     Context -> meter.x = 0;
  378.     Context -> meter.y = 0;
  379.     Context -> meter.width = 1;
  380.     Context -> meter.height = 1;
  381.     Context -> meter.anchor_x = Context -> meter.anchor_y = 0;
  382.     Context -> meter.gravity = 1;
  383.     Context -> meter.borderwidth = 0;
  384.     Context -> meter.font = DefaultFont;
  385.     Context -> meter.foreground = Context -> pixel.Back;
  386.     Context -> meter.background = Context -> pixel.Fore;
  387.     Context -> meter.borderpixel = Context -> pixel.Back;
  388.     Context -> meter.horizontal_margin = 2;
  389.     Context -> meter.vertical_margin = 2;
  390.     Context -> meter.string_length = 60;
  391.     Context -> meter.string = (char *) Malloc(60);
  392.     Context -> meter.window = XCreateSimpleWindow(dpy, Context -> root,
  393.                      Context -> meter.x, Context -> meter.y,
  394.                 Context -> meter.width, Context -> meter.height,
  395.                      0, 0, Context -> meter.background);
  396.  
  397.     gcv.foreground = Context -> meter.foreground;
  398.     gcv.background = Context -> meter.background;
  399.     gcv.function = GXcopy;
  400.     gcv.graphics_exposures = False;
  401.     Context -> meter.gc = XCreateGC(dpy, Context -> root,
  402.       GCForeground | GCBackground | GCFunction | GCGraphicsExposures, &gcv);
  403.     XSelectInput(dpy, Context -> meter.window, MeterMask);
  404.     wa.override_redirect = 1;
  405.     XChangeWindowAttributes(dpy, Context -> meter.window,
  406.                 CWOverrideRedirect, &wa);
  407.     XSetFont(dpy, Context -> meter.gc, Context -> meter.font);
  408.     XSetForeground(dpy, Context -> meter.gc, Context -> meter.foreground);
  409.     XSetBackground(dpy, Context -> meter.gc, Context -> meter.background);
  410. }
  411.  
  412. /* pop up the meter with room for string
  413.  */
  414.  
  415. MeterOpen(string)
  416. char *string;
  417. {
  418.     MeterUpdate(string);
  419.     XMapRaised(dpy, Context -> meter.window);
  420. }
  421.  
  422. /* unmaps the meter
  423.  */
  424.  
  425. WOOL_OBJECT
  426. MeterClose()
  427. {
  428.     XClearWindow(dpy, Context -> meter.window);
  429.     XUnmapWindow(dpy, Context -> meter.window);
  430.     return NIL;
  431. }
  432.  
  433. /* displays another string in the meter, updates size.
  434.  */
  435.  
  436. MeterUpdate(string)
  437. char    *string;
  438. {
  439.     int             up, down, dir, width, height, l;
  440.     XCharStruct     extent;
  441.  
  442.     XQueryTextExtents(dpy, Context -> meter.font,
  443.               string, strlen(string),
  444.               &dir, &up, &down, &extent);
  445.     Context->meter.string_x = Context -> meter.horizontal_margin 
  446.     - extent.lbearing;
  447.     Context->meter.string_y = Context -> meter.vertical_margin + up;
  448.     width = extent.width + 2 * Context -> meter.horizontal_margin;
  449.     height = up + down + 2 * Context -> meter.vertical_margin;
  450.     if (width != Context -> meter.width || height != Context -> meter.height)
  451.     XResizeWindow(dpy, Context -> meter.window,
  452.               Context -> meter.width = width,
  453.               Context -> meter.height = height);
  454.     if ((l = strlen(string)) >= Context -> meter.string_length) {
  455.     Context -> meter.string_length = Max(
  456.                   2 * Context -> meter.string_length + 4, l + 1);
  457.     Context -> meter.string = (char *) Realloc(Context -> meter.string,
  458.                            Context -> meter.string_length);
  459.     }
  460.     strcpy(Context -> meter.string, string);
  461.     PlaceWinWithGravity(Context -> meter.window,
  462.             Context -> meter.gravity,
  463.             Context -> meter.anchor_x,
  464.             Context -> meter.anchor_y,
  465.             &(Context -> meter.x),
  466.             &(Context -> meter.y),
  467.             Context -> meter.width,
  468.             Context -> meter.height,
  469.             Context -> meter.borderwidth);
  470.     MeterRefresh();
  471. }
  472.  
  473. MeterRefresh()
  474. {
  475.     XClearWindow(dpy, Context -> meter.window);
  476.     XDrawString(dpy, Context -> meter.window, Context -> meter.gc,
  477.         Context->meter.string_x, Context->meter.string_y, 
  478.         Context->meter.string, strlen(Context->meter.string));
  479. }   
  480.  
  481. /* pops menu from wool
  482.  */
  483.  
  484. WOOL_OBJECT
  485. wool_meter_open(argc, argv)
  486. int argc;
  487. WOOL_Number argv[];
  488. {
  489.     switch(argc){
  490.     case 3:
  491.     Context -> meter.anchor_x = argv[0] -> number;
  492.     Context -> meter.anchor_y = argv[1] -> number;
  493.     MeterOpen(((WOOL_String) argv[2]) -> string);
  494.     break;
  495.     case 1:
  496.     MeterOpen(((WOOL_String) argv[0]) -> string);
  497.     break;
  498.     default:
  499.     return wool_error(BAD_NUMBER_OF_ARGS, argc);
  500.     }
  501.     return NIL;
  502. }
  503.  
  504. /* displays a string in the meter
  505.  */
  506.  
  507. WOOL_OBJECT
  508. wool_meter_update(string)
  509. WOOL_String    string;
  510. {
  511.     MeterUpdate(string -> string);
  512.     return (WOOL_OBJECT) string;
  513. }
  514.  
  515. /* change graphics of meter
  516.  * usage: (meter <key value>...)
  517.  * where key can be:
  518.  *     font
  519.  *     background
  520.  *     foreground
  521.  *     horizontal-margin
  522.  *     vertical-margin
  523.  *     x
  524.  *     y
  525.  *     gravity
  526.  *     borderpixel
  527.  *     borderwidth
  528.  */
  529.  
  530. WOOL_OBJECT
  531. wool_meter_modify(argc, argv)
  532. int        argc;
  533. WOOL_Atom    argv[];
  534. {
  535.     WOOL_Atom      *key = argv, *last_key = argv + argc;
  536.     WOOL_List      result;
  537.     WOOL_OBJECT   *result_index;
  538.  
  539.     if (argc % 2)
  540.     if (argc == 1) {
  541.         must_be_or_nil(WLList, argv[0], 0);
  542.         if (argv[0] == (WOOL_Atom) NIL) {
  543.         return NIL;
  544.         } else {
  545.         key = (WOOL_Atom *) ((WOOL_List) argv[0]) -> list;
  546.         last_key = (WOOL_Atom *) key +
  547.             ((WOOL_List) argv[0]) -> size;
  548.         }
  549.     } else
  550.         wool_error(BAD_NUMBER_OF_ARGS, argc);
  551.  
  552.     result = wool_list_make(last_key - key);
  553.     result_index = &(result -> list[0]);
  554.     for (; key < last_key; key += 2) {
  555.     WOOL_Atom old_key = *key;
  556.     int old_value;
  557.  
  558.     if (*key == WA_font) {
  559.         old_value = Context -> meter.font;
  560.         Context -> meter.font = get_C_from_object(key[1]);
  561.         XSetFont(dpy, Context -> meter.gc, Context -> meter.font);
  562.     } else if (*key == WA_background) {
  563.         old_value = Context -> meter.background;
  564.         Context -> meter.background = get_C_from_object(key[1]);
  565.         XSetBackground(dpy, Context -> meter.gc,
  566.                Context -> meter.background);
  567.         XSetWindowBackground(dpy, Context -> meter.window,
  568.                  Context -> meter.background);
  569.     } else if (*key == WA_foreground) {
  570.         old_value = Context -> meter.foreground;
  571.         Context -> meter.foreground = get_C_from_object(key[1]);
  572.         XSetForeground(dpy, Context -> meter.gc,
  573.                Context -> meter.foreground);
  574.     } else if (*key == WA_horizontal_margin) {
  575.         old_value = Context -> meter.horizontal_margin;
  576.         Context -> meter.horizontal_margin = get_C_from_object(key[1]);
  577.     } else if (*key == WA_vertical_margin) {
  578.         old_value = Context -> meter.vertical_margin;
  579.         Context -> meter.vertical_margin = get_C_from_object(key[1]);
  580.     } else if (*key == WA_x) {
  581.         old_value = Context -> meter.anchor_x;
  582.         Context -> meter.anchor_x = get_C_from_object(key[1]);
  583.     } else if (*key == WA_y) {
  584.         old_value = Context -> meter.anchor_y;
  585.         Context -> meter.anchor_y = get_C_from_object(key[1]);
  586.     } else if (*key == WA_gravity) {
  587.         old_value = Context -> meter.gravity;
  588.         Context -> meter.gravity = get_C_from_object(key[1]);
  589.     } else if (*key == WA_borderwidth) {
  590.         old_value = Context -> meter.borderwidth;
  591.         XSetWindowBorderWidth(dpy, Context -> meter.window,
  592.                   Context -> meter.borderwidth
  593.                   = get_C_from_object(key[1]));
  594.     } else if (*key == WA_borderpixel) {
  595.         old_value = Context -> meter.borderpixel;
  596.         XSetWindowBorder(dpy, Context -> meter.window,
  597.                   Context -> meter.borderpixel
  598.                   = get_C_from_object(key[1]));
  599.     } else {
  600.         if (wool_warning("GWM WARNING: ")) {
  601.         wool_print(*key);
  602.         wool_puts(" is not a key\n");
  603.         }
  604.         old_key = NULL;
  605.     }
  606.     if (old_key) {
  607.         increase_reference(*result_index++ = (WOOL_OBJECT) old_key);
  608.         increase_reference(*result_index++ =
  609.                    (WOOL_OBJECT) WLNumber_make(old_value));
  610.     }
  611.     }
  612.     if (result -> size = result_index - &(result -> list[0]))
  613.     return (WOOL_OBJECT) result;
  614.     else
  615.     return NIL;
  616. }
  617.  
  618. /* handles event.
  619.  * returns 1 if was for a meter, 0 otherwise
  620.  */
  621.  
  622. int
  623. MeterEventHandler(evt)
  624. Event           evt;
  625. {
  626.     ClientWindow    wob;
  627.  
  628.     if(GWM_is_ending)
  629.     return 1;
  630.     FOR_ALL_SCREENS {
  631.     if (evt -> xany.window == Context -> meter.window) {
  632.         switch (evt -> type) {
  633.         case Expose:
  634.         MeterRefresh();
  635.         break;
  636.         }
  637.         return 1;
  638.     }
  639.     }END_OF_ALL_SCREENS;
  640.     return 0;
  641. }
  642.