mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Rethumbed init data, so Desktop::instance() call can be
called from DesktopIcon constructor. In previous case, Desktop constructor wasn't finished, but Desktop::instance() was called in the mean time which yields crashing.
This commit is contained in:
@ -86,11 +86,26 @@ DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) :
|
||||
} else
|
||||
EDEBUG(ESTRLOC ": Got empty icon name ?!?\n");
|
||||
}
|
||||
/*
|
||||
EDEBUG(ESTRLOC ": Got label: %s\n", label());
|
||||
EDEBUG(ESTRLOC ": Got image: %s\n", settings->icon.c_str());
|
||||
EDEBUG(ESTRLOC ": Got x/y : %i %i\n", x(), y());
|
||||
*/
|
||||
|
||||
// make sure icons are visible on desktop
|
||||
int dx = Desktop::instance()->x();
|
||||
int dy = Desktop::instance()->y();
|
||||
int dw = Desktop::instance()->w();
|
||||
int dh = Desktop::instance()->h();
|
||||
int ix = x();
|
||||
int iy = y();
|
||||
|
||||
if(x() < dx)
|
||||
ix = dx;
|
||||
if(y() < dy)
|
||||
iy = dy;
|
||||
if(x() + w() > dw)
|
||||
ix = (dx + dw) - w();
|
||||
if(y() + h() > dh)
|
||||
iy = (dy + dh) - h();
|
||||
|
||||
position(ix, iy);
|
||||
|
||||
//Use desktop color as color for icon background
|
||||
color(bg);
|
||||
|
||||
|
@ -219,6 +219,7 @@ Pixmap create_xpixmap(Fl_Image* img, XImage* xim, Pixmap pix) {
|
||||
r = *src++;
|
||||
g = *src++;
|
||||
b = *src++;
|
||||
|
||||
if(msb) {
|
||||
// big endian
|
||||
*destptr++ = b;
|
||||
@ -319,19 +320,6 @@ bool create_tile(Fl_Image* orig, Fl_RGB_Image*& copied, int X, int Y, int W, int
|
||||
// for bounds checks
|
||||
int imax = iw * ih * idepth;
|
||||
|
||||
#if 0
|
||||
// funny effect :)
|
||||
for(int j = 0, cj = 0; j < th; j++, cj++) {
|
||||
for(int i = 0, ci = 0; i < tw * orig->d(); i++, ci++) {
|
||||
if(ci >= iw) ci = 0;
|
||||
if(cj >= ih) cj = 0;
|
||||
|
||||
ppos = pixel_pos(ci, cj, iw, orig->d());
|
||||
*destptr = src[ppos];
|
||||
destptr++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if(idepth == 3 || idepth == 4) {
|
||||
for(int j = 0, cj = 0; j < th; j++, cj++) {
|
||||
if(cj > ih) cj = 0;
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
|
||||
#define SELECTION_SINGLE (Fl::event_button() == 1)
|
||||
#define SELECTION_MULTI (Fl::event_button() == 1 && (Fl::event_key(FL_Shift_L) || Fl::event_key(FL_Shift_R)))
|
||||
#define SELECTION_MULTI (Fl::event_button() == 1 && (Fl::event_key(FL_Shift_L) || Fl::event_key(FL_Shift_R)))
|
||||
|
||||
#define MIN(x,y) ((x) < (y) ? (x) : (y))
|
||||
#define MAX(x,y) ((x) > (y) ? (x) : (y))
|
||||
@ -115,7 +115,17 @@ Desktop::Desktop() : DESKTOP_WINDOW(0, 0, 100, 100, "") {
|
||||
dsett = new DesktopSettings;
|
||||
dsett->color = FL_GRAY;
|
||||
dsett->wp_use = false;
|
||||
}
|
||||
|
||||
Desktop::~Desktop() {
|
||||
EDEBUG("Desktop::~Desktop()\n");
|
||||
|
||||
delete dsett;
|
||||
delete selbox;
|
||||
delete notify;
|
||||
}
|
||||
|
||||
void Desktop::init_internals(void) {
|
||||
init_atoms();
|
||||
update_workarea();
|
||||
|
||||
@ -130,32 +140,25 @@ Desktop::Desktop() : DESKTOP_WINDOW(0, 0, 100, 100, "") {
|
||||
//wallpaper->set_tiled("/home/sanel/wallpapers/katesmall.jpg");
|
||||
//wallpaper->set_tiled("/home/sanelz/walls/katesmall.jpg");
|
||||
//wallpaper->set_tiled("/home/sanelz/walls/kate.jpg");
|
||||
//wallpaper->set("/home/sanelz/walls/katebig.jpg");
|
||||
wallpaper->set("/home/sanelz/walls/katebig.jpg");
|
||||
//wallpaper->hide();
|
||||
wallpaper->set("/home/sanelz/walls/nin/1024x768-04.jpg");
|
||||
//wallpaper->set("/home/sanelz/walls/katesmall.jpg");
|
||||
//wallpaper->set("/home/sanelz/walls/nin/1024x768-04.jpg");
|
||||
//wallpaper->set("/home/sanelz/walls/nin/1024x768-02.jpg");
|
||||
end();
|
||||
|
||||
notify = new NotifyBox(w(), h());
|
||||
set_bg_color(dsett->color, false);
|
||||
|
||||
read_config();
|
||||
|
||||
set_bg_color(dsett->color, false);
|
||||
running = true;
|
||||
}
|
||||
|
||||
Desktop::~Desktop() {
|
||||
EDEBUG("Desktop::~Desktop()\n");
|
||||
|
||||
delete dsett;
|
||||
delete selbox;
|
||||
delete notify;
|
||||
}
|
||||
|
||||
void Desktop::init(void) {
|
||||
if(Desktop::pinstance != NULL)
|
||||
return;
|
||||
Desktop::pinstance = new Desktop();
|
||||
Desktop::pinstance->init_internals();
|
||||
}
|
||||
|
||||
void Desktop::shutdown(void) {
|
||||
@ -181,8 +184,6 @@ void Desktop::show(void) {
|
||||
Fl_X::make_xid(this);
|
||||
net_make_me_desktop(this);
|
||||
}
|
||||
|
||||
//Fl::dnd_text_ops(1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -77,7 +77,7 @@ class NotifyBox;
|
||||
|
||||
typedef edelib::vector<DesktopIcon*> DesktopIconList;
|
||||
|
||||
#define DESKTOP_WINDOW Fl_Window
|
||||
#define DESKTOP_WINDOW Fl_Double_Window
|
||||
|
||||
class Desktop : public DESKTOP_WINDOW {
|
||||
private:
|
||||
@ -97,6 +97,8 @@ class Desktop : public DESKTOP_WINDOW {
|
||||
DesktopIconList icons;
|
||||
DesktopIconList selectionbuff;
|
||||
|
||||
void init_internals(void);
|
||||
|
||||
void load_icons(const char* path, edelib::Config& conf);
|
||||
bool read_desktop_file(const char* path, IconSettings& is);
|
||||
|
||||
|
Reference in New Issue
Block a user