wmdia 1.04 (GIT-1.04-1-g2937b3a)
Defines | Functions | Variables
wmdia.c File Reference

DIA 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 <sys/wait.h>
#include <xcb/xcb.h>
#include <xcb/xcbext.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 "wmdia.xpm"

Defines

#define xcb_popcount   buggy_xcb_popcount_fixup_1
#define FONT   "-misc-fixed-medium-r-normal--20-*-75-75-c-*-iso8859-*"
 Default font for the tooltip.
#define aFONT   "7x13"
 Default font for the tooltip.
#define bFONT   "-*-bitstream vera sans-*-*-*-*-17-*-*-*-*-*-*-*"
 Default font for the tooltip.

Functions

static void HandleTimeout (void)
 Called from event loop.
static void ButtonPress (void)
 Button press call back.
static void WindowEnter (void)
 Window enter.
static void WindowLeave (void)
 Window leave.
static void PropertyChanged (void)
 Property changed.
static void DelTooltip (void)
 forward define for Exit
static void HideTooltip (void)
 forward define for expose
static 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.
static xcb_pixmap_t CreatePixmap (const char *const *data, xcb_pixmap_t *mask)
 Create pixmap.
static void Loop (void)
 Loop.
static int Init (int argc, char *const argv[])
 Init the application.
static void Exit (void)
 Exit the application.
static int System (char *cmd)
 Execute command without waiting.
static void WindowOrigin (xcb_window_t window, int *x, int *y)
 Get origin of window.
static void NewTooltip (void)
 Create new tooltip.
xcb_void_cookie_t xcb_poly_text_8_simple (xcb_connection_t *c, xcb_drawable_t drawable, xcb_gcontext_t gc, int16_t x, int16_t y, uint32_t len, const char *str)
 Draw poly text.
static void ShowTooltip (int len, const char *str)
 Show tooltip.
static 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

static xcb_connection_t * Connection
 connection to X11 server
static xcb_screen_t * Screen
 our screen
static xcb_window_t Window
 our window
static xcb_gcontext_t NormalGC
 normal graphic context
static xcb_pixmap_t Pixmap
 our background pixmap
static xcb_pixmap_t Image
 drawing data
static xcb_atom_t CommandAtom
 "COMMAND" property
static xcb_atom_t TooltipAtom
 "TOOLTIP" property
static int Timeout = -1
 timeout in ms
static int WindowMode
 start in window mode
static const char * Name
 window/application name
static const char * FontTooltip
 font for tooltip
xcb_window_t Tooltip
 tooltip window
xcb_font_t Font
 tooltip font
xcb_gcontext_t FontGC
 font graphic context
int TooltipShown
 flag tooltip is shown

Detailed Description

DIA Dockapp.

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

Contributor(s):

This file is part of wmdia

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:
4ec6855ef08686cab67fff38b64147f0ad32f407

Define Documentation

#define aFONT   "7x13"

Default font for the tooltip.

#define bFONT   "-*-bitstream vera sans-*-*-*-*-17-*-*-*-*-*-*-*"

Default font for the tooltip.

#define FONT   "-misc-fixed-medium-r-normal--20-*-75-75-c-*-iso8859-*"

Default font for the tooltip.

#define xcb_popcount   buggy_xcb_popcount_fixup_1

Function Documentation

static void ButtonPress ( void  ) [static]

Button press call back.

static xcb_pixmap_t CreatePixmap ( const char *const *  data,
xcb_pixmap_t *  mask 
) [static]

Create pixmap.

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

forward define for Exit

Delete tooltip.

static void Exit ( void  ) [static]

Exit the application.

static void HandleTimeout ( void  ) [static]

Called from event loop.

Timeout call back.

static void HideTooltip ( void  ) [static]

forward define for expose

Show tooltip.

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

Init the application.

Parameters:
argcnumber of arguments
argvarguments vector
static void Loop ( void  ) [static]

Loop.

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

Main entry point.

Parameters:
argcnumber of arguments
argvarguments vector
static void NewTooltip ( void  ) [static]

Create new tooltip.

static void PrepareData ( void  ) [static]

Prepare our graphic data.

static void PrintUsage ( void  ) [static]

Print usage.

static void PrintVersion ( void  ) [static]

Print version.

static void PropertyChanged ( void  ) [static]

Property changed.

static void ShowTooltip ( int  len,
const char *  str 
) [static]

Show tooltip.

Parameters:
lenlength of text to display
strtext to display
static int System ( char *  cmd) [static]

Execute command without waiting.

static void WindowEnter ( void  ) [static]

Window enter.

static void WindowLeave ( void  ) [static]

Window leave.

static void WindowOrigin ( xcb_window_t  window,
int *  x,
int *  y 
) [static]

Get origin of window.

Parameters:
windowget origin of this window
[out]xabsolute X position of the window
[out]yabsolute Y position of the window
xcb_void_cookie_t xcb_poly_text_8_simple ( xcb_connection_t *  c,
xcb_drawable_t  drawable,
xcb_gcontext_t  gc,
int16_t  x,
int16_t  y,
uint32_t  len,
const char *  str 
)

Draw poly text.

This a simple version of xcb_poly_text_8, which works only with one string with lessequal 254 characters.

drawable: DRAWABLE gc: GCONTEXT x, y: INT16 items: LISTofTEXTITEM8)

TEXTELT8: TEXTELT8: [delta: INT8 string: STRING8]

FONT: 5 bytes 255 + FontID

Len8 Delta8 String8

Note:
the xcb_poly_text_8 of libxcb didn't work as expected, atleast in versions <= 1.6
static 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 
) [static]

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_atom_t CommandAtom [static]

"COMMAND" property

xcb_connection_t* Connection [static]

connection to X11 server

xcb_font_t Font

tooltip font

xcb_gcontext_t FontGC

font graphic context

const char* FontTooltip [static]

font for tooltip

xcb_pixmap_t Image [static]

drawing data

const char* Name [static]

window/application name

xcb_gcontext_t NormalGC [static]

normal graphic context

xcb_pixmap_t Pixmap [static]

our background pixmap

xcb_screen_t* Screen [static]

our screen

int Timeout = -1 [static]

timeout in ms

xcb_window_t Tooltip

tooltip window

xcb_atom_t TooltipAtom [static]

"TOOLTIP" property

flag tooltip is shown

xcb_window_t Window [static]

our window

int WindowMode [static]

start in window mode