summaryrefslogtreecommitdiff
path: root/src/titleinfo.h
blob: 916bfe9defd4c82acf94a30807c2911f38c9d599 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
 *
 * Compiz title bar information extension plugin
 *
 * titleinfo.h
 *
 * Copyright : (C) 2009 by Danny Baumann
 * E-mail    : maniac@compiz.org
 *
 * Ported to Compiz 0.9 by:
 * Copyright : (C) 2009 Sam Spilsbury
 * E-mail    : smspillaz@gmail.com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * 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 General Public License for more details.
 *
 */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include <cmath>
#include <unistd.h>
#include <cstring>
#include <X11/Xatom.h>

#include <sys/types.h>
#include <sys/stat.h>

#include <core/core.h>
#include <core/pluginclasshandler.h>
#include <core/atoms.h>

#include "titleinfo_options.h"

class TitleinfoScreen :
    public PluginClassHandler <TitleinfoScreen, CompScreen>,
    public ScreenInterface,
    public TitleinfoOptions
{
    public:

	TitleinfoScreen (CompScreen *);
	~TitleinfoScreen ();

	Atom visibleNameAtom;
	Atom wmPidAtom;

	void
	handleEvent (XEvent *);


	void
	addSupportedAtoms (std::vector<Atom> &atoms);

	CompString
	getUtf8Property (Window      id,
			 Atom        atom);

	CompString
	getTextProperty (Window      id,
			 Atom        atom);


};

#define TITLEINFO_SCREEN(s)						       \
    TitleinfoScreen *ts = TitleinfoScreen::get (screen)

class TitleinfoWindow :
    public PluginClassHandler <TitleinfoWindow, CompWindow>
{
    public:
	TitleinfoWindow (CompWindow *);

	CompWindow *window;

	CompString title;
	CompString remoteMachine;
	int	   owner;

	void
	updateMachine ();

	void
	updateTitle ();

	void
	updatePid ();

	void
	updateVisibleName ();


};

#define TITLEINFO_WINDOW(w)						       \
     TitleinfoWindow *tw = TitleinfoWindow::get (w);

class TitleinfoPluginVTable :
    public CompPlugin::VTableForScreenAndWindow <TitleinfoScreen, TitleinfoWindow>
{
    public:

	bool init ();
};