wmc2d 2.05 (GIT-2.05-1-gde0239c)
Defines | Functions | Variables
wmc2d.c File Reference

coretemp/corefreq monitor dockapp More...

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <poll.h>
#include <ctype.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/shm.h>
#include <xcb/xcb.h>
#include <xcb/shm.h>
#include <xcb/shape.h>
#include <xcb/xcb_event.h>
#include <xcb/xcb_image.h>
#include <xcb/xcb_atom.h>
#include <xcb/xcb_icccm.h>
#include <xcb/xcb_pixel.h>
#include <xcb/screensaver.h>
#include "wmc2d.xpm"

Defines

#define SCREENSAVER
 config support screensaver
#define _R(i, xx, yy, w, h)
 shape rectangle shortcut macro

Functions

void Timeout (void)
 called from event loop
xcb_image_t * XcbXpm2Image (xcb_connection_t *connection, xcb_colormap_t colormap, uint8_t depth, uint32_t transparent, const char *const *data, uint8_t **mask)
 Convert XPM graphic to xcb_image.
xcb_pixmap_t CreatePixmap (const char *const *data, xcb_pixmap_t *mask)
 Create pixmap.
void Loop (void)
 Loop.
int Init (int argc, char *const argv[])
 Init.
void Exit (void)
 Exit.
void DrawString (const char *s, int x, int y)
 Draw a string at given cordinates.
void DrawNumber (unsigned num, int x, int y)
 Draw a number at given cordinates.
void DrawRedSmallNumber (unsigned num, int x, int y)
 Draw a number at given cordinates with small font.
void DrawSmallNumber (unsigned num, int x, int y)
 Draw a number at given cordinates with small font.
void DrawLcdNumber (unsigned num, int x, int y)
 Draw a number at given cordinates with LCD font.
static int ReadNumber (const char *file)
 Read number.
static void DrawTemperaturs (void)
 Draw temperatures.
static void DrawFrequency (void)
 Draw frequency.
void PrepareData (void)
 Prepare our graphic data.
static void PrintVersion (void)
 Print version.
static void PrintUsage (void)
 Print usage.
int main (int argc, char *const argv[])
 Main entry point.

Variables

xcb_connection_t * Connection
 connection to X11 server
xcb_screen_t * Screen
 our screen
xcb_window_t Window
 our window
xcb_gcontext_t NormalGC
 normal graphic context
xcb_pixmap_t Pixmap
 our background pixmap
xcb_pixmap_t Image
 drawing data
int ScreenSaverEventId
 screen saver event ids
static int Rate
 update rate in ms
static char WindowMode
 start in window mode
static char UseSleep
 use sleep while screensaver runs
static char StartCpu
 first cpu nr. to use
static char Cpus
 number of cpus
static char JoinCpusTemp
 aggregate numbers of two cpus
static char JoinCpusFreq
 aggregate numbers of two cpus
static char ThermalZones
 number of thermal zones
static int TurboBoostFreq
 turbo boost frequency
static const char * ThermlZoneNames []
 thermal zone names

Detailed Description

coretemp/corefreq monitor dockapp

Copyright (c) 2004, 2009 - 2011 by Lutz Sammer. All Rights Reserved.

Contributor(s): Bitmap and design based on wmbp6.

This file is part of wmc2d

License: AGPLv3

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

Id:
77c1bb3cbf4039ebec51be8644c87a616a93f32d

Define Documentation

#define _R (   i,
  xx,
  yy,
  w,
 
)
Value:
rectangles[i].x = xx; \
    rectangles[i].y = yy; \
    rectangles[i].width = w; \
    rectangles[i].height = h;

shape rectangle shortcut macro

#define SCREENSAVER

config support screensaver


Function Documentation

xcb_pixmap_t CreatePixmap ( const char *const *  data,
xcb_pixmap_t *  mask 
)

Create pixmap.

Parameters:
dataXPM data
[out]maskPixmap for data
Returns:
pixmap created from data.
static void DrawFrequency ( void  ) [static]

Draw frequency.

void DrawLcdNumber ( unsigned  num,
int  x,
int  y 
)

Draw a number at given cordinates with LCD font.

Parameters:
numunsigned number
xx pixel position
yy pixel position
void DrawNumber ( unsigned  num,
int  x,
int  y 
)

Draw a number at given cordinates.

Parameters:
numunsigned number
xx pixel position
yy pixel position

With leading 0, if 0-9.

void DrawRedSmallNumber ( unsigned  num,
int  x,
int  y 
)

Draw a number at given cordinates with small font.

Parameters:
numunsigned number
xx pixel position
yy pixel position
void DrawSmallNumber ( unsigned  num,
int  x,
int  y 
)

Draw a number at given cordinates with small font.

Parameters:
numunsigned number
xx pixel position
yy pixel position
void DrawString ( const char *  s,
int  x,
int  y 
)

Draw a string at given cordinates.

Parameters:
sString
xx pixel position
yy pixel position

Text is written in upper case.

static void DrawTemperaturs ( void  ) [static]

Draw temperatures.

cpu0, cpu1, chipset

void Exit ( void  )

Exit.

int Init ( int  argc,
char *const  argv[] 
)

Init.

Parameters:
argcnumber of arguments
argvarguments vector
void Loop ( void  )

Loop.

int main ( int  argc,
char *const  argv[] 
)

Main entry point.

Parameters:
argcnumber of arguments
argvarguments vector
void PrepareData ( void  )

Prepare our graphic data.

static void PrintUsage ( void  ) [static]

Print usage.

static void PrintVersion ( void  ) [static]

Print version.

static int ReadNumber ( const char *  file) [static]

Read number.

Parameters:
fileName of file containing only the number.
void Timeout ( void  )

called from event loop

Timeout call back.

xcb_image_t* XcbXpm2Image ( xcb_connection_t *  connection,
xcb_colormap_t  colormap,
uint8_t  depth,
uint32_t  transparent,
const char *const *  data,
uint8_t **  mask 
)

Convert XPM graphic to xcb_image.

Parameters:
connectionXCB connection to X11 server
colormapwindow colormap
depthimage depth
transparentpixel for transparent color
dataXPM graphic data
[out]maskbitmap mask for transparent
Returns:
image create from the XPM data.
Warning:
supports only a subset of XPM formats.

Variable Documentation

xcb_connection_t* Connection

connection to X11 server

char Cpus [static]

number of cpus

xcb_pixmap_t Image

drawing data

char JoinCpusFreq [static]

aggregate numbers of two cpus

char JoinCpusTemp [static]

aggregate numbers of two cpus

xcb_gcontext_t NormalGC

normal graphic context

xcb_pixmap_t Pixmap

our background pixmap

int Rate [static]

update rate in ms

xcb_screen_t* Screen

our screen

screen saver event ids

char StartCpu [static]

first cpu nr. to use

char ThermalZones [static]

number of thermal zones

const char* ThermlZoneNames[] [static]
Initial value:
 {
    "/sys/class/thermal/thermal_zone0/temp",
    "/sys/class/thermal/thermal_zone1/temp",
}

thermal zone names

int TurboBoostFreq [static]

turbo boost frequency

char UseSleep [static]

use sleep while screensaver runs

xcb_window_t Window

our window

char WindowMode [static]

start in window mode