25
25
#include "outputdevices.h"
26
26
#include "core_options.h"
28
namespace compiz { namespace core {
31
OutputDevices::computeWorkareaForBox (const CompRect& box, CompWindowList const& windows)
34
OutputDevices::computeWorkareaForBox (const CompRect &box,
35
CompWindowList const &windows)
34
38
int x1, y1, x2, y2;
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)
93
for (unsigned int i = 0; i < outputDevs.size(); i++)
99
for (unsigned int i = 0; i < outputDevs.size(); ++i)
95
CompRect oldWorkArea = outputDevs[i].workArea();
96
workArea = computeWorkareaForBox(outputDevs[i], windows);
101
CompRect oldWorkArea = outputDevs[i].workArea ();
102
workArea = computeWorkareaForBox (outputDevs[i], windows);
97
104
if (workArea != oldWorkArea)
99
106
workAreaChanged = true;
100
outputDevs[i].setWorkArea(workArea);
107
outputDevs[i].setWorkArea (workArea);
102
110
allWorkArea += workArea;
107
OutputDevices::updateOutputDevices(CoreOptions& coreOptions, CompSize* screen)
115
OutputDevices::updateOutputDevices (CoreOptions &coreOptions,
109
CompOption::Value::Vector& list = coreOptions.optionGetOutputs();
110
unsigned int nOutput = 0;
112
unsigned int uWidth, uHeight;
115
foreach(CompOption::Value & value, list)
118
CompOption::Value::Vector &list = coreOptions.optionGetOutputs ();
119
unsigned int nOutput = 0;
121
unsigned int uWidth, uHeight;
125
foreach (CompOption::Value &value, list)
119
uWidth = (unsigned) screen->width();
120
uHeight = (unsigned) screen->height();
129
uWidth = static_cast <unsigned int> (screen->width ());
130
uHeight = static_cast <unsigned int> (screen->height ());
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);
126
136
if (bits & XNegative)
127
x = screen->width() + x - width;
137
x = screen->width () + x - width;
129
139
if (bits & YNegative)
130
y = screen->height() + y - height;
140
y = screen->height () + y - height;
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 ();
146
156
if (x1 < x2 && y1 < y2)
148
setGeometryOnDevice(nOutput, x1, y1, x2 - x1, y2 - y1);
158
setGeometryOnDevice (nOutput, x1, y1, x2 - x1, y2 - y1);
152
adoptDevices(nOutput, screen);
155
}} // namespace compiz::core
163
adoptDevices (nOutput, screen);
167
} // namespace compiz::core