aboutsummaryrefslogtreecommitdiff
path: root/src/outline.c
blob: 03b7ad961cd3469fd7af77494fe5fa41fee44269 (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
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
83
84
85
/****************************************************************************
 * Outlines for moving and resizing.
 * Copyright (C) 2004 Joe Wingbermuehle
 ****************************************************************************/

#include "jwm.h"
#include "outline.h"
#include "main.h"

static GC outlineGC;

static int lastX, lastY;
static int lastWidth, lastHeight;
static int outlineDrawn;

/****************************************************************************
 ****************************************************************************/
void
InitializeOutline()
{
}

/****************************************************************************
 ****************************************************************************/
void
StartupOutline()
{

	XGCValues gcValues;

	gcValues.function = GXinvert;
	gcValues.subwindow_mode = IncludeInferiors;
	gcValues.line_width = 2;
	outlineGC = JXCreateGC(display, rootWindow,
		GCFunction | GCSubwindowMode | GCLineWidth, &gcValues);
	outlineDrawn = 0;

}

/****************************************************************************
 ****************************************************************************/
void
ShutdownOutline()
{
	JXFreeGC(display, outlineGC);
}

/****************************************************************************
 ****************************************************************************/
void
DestroyOutline()
{
}

/****************************************************************************
 ****************************************************************************/
void
DrawOutline(int x, int y, int width, int height)
{
	if(!outlineDrawn) {
		JXSync(display, False);
		JXGrabServer(display);
		JXDrawRectangle(display, rootWindow, outlineGC, x, y, width, height);
		lastX = x;
		lastY = y;
		lastWidth = width;
		lastHeight = height;
		outlineDrawn = 1;
	}
}

/****************************************************************************
 ****************************************************************************/
void
ClearOutline()
{
	if(outlineDrawn) {
		JXDrawRectangle(display, rootWindow, outlineGC,
			lastX, lastY, lastWidth, lastHeight);
		outlineDrawn = 0;
		JXUngrabServer(display);
		JXSync(display, False);
	}
}