Back to index

lightning-sunbird  0.9+nobinonly
Static Public Member Functions
nsXUtils Struct Reference

#include <nsXUtils.h>

List of all members.

Static Public Member Functions

static void XFlashWindow (Display *aDisplay, Window aWindow, unsigned int aTimes, unsigned long aInterval, XRectangle *aArea)
 Flash an area within a window (or the whole window)

Detailed Description

Definition at line 43 of file nsXUtils.h.


Member Function Documentation

void nsXUtils::XFlashWindow ( Display aDisplay,
Window  aWindow,
unsigned int  aTimes,
unsigned long  aInterval,
XRectangle *  aArea 
) [static]

Flash an area within a window (or the whole window)

Parameters:
aDisplayThe display.
aWindowThe XID of the window to flash.
aTimesNumber of times to flash the area.
aIntervalInterval between flashes in milliseconds.
aAreaThe area to flash. The whole window if NULL.

Definition at line 52 of file nsXUtils.cpp.

{
  Window       root_window = 0;
  Window       child_window = 0;
  GC           gc;
  int          x;
  int          y;
  unsigned int width;
  unsigned int height;
  unsigned int border_width;
  unsigned int depth;
  int          root_x;
  int          root_y;
  unsigned int i;
  XGCValues    gcv;
  
  XGetGeometry(aDisplay,
               aWindow,
               &root_window,
               &x,
               &y,
               &width,
               &height,
               &border_width,
               &depth);
  
  XTranslateCoordinates(aDisplay, 
                        aWindow,
                        root_window, 
                        0, 
                        0,
                        &root_x,
                        &root_y,
                        &child_window);
  
  memset(&gcv, 0, sizeof(XGCValues));
  
  gcv.function = GXxor;
  gcv.foreground = XWhitePixel(aDisplay, XDefaultScreen(aDisplay));
  gcv.subwindow_mode = IncludeInferiors;
  
  if (gcv.foreground == 0)
    gcv.foreground = 1;
  
  gc = XCreateGC(aDisplay,
                 root_window,
                 GCFunction | GCForeground | GCSubwindowMode, 
                 &gcv);
  
  XGrabServer(aDisplay);

  // If an area is given, use that.  Notice how out of whack coordinates
  // and dimentsions are not checked!!!
  if (aArea)
  {
       root_x += aArea->x;
       root_y += aArea->y;

       width = aArea->width;
       height = aArea->height;
  }

  // Need to do this twice so that the XOR effect can replace 
  // the original window contents.
  for (i = 0; i < aTimes * 2; i++)
  {
       XFillRectangle(aDisplay,
                               root_window,
                               gc,
                               root_x,
                               root_y,
                               width,
                               height);
       
       XSync(aDisplay, False);
       
       usleep(aInterval);
  }
  
  
  XFreeGC(aDisplay, gc);  
  
  XUngrabServer(aDisplay);
}

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this struct was generated from the following files: