summaryrefslogtreecommitdiff
path: root/src/DockProcess.cpp
blob: f0234f4b8d40d8e3d30e47ae31911ea978f70e48 (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
40
41
42
43
/* $Id: DockProcess.cpp,v 1.3 2007/01/07 05:00:56 whot Exp $ */

#include "DockProcess.h"
#include <cairo.h>
#include <cairo-xlib.h>

DockProcess::DockProcess(XConn* x11, WMWindow* client)
{
    this->x11 = x11;
    this->client = client;
}

void DockProcess::setup()
{
    cairo_surface_t* surface = 
        cairo_xlib_surface_create(x11->dpy, backbuff, x11->vis, width, height);
    cairo_t* cr = cairo_create(surface);

    cairo_set_source_rgb(cr, 0.9, 0.9, 0.9);
    cairo_paint(cr);
    cairo_set_source_rgb(cr, 0, 0, 0);
    cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
    cairo_scale(cr, (double)width/x11->width, (double)height/x11->height);
    cairo_move_to(cr, client->getX(), client->getY());
    cairo_rel_line_to(cr, client->getWidth(), 0);
    cairo_rel_line_to(cr, 0, client->getHeight());
    cairo_rel_line_to(cr, -client->getWidth(), 0);
    cairo_rel_line_to(cr, 0, -client->getHeight());
    cairo_set_line_width(cr, 20);
    cairo_fill(cr);
    cairo_stroke(cr);

    cairo_surface_destroy(surface);
    cairo_destroy(cr);
    XCopyArea(x11->dpy, backbuff, button, button_gc, 0, 0, width, height, 0, 0);
    XFlush(x11->dpy);
}

void DockProcess::handleButtonEvent(XButtonEvent* ev)
{
    client->setMinimize(false);
}