| 44 |
@@ -44,13 +44,8 @@ |
| 44 |
ulong expected = 2, actual;
|
| 45 |
if (AtomUtil::getProperty(win, Atoms::getAtom(NET_WM_ICON), XA_CARDINAL,
|
| 46 |
expected, &udata, &actual)) {
|
| 47 |
if (expected == actual) {
|
| 48 |
// Icon size successfully read, proceed with loading the
|
| 49 |
// actual icon data.
|
| 50 |
uint width = udata[0];
|
| 51 |
uint height = udata[1];
|
| 52 |
expected += width * height;
|
| 53 |
status = loadActualFromWindow(win, expected, width, height);
|
| 54 |
if (actual >= expected) {
|
| 55 |
status = loadActualFromWindow(udata, actual);
|
| 56 |
}
|
| 57 |
|
| 58 |
XFree(udata);
|
| ... |
|
| 58 |
@@ -63,34 +58,26 @@ |
| 58 |
* Do the actual reading and loading of the icon data in ARGB data.
|
| 59 |
*/
|
| 60 |
bool
|
| 66 |
PImageIcon::loadActualFromWindow(Window win, ulong expected,
|
| 67 |
uint width, uint height)
|
| 63 |
PImageIcon::loadActualFromWindow(uchar *udata, ulong actual)
|
| 64 |
{
|
| 70 |
bool status = false;
|
| 71 |
uchar *udata = 0;
|
| 72 |
ulong actual;
|
| 73 |
|
| 74 |
if (AtomUtil::getProperty(win, Atoms::getAtom(NET_WM_ICON), XA_CARDINAL,
|
| 75 |
expected, &udata, &actual)) {
|
| 76 |
if (expected == actual) {
|
| 77 |
long *from_data = reinterpret_cast<long*>(udata);
|
| 78 |
|
| 79 |
_width = width;
|
| 80 |
_height = height;
|
| 81 |
|
| 82 |
_data = new uchar[_width * _height * 4];
|
| 83 |
convertARGBtoRGBA(expected, from_data, _data);
|
| 79 |
// Icon size successfully read, proceed with loading the actual icon data.
|
| 80 |
long *from_data = reinterpret_cast<long*>(udata);
|
| 81 |
uint width = from_data[0];
|
| 82 |
uint height = from_data[1];
|
| 83 |
if (actual < (width * height + 2)) {
|
| 84 |
return false;
|
| 85 |
}
|
| 86 |
|
| 92 |
_pixmap = createPixmap(_data, _width, _height);
|
| 93 |
_mask = createMask(_data, _width, _height);
|
| 89 |
_width = width;
|
| 90 |
_height = height;
|
| 91 |
|
| 97 |
status = true;
|
| 98 |
}
|
| 94 |
_data = new uchar[_width * _height * 4];
|
| 95 |
convertARGBtoRGBA(_width * _height, from_data, _data);
|
| 96 |
|
| 102 |
XFree(udata);
|
| 103 |
}
|
| 99 |
_pixmap = createPixmap(_data, _width, _height);
|
| 100 |
_mask = createMask(_data, _width, _height);
|
| 101 |
|
| 107 |
return status;
|
| 103 |
return true;
|
| 104 |
}
|
| 105 |
|
| 106 |
/**
|
| ... |
|