blob: 03635060d935ad83f2261d39bd7dcc2507ceb19b (
plain)
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
|
/* $Id: DockApp.cpp,v 1.5 2007/01/07 05:00:56 whot Exp $ */
#include "DockApp.h"
#include "logger.h"
#include <cairo.h>
#include <cairo-xlib.h>
DockApp::DockApp(XConn* x11, const char* app, char* imgfile)
{
this->x11 = x11;
this->app = app;
this->imgfile = imgfile;
}
void DockApp::setup()
{
cairo_surface_t* png =
cairo_image_surface_create_from_png(imgfile);
cairo_surface_t* button =
cairo_xlib_surface_create(x11->dpy, backbuff, x11->vis, width, height);
cairo_t* cr = cairo_create(button);
cairo_set_source_surface(cr, png, 0, 0);
cairo_paint(cr);
if (cairo_status(cr))
{
ERR("cairo: %s\n", cairo_status_to_string(cairo_status(cr)));
}
cairo_surface_destroy(button);
cairo_surface_destroy(png);
cairo_destroy(cr);
XFlush(x11->dpy);
}
void DockApp::handleButtonEvent(PointerDevice* ptr, XDeviceButtonEvent* ev)
{
system(app);
}
|