~mc-return/compiz/compiz.merge-src-header-files-cleanup

« back to all changes in this revision

Viewing changes to src/outputdevices_x11.cpp

  • Committer: MC Return
  • Date: 2013-06-20 05:56:13 UTC
  • mfrom: (3724.2.16 0.9.10)
  • Revision ID: mc.return@gmx.net-20130620055613-8dp00nmw2jpm3ptu
Merged latest lp:compiz and fixed conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "outputdevices.h"
26
26
#include "core_options.h"
27
27
 
28
 
namespace compiz { namespace core {
 
28
namespace compiz
 
29
{
 
30
namespace core
 
31
{
29
32
 
30
33
CompRect
31
 
OutputDevices::computeWorkareaForBox (const CompRect& box, CompWindowList const& windows)
 
34
OutputDevices::computeWorkareaForBox (const CompRect       &box,
 
35
                                      CompWindowList const &windows)
32
36
{
33
37
    CompRegion region;
34
38
    int        x1, y1, x2, y2;
87
91
}
88
92
 
89
93
void
90
 
OutputDevices::computeWorkAreas(CompRect& workArea, bool& workAreaChanged,
91
 
        CompRegion& allWorkArea, CompWindowList const& windows)
 
94
OutputDevices::computeWorkAreas (CompRect             &workArea,
 
95
                                 bool                 &workAreaChanged,
 
96
                                 CompRegion           &allWorkArea,
 
97
                                 CompWindowList const &windows)
92
98
{
93
 
    for (unsigned int i = 0; i < outputDevs.size(); i++)
 
99
    for (unsigned int i = 0; i < outputDevs.size(); ++i)
94
100
    {
95
 
        CompRect oldWorkArea = outputDevs[i].workArea();
96
 
        workArea = computeWorkareaForBox(outputDevs[i], windows);
 
101
        CompRect oldWorkArea = outputDevs[i].workArea ();
 
102
        workArea             = computeWorkareaForBox (outputDevs[i], windows);
 
103
 
97
104
        if (workArea != oldWorkArea)
98
105
        {
99
106
            workAreaChanged = true;
100
 
            outputDevs[i].setWorkArea(workArea);
 
107
            outputDevs[i].setWorkArea (workArea);
101
108
        }
 
109
 
102
110
        allWorkArea += workArea;
103
111
    }
104
112
}
105
113
 
106
114
void
107
 
OutputDevices::updateOutputDevices(CoreOptions& coreOptions, CompSize* screen)
 
115
OutputDevices::updateOutputDevices (CoreOptions &coreOptions,
 
116
                                    CompSize    *screen)
108
117
{
109
 
    CompOption::Value::Vector& list = coreOptions.optionGetOutputs();
110
 
    unsigned int nOutput = 0;
111
 
    int x, y, bits;
112
 
    unsigned int uWidth, uHeight;
113
 
    int width, height;
114
 
    int x1, y1, x2, y2;
115
 
    foreach(CompOption::Value & value, list)
 
118
    CompOption::Value::Vector  &list   = coreOptions.optionGetOutputs ();
 
119
    unsigned int               nOutput = 0;
 
120
    int                        x, y, bits;
 
121
    unsigned int               uWidth, uHeight;
 
122
    int                        width, height;
 
123
    int                        x1, y1, x2, y2;
 
124
 
 
125
    foreach (CompOption::Value &value, list)
116
126
    {
117
 
        x = 0;
118
 
        y = 0;
119
 
        uWidth = (unsigned) screen->width();
120
 
        uHeight = (unsigned) screen->height();
 
127
        x       = 0;
 
128
        y       = 0;
 
129
        uWidth  = static_cast <unsigned int> (screen->width ());
 
130
        uHeight = static_cast <unsigned int> (screen->height ());
121
131
 
122
 
        bits = XParseGeometry(value.s().c_str(), &x, &y, &uWidth, &uHeight);
123
 
        width = (int) uWidth;
124
 
        height = (int) uHeight;
 
132
        bits    = XParseGeometry(value.s ().c_str (), &x, &y, &uWidth, &uHeight);
 
133
        width   = static_cast <int> (uWidth);
 
134
        height  = static_cast <int> (uHeight);
125
135
 
126
136
        if (bits & XNegative)
127
 
            x = screen->width() + x - width;
 
137
            x = screen->width ()  + x - width;
128
138
 
129
139
        if (bits & YNegative)
130
 
            y = screen->height() + y - height;
 
140
            y = screen->height () + y - height;
131
141
 
132
142
        x1 = x;
133
143
        y1 = y;
138
148
            x1 = 0;
139
149
        if (y1 < 0)
140
150
            y1 = 0;
141
 
        if (x2 > screen->width())
142
 
            x2 = screen->width();
143
 
        if (y2 > screen->height())
144
 
            y2 = screen->height();
 
151
        if (x2 > screen->width ())
 
152
            x2 = screen->width ();
 
153
        if (y2 > screen->height ())
 
154
            y2 = screen->height ();
145
155
 
146
156
        if (x1 < x2 && y1 < y2)
147
157
        {
148
 
            setGeometryOnDevice(nOutput, x1, y1, x2 - x1, y2 - y1);
149
 
            nOutput++;
 
158
            setGeometryOnDevice (nOutput, x1, y1, x2 - x1, y2 - y1);
 
159
            ++nOutput;
150
160
        }
151
161
    }
152
 
    adoptDevices(nOutput, screen);
153
 
}
154
 
 
155
 
}} // namespace compiz::core
156
 
 
 
162
 
 
163
    adoptDevices (nOutput, screen);
 
164
}
 
165
 
 
166
}
 
167
} // namespace compiz::core