~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to kcontrol/randr/module/randrmonitor.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/********************************************************************
 
2
 
 
3
Copyright (C) 2008 Lubos Lunak <l.lunak@suse.cz>
 
4
 
 
5
This program is free software; you can redistribute it and/or modify
 
6
it under the terms of the GNU General Public License as published by
 
7
the Free Software Foundation; either version 2 of the License, or
 
8
(at your option) any later version.
 
9
 
 
10
This program is distributed in the hope that it will be useful,
 
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
GNU General Public License for more details.
 
14
 
 
15
You should have received a copy of the GNU General Public License
 
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
*********************************************************************/
 
18
 
 
19
#ifndef RANDRMONITOR_H
 
20
#define RANDRMONITOR_H
 
21
 
 
22
#include <kdedmodule.h>
 
23
#include <kprocess.h>
 
24
#include <qwidget.h>
 
25
 
 
26
#include <X11/Xlib.h>
 
27
#include <X11/extensions/Xrandr.h>
 
28
#include <fixx11h.h>
 
29
 
 
30
class RandROutput;
 
31
 
 
32
class RandrMonitorHelper;
 
33
 
 
34
class RandrMonitorModule
 
35
    : public KDEDModule
 
36
    {
 
37
    Q_OBJECT
 
38
    public:
 
39
        RandrMonitorModule(QObject* parent, const QList<QVariant>&);
 
40
        virtual ~RandrMonitorModule();
 
41
        void processX11Event( XEvent* e );
 
42
    private slots:
 
43
        void poll();
 
44
        void switchDisplay();
 
45
    private:
 
46
        void initRandr();
 
47
        void getRandrInfo( XRROutputChangeNotifyEvent* e, QString* change, QRect* rect );
 
48
        QStringList connectedMonitors() const;
 
49
        void enableOutput( RandROutput* output, bool enable );
 
50
        bool have_randr;
 
51
        int randr_base;
 
52
        int randr_error;
 
53
        Window window;
 
54
        QStringList currentMonitors;
 
55
        RandrMonitorHelper* helper;
 
56
        QDialog* dialog;
 
57
    };
 
58
 
 
59
class RandrMonitorHelper
 
60
    : public QWidget
 
61
    {
 
62
    Q_OBJECT
 
63
    public:
 
64
        RandrMonitorHelper( RandrMonitorModule* module );
 
65
    protected:
 
66
        virtual bool x11Event( XEvent* e );
 
67
    private:
 
68
        RandrMonitorModule* module;
 
69
    };
 
70
 
 
71
 
 
72
inline
 
73
RandrMonitorHelper::RandrMonitorHelper( RandrMonitorModule* m )
 
74
    : module( m )
 
75
    {
 
76
    }
 
77
 
 
78
#endif