Back to index

kdeartwork  4.3.2
Functions | Variables
xlock.cpp File Reference
#include <time.h>
#include <qapplication.h>
#include <QX11Info>
#include <QColor>
#include <QColormap>
#include "xlock.h"

Go to the source code of this file.

Functions

void SetRNG (long s)
long LongRNG ()
unsigned long allocpixel (Colormap cmap, const char *name, const char *def)
void initXLock (GC gc)

Variables

int screen
Display * dsp
perscreen Scr [MAXSCREENS]
int batchcount = 100
int cycles = 100
Bool mono = 0
char * ProgramName
static int Seed = 1

Function Documentation

unsigned long allocpixel ( Colormap  cmap,
const char *  name,
const char *  def 
)

Definition at line 50 of file xlock.cpp.

{
       XColor      col;
       XColor      tmp;
       XParseColor(dsp, cmap, name, &col);
       if (!XAllocColor(dsp, cmap, &col))
       {
              fprintf(stderr, "could not allocate: %s, using %s instead\n", name, def);
              XAllocNamedColor(dsp, cmap, def, &col, &tmp);
       }

       return col.pixel;
}

Here is the caller graph for this function:

void initXLock ( GC  gc)

Definition at line 64 of file xlock.cpp.

{
       SetRNG( time(NULL) );

       dsp = QX11Info::display();
       screen = QX11Info::appScreen();

       Screen *scr = ScreenOfDisplay(dsp, screen);

       Scr[0].gc = gc;
       Scr[0].npixels = NUMCOLORS;
       Scr[0].cmap = None;

       Colormap    cmap = DefaultColormapOfScreen(scr);
       Scr[0].bgcol = allocpixel(cmap, "background", "White");
       Scr[0].bgcol = allocpixel(cmap, "foreground", "Black");

       QColor color;
       QColormap colormap(QColormap::instance());

       for ( int i = 0; i < NUMCOLORS; i++ )
       {
              color.setHsv( i * 360 / NUMCOLORS, 255, 255 );
              Scr[0].pixels[i] = colormap.pixel(color);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

long LongRNG ( )

Definition at line 42 of file xlock.cpp.

{
       if ((Seed = Seed % 44488 * 48271 - Seed / 44488 * 3399) < 0)
              Seed += 2147483647;
       return (long) (Seed - 1);
}
void SetRNG ( long  s)

Definition at line 34 of file xlock.cpp.

{
       Seed = (int) s;
}

Here is the caller graph for this function:


Variable Documentation

int batchcount = 100

Definition at line 17 of file xlock.cpp.

int cycles = 100

Definition at line 18 of file xlock.cpp.

Display* dsp

Definition at line 15 of file xlock.cpp.

Bool mono = 0

Definition at line 19 of file xlock.cpp.

char* ProgramName

Definition at line 21 of file xlock.cpp.

Definition at line 16 of file xlock.cpp.

int screen

Definition at line 14 of file xlock.cpp.

int Seed = 1 [static]

Definition at line 29 of file xlock.cpp.