|
|
@ -44,6 +44,7 @@
|
|
|
|
#include "ntqpaintdevicemetrics.h"
|
|
|
|
#include "ntqpaintdevicemetrics.h"
|
|
|
|
#include "ntqpainter.h"
|
|
|
|
#include "ntqpainter.h"
|
|
|
|
#include "ntqbitmap.h"
|
|
|
|
#include "ntqbitmap.h"
|
|
|
|
|
|
|
|
#include "ntqimage.h"
|
|
|
|
#include "ntqobjectlist.h"
|
|
|
|
#include "ntqobjectlist.h"
|
|
|
|
#include "ntqlayout.h"
|
|
|
|
#include "ntqlayout.h"
|
|
|
|
#include "ntqtextcodec.h"
|
|
|
|
#include "ntqtextcodec.h"
|
|
|
@ -1310,14 +1311,47 @@ void TQWidget::setIcon( const TQPixmap &pixmap )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Pixmap icon_pixmap = 0;
|
|
|
|
Pixmap icon_pixmap = 0;
|
|
|
|
Pixmap mask_pixmap = 0;
|
|
|
|
Pixmap mask_pixmap = 0;
|
|
|
|
|
|
|
|
TQPixmap* pm = NULL;
|
|
|
|
if ( !pixmap.isNull() ) {
|
|
|
|
if ( !pixmap.isNull() ) {
|
|
|
|
TQPixmap* pm = new TQPixmap( pixmap );
|
|
|
|
if (pixmap.depth() == 24) {
|
|
|
|
|
|
|
|
pm = new TQPixmap( pixmap );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
// With most window managers, only 24-bit icon pixmaps are allowed in the WM hints, otherwise corrupt icons will be displayed
|
|
|
|
|
|
|
|
// Convert provided pixmaps to 24-bit here
|
|
|
|
|
|
|
|
int w = pixmap.width();
|
|
|
|
|
|
|
|
int h = pixmap.height();
|
|
|
|
|
|
|
|
pm = new TQPixmap( pixmap.width(), pixmap.height(), 24 );
|
|
|
|
|
|
|
|
TQImage iconImage = pixmap.convertToImage();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Load the new 24-bit RGB pixmap with data
|
|
|
|
|
|
|
|
GC gc;
|
|
|
|
|
|
|
|
pm->detach();
|
|
|
|
|
|
|
|
TQt::HANDLE pmHandle = pm->handle();
|
|
|
|
|
|
|
|
gc = XCreateGC(x11Display(), pmHandle, 0, 0);
|
|
|
|
|
|
|
|
for (int y = 0; y < h; ++y) {
|
|
|
|
|
|
|
|
TQRgb *ls = (TQRgb *)iconImage.scanLine( y );
|
|
|
|
|
|
|
|
for (int x = 0; x < w; ++x) {
|
|
|
|
|
|
|
|
TQRgb l = ls[x];
|
|
|
|
|
|
|
|
int r = int( tqRed( l ) );
|
|
|
|
|
|
|
|
int g = int( tqGreen( l ) );
|
|
|
|
|
|
|
|
int b = int( tqBlue( l ) );
|
|
|
|
|
|
|
|
ls[x] = tqRgb( r, g, b );
|
|
|
|
|
|
|
|
XSetForeground(x11Display(), gc, (r << 16) | (g << 8) | b );
|
|
|
|
|
|
|
|
XDrawPoint(x11Display(), pmHandle, gc, x, y);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
XFreeGC(x11Display(), gc);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extra->topextra->icon = pm;
|
|
|
|
extra->topextra->icon = pm;
|
|
|
|
if ( !pm->mask() )
|
|
|
|
if ( !pm->mask() ) {
|
|
|
|
pm->setMask( pm->createHeuristicMask() ); // may do detach()
|
|
|
|
pm->setMask( pm->createHeuristicMask() ); // may do detach()
|
|
|
|
|
|
|
|
}
|
|
|
|
icon_pixmap = pm->handle();
|
|
|
|
icon_pixmap = pm->handle();
|
|
|
|
if ( pm->mask() )
|
|
|
|
if ( pm->mask() ) {
|
|
|
|
mask_pixmap = pm->mask()->handle();
|
|
|
|
mask_pixmap = pm->mask()->handle();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
XWMHints *h = XGetWMHints( x11Display(), winId() );
|
|
|
|
XWMHints *h = XGetWMHints( x11Display(), winId() );
|
|
|
|
XWMHints wm_hints;
|
|
|
|
XWMHints wm_hints;
|
|
|
|