all repos — tint2 @ 5f4154408953a75458e7c5125ef3b9fdfe86ff0a

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

src/util/common.h (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**************************************************************************
* Common declarations
*
**************************************************************************/

#ifndef COMMON_H
#define COMMON_H

#define WM_CLASS_TINT   "panel"

#include <Imlib2.h>
#include <pango/pangocairo.h>
#include "area.h"

#define GREEN  "\033[1;32m"
#define YELLOW "\033[1;33m"
#define RED    "\033[31m"
#define BLUE   "\033[1;34m"
#define RESET  "\033[0m"

/*
void fxfree(void** ptr){
  if (*ptr){
    free(*ptr);
    *ptr=NULL;
    }
  }
FXint fxmalloc(void** ptr,unsigned long size){
  *ptr=NULL;
  if (size!=0){
    if ((*ptr=malloc(size))==NULL) return FALSE;
    }
  return TRUE;
  }
*/

// mouse actions
enum { NONE=0, CLOSE, TOGGLE, ICONIFY, SHADE, TOGGLE_ICONIFY, MAXIMIZE_RESTORE, MAXIMIZE, RESTORE, DESKTOP_LEFT, DESKTOP_RIGHT, NEXT_TASK, PREV_TASK };

#define ALLDESKTOP  0xFFFFFFFF


// copy file source to file dest
void copy_file(const char *pathSrc, const char *pathDest);

// extract key = value
int parse_line (const char *line, char **key, char **value);

// execute a command by calling fork
void tint_exec(const char* command);

// Returns a copy of s in which "~" is expanded to the path to the user's home directory.
// The returned string must be freed by the caller.
char *expand_tilde(char *s);

// The opposite of expand_tilde: replaces the path to the user's home directory with "~".
// The returned string must be freed by the caller.
char *contract_tilde(char *s);

// conversion
int hex_char_to_int (char c);
int hex_to_rgb (char *hex, int *r, int *g, int *b);
void get_color (char *hex, double *rgb);

void extract_values (const char *value, char **value1, char **value2, char **value3);

// adjust Alpha/Saturation/Brightness on an ARGB icon
// alpha from 0 to 100, satur from 0 to 1, bright from 0 to 1.
void adjust_asb(DATA32 *data, int w, int h, int alpha, float satur, float bright);
void createHeuristicMask(DATA32* data, int w, int h);
int imageEmpty(DATA32* data, int w, int h);

void render_image(Drawable d, int x, int y);

void draw_text(PangoLayout *layout, cairo_t *c, int posx, int posy, Color *color, int font_shadow);

Imlib_Image load_image(const char *path, int cached);

Imlib_Image adjust_icon(Imlib_Image original, int alpha, int saturation, int brightness);

#endif