mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Finishing wallpaper options (centering, stretching, tiling).
Some refactoring.
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* ede-desktop, desktop and icon manager
|
* ede-desktop, desktop and icon manager
|
||||||
* Part of Equinox Desktop Environment (EDE).
|
* Part of Equinox Desktop Environment (EDE).
|
||||||
* Copyright (c) 2006-2008 EDE Authors.
|
* Copyright (c) 2006-2009 EDE Authors.
|
||||||
*
|
*
|
||||||
* This program is licensed under terms of the
|
* This program is licensed under terms of the
|
||||||
* GNU General Public License version 2 or newer.
|
* GNU General Public License version 2 or newer.
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
tmp |= (((int)b >> (-bshift)) & bmask);
|
tmp |= (((int)b >> (-bshift)) & bmask);
|
||||||
|
|
||||||
|
|
||||||
static Pixmap create_xpixmap(Fl_Image* img, XImage*& xim, Pixmap pix, int wp_w, int wp_h) {
|
static Pixmap create_xpixmap(Fl_Image* img, XImage** xim, Pixmap pix, int wp_w, int wp_h) {
|
||||||
if(!img)
|
if(!img)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ static Pixmap create_xpixmap(Fl_Image* img, XImage*& xim, Pixmap pix, int wp_w,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
xim = XCreateImage(fl_display, fl_visual->visual, fl_visual->depth, ZPixmap, 0, 0, img->w(), img->h(), bitmap_pad, 0);
|
*xim = XCreateImage(fl_display, fl_visual->visual, fl_visual->depth, ZPixmap, 0, 0, img->w(), img->h(), bitmap_pad, 0);
|
||||||
|
|
||||||
int iw = img->w();
|
int iw = img->w();
|
||||||
int ih = img->h();
|
int ih = img->h();
|
||||||
@@ -120,7 +120,7 @@ static Pixmap create_xpixmap(Fl_Image* img, XImage*& xim, Pixmap pix, int wp_w,
|
|||||||
unsigned char* destptr = dest;
|
unsigned char* destptr = dest;
|
||||||
unsigned char* src = (unsigned char*)img->data()[0];
|
unsigned char* src = (unsigned char*)img->data()[0];
|
||||||
|
|
||||||
if(xim->bits_per_pixel == 32) {
|
if((*xim)->bits_per_pixel == 32) {
|
||||||
if(id == 3 || id == 4) {
|
if(id == 3 || id == 4) {
|
||||||
for(int j = 0; j < ih; j++) {
|
for(int j = 0; j < ih; j++) {
|
||||||
for(int i = 0; i < iw; i++) {
|
for(int i = 0; i < iw; i++) {
|
||||||
@@ -173,7 +173,7 @@ static Pixmap create_xpixmap(Fl_Image* img, XImage*& xim, Pixmap pix, int wp_w,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(xim->bits_per_pixel == 24) {
|
} else if((*xim)->bits_per_pixel == 24) {
|
||||||
if(id == 3 || id == 4) {
|
if(id == 3 || id == 4) {
|
||||||
for(int j = 0; j < ih; j++) {
|
for(int j = 0; j < ih; j++) {
|
||||||
for(int i = 0; i < iw; i++) {
|
for(int i = 0; i < iw; i++) {
|
||||||
@@ -221,7 +221,7 @@ static Pixmap create_xpixmap(Fl_Image* img, XImage*& xim, Pixmap pix, int wp_w,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(xim->bits_per_pixel == 16) {
|
} else if((*xim)->bits_per_pixel == 16) {
|
||||||
if(id == 3 || id == 4) {
|
if(id == 3 || id == 4) {
|
||||||
for(int j = 0; j < ih; j++) {
|
for(int j = 0; j < ih; j++) {
|
||||||
for(int i = 0; i < iw; i++) {
|
for(int i = 0; i < iw; i++) {
|
||||||
@@ -259,7 +259,7 @@ static Pixmap create_xpixmap(Fl_Image* img, XImage*& xim, Pixmap pix, int wp_w,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xim->data = (char*)dest;
|
(*xim)->data = (char*)dest;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Creating another window as drawable is needed since fl_window (as drawable) can't be
|
* Creating another window as drawable is needed since fl_window (as drawable) can't be
|
||||||
@@ -274,15 +274,12 @@ static Pixmap create_xpixmap(Fl_Image* img, XImage*& xim, Pixmap pix, int wp_w,
|
|||||||
|
|
||||||
pix = XCreatePixmap(fl_display, drawable, wp_w, wp_h, fl_visual->depth);
|
pix = XCreatePixmap(fl_display, drawable, wp_w, wp_h, fl_visual->depth);
|
||||||
|
|
||||||
/*
|
/* The same applies as above; fl_gc can't be used here */
|
||||||
* The same applies as above;
|
|
||||||
* fl_gc can't be used here.
|
|
||||||
*/
|
|
||||||
XGCValues gcv;
|
XGCValues gcv;
|
||||||
gcv.graphics_exposures = False;
|
gcv.graphics_exposures = False;
|
||||||
GC dgc = XCreateGC(fl_display, pix, GCGraphicsExposures, &gcv);
|
GC dgc = XCreateGC(fl_display, pix, GCGraphicsExposures, &gcv);
|
||||||
|
|
||||||
XPutImage(fl_display, pix, dgc, xim, 0, 0, 0, 0, iw, ih);
|
XPutImage(fl_display, pix, dgc, *xim, 0, 0, 0, 0, iw, ih);
|
||||||
|
|
||||||
XDestroyWindow(fl_display, drawable);
|
XDestroyWindow(fl_display, drawable);
|
||||||
XFreeGC(fl_display, dgc);
|
XFreeGC(fl_display, dgc);
|
||||||
@@ -292,9 +289,12 @@ static Pixmap create_xpixmap(Fl_Image* img, XImage*& xim, Pixmap pix, int wp_w,
|
|||||||
|
|
||||||
#define PIXEL_POS(x, y, w, d) ((((y) * (w)) + (x)) * (d))
|
#define PIXEL_POS(x, y, w, d) ((((y) * (w)) + (x)) * (d))
|
||||||
|
|
||||||
static bool create_tile(Fl_Image* orig, Fl_RGB_Image** copied, int X, int Y, int W, int H) {
|
static void create_tile(Fl_Image* orig, Fl_RGB_Image** copied, int X, int Y, int W, int H) {
|
||||||
if(orig->w() >= W && orig->h() >= H)
|
/* don't tile large image */
|
||||||
return false;
|
if(orig->w() >= W && orig->h() >= H) {
|
||||||
|
*copied = (Fl_RGB_Image*) orig;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int iw = orig->w();
|
int iw = orig->w();
|
||||||
int ih = orig->h();
|
int ih = orig->h();
|
||||||
@@ -308,7 +308,7 @@ static bool create_tile(Fl_Image* orig, Fl_RGB_Image** copied, int X, int Y, int
|
|||||||
unsigned char* destptr = dest;
|
unsigned char* destptr = dest;
|
||||||
unsigned char* src = (unsigned char*)orig->data()[0];
|
unsigned char* src = (unsigned char*)orig->data()[0];
|
||||||
int ppos = 0;
|
int ppos = 0;
|
||||||
// for bounds checks
|
/* for bounds checks */
|
||||||
int imax = iw * ih * idepth;
|
int imax = iw * ih * idepth;
|
||||||
|
|
||||||
if(idepth == 3 || idepth == 4) {
|
if(idepth == 3 || idepth == 4) {
|
||||||
@@ -358,12 +358,6 @@ static bool create_tile(Fl_Image* orig, Fl_RGB_Image** copied, int X, int Y, int
|
|||||||
Fl_RGB_Image* c = new Fl_RGB_Image(dest, tw, th, idepth, orig->ld());
|
Fl_RGB_Image* c = new Fl_RGB_Image(dest, tw, th, idepth, orig->ld());
|
||||||
c->alloc_array = 1;
|
c->alloc_array = 1;
|
||||||
*copied = c;
|
*copied = c;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Wallpaper::Wallpaper(int X, int Y, int W, int H) :
|
|
||||||
Fl_Box(X, Y, W, H, 0), rootpmap_pixmap(0), tiled(false) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Wallpaper::~Wallpaper() {
|
Wallpaper::~Wallpaper() {
|
||||||
@@ -371,50 +365,12 @@ Wallpaper::~Wallpaper() {
|
|||||||
XFreePixmap(fl_display, rootpmap_pixmap);
|
XFreePixmap(fl_display, rootpmap_pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Wallpaper::set(const char* path) {
|
|
||||||
E_ASSERT(path != NULL);
|
|
||||||
|
|
||||||
tiled = false;
|
|
||||||
|
|
||||||
Fl_Image* i = Fl_Shared_Image::get(path);
|
|
||||||
if(!i)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
image(i);
|
|
||||||
set_rootpmap();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Wallpaper::set_tiled(const char* path) {
|
|
||||||
E_ASSERT(path != NULL);
|
|
||||||
|
|
||||||
Fl_Image* i = Fl_Shared_Image::get(path);
|
|
||||||
if(!i)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
Fl_RGB_Image* res = 0;
|
|
||||||
if(create_tile(i, &res, x(), y(), w(), h())) {
|
|
||||||
image(res);
|
|
||||||
tiled = true;
|
|
||||||
|
|
||||||
set_rootpmap();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
E_WARNING(E_STRLOC ": Unable to create tiles for %s\n", path);
|
|
||||||
tiled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Wallpaper::set_rootpmap(void) {
|
void Wallpaper::set_rootpmap(void) {
|
||||||
if(!image())
|
if(!image())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
XImage* rootpmap_image = 0;
|
XImage* rootpmap_image = 0;
|
||||||
rootpmap_pixmap = create_xpixmap(image(), rootpmap_image, rootpmap_pixmap, w(), h());
|
rootpmap_pixmap = create_xpixmap(image(), &rootpmap_image, rootpmap_pixmap, w(), h());
|
||||||
|
|
||||||
if(!rootpmap_pixmap)
|
if(!rootpmap_pixmap)
|
||||||
return;
|
return;
|
||||||
@@ -425,33 +381,40 @@ void Wallpaper::set_rootpmap(void) {
|
|||||||
|
|
||||||
XChangeProperty(fl_display, RootWindow(fl_display, fl_screen),
|
XChangeProperty(fl_display, RootWindow(fl_display, fl_screen),
|
||||||
_XA_XROOTPMAP_ID, XA_PIXMAP, 32, PropModeReplace, (unsigned char *)&rootpmap_pixmap, 1);
|
_XA_XROOTPMAP_ID, XA_PIXMAP, 32, PropModeReplace, (unsigned char *)&rootpmap_pixmap, 1);
|
||||||
|
|
||||||
#if 0
|
|
||||||
XGCValues gcv;
|
|
||||||
gcv.graphics_exposures = False;
|
|
||||||
GC dgc = XCreateGC(fl_display, pix, GCGraphicsExposures, &gcv);
|
|
||||||
|
|
||||||
XImage img;
|
|
||||||
img.byte_order = LSBFirst; // TODO: check
|
|
||||||
img.format = ZPixmap;
|
|
||||||
img.depth = fl_visual->depth; // depth of screen or depth of image() ?
|
|
||||||
|
|
||||||
// find out bits_per_pixel field
|
|
||||||
int num_pfv;
|
|
||||||
XPixmapFormatValues* pfv = 0;
|
|
||||||
XPixmapFormatValues* pfvlst = 0;
|
|
||||||
pfvlst = XListPixmapFormats(fl_display, &num_pfv);
|
|
||||||
for(pfv = pfvlst; pfv < pfvlst + num_pfv; pfv++) {
|
|
||||||
if(pfv->depth == fl_visual->depth)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
img.bits_per_pixel = pfv->bits_per_pixel;
|
bool Wallpaper::load(const char* path, WallpaperState s) {
|
||||||
if(img.bits_per_pixel & 7) {
|
E_ASSERT(path != NULL);
|
||||||
EWARNING("Can't work with %i bpp !!!\n", img.bits_per_pixel);
|
|
||||||
return;
|
Fl_Shared_Image* i = Fl_Shared_Image::get(path);
|
||||||
|
if(!i)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(s == WALLPAPER_TILE) {
|
||||||
|
Fl_RGB_Image* tiled;
|
||||||
|
|
||||||
|
create_tile((Fl_Image*)i, &tiled, x(), y(), w(), h());
|
||||||
|
image(tiled);
|
||||||
|
} else if(s == WALLPAPER_STRETCH) {
|
||||||
|
Fl_Image* stretched;
|
||||||
|
|
||||||
|
if(i->w() == w() && i->h() == h())
|
||||||
|
stretched = i;
|
||||||
|
else {
|
||||||
|
stretched = i->copy(w(), h());
|
||||||
|
i->release();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
image(stretched);
|
||||||
|
} else {
|
||||||
|
image(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
state = s;
|
||||||
|
|
||||||
|
/* set root pixmap for pseudo transparency */
|
||||||
|
set_rootpmap();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wallpaper::draw(void) {
|
void Wallpaper::draw(void) {
|
||||||
@@ -467,8 +430,7 @@ void Wallpaper::draw(void) {
|
|||||||
if(iw == 0 || ih == 0)
|
if(iw == 0 || ih == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!tiled) {
|
if(state == WALLPAPER_CENTER) {
|
||||||
// center image in the box
|
|
||||||
ix = (w()/2) - (iw/2);
|
ix = (w()/2) - (iw/2);
|
||||||
iy = (h()/2) - (ih/2);
|
iy = (h()/2) - (ih/2);
|
||||||
ix += x();
|
ix += x();
|
||||||
@@ -478,18 +440,14 @@ void Wallpaper::draw(void) {
|
|||||||
iy = y();
|
iy = y();
|
||||||
}
|
}
|
||||||
|
|
||||||
ix = x();
|
|
||||||
iy = y();
|
|
||||||
|
|
||||||
im->draw(ix, iy);
|
im->draw(ix, iy);
|
||||||
|
|
||||||
|
#if 0
|
||||||
/*
|
/*
|
||||||
* For debugging purposes :)
|
* For debugging purposes :)
|
||||||
* Uncommenting this (and removing GC/Window creation in create_xpixmap
|
* Uncommenting this (and removing GC/Window creation in create_xpixmap will draw _XA_XROOTPMAP_ID
|
||||||
* will draw _XA_XROOTPMAP_ID Pixmap directly in Wallpaper widget.
|
* Pixmap directly in Wallpaper widget. Used to check Fl_Image->Image conversion.
|
||||||
* It is used to check Fl_Image->Image conversion.
|
|
||||||
*/
|
*/
|
||||||
#if 0
|
|
||||||
if(global_xim) {
|
if(global_xim) {
|
||||||
Pixmap pix = fl_create_offscreen(image()->w(), image()->h());
|
Pixmap pix = fl_create_offscreen(image()->w(), image()->h());
|
||||||
fl_begin_offscreen(pix);
|
fl_begin_offscreen(pix);
|
||||||
@@ -507,10 +465,7 @@ void Wallpaper::draw(void) {
|
|||||||
|
|
||||||
int Wallpaper::handle(int event) {
|
int Wallpaper::handle(int event) {
|
||||||
switch(event) {
|
switch(event) {
|
||||||
/*
|
/* Route all DND events to parent (desktop), otherwise desktop will not get them if Wallpaper is visible */
|
||||||
* Route all DND events to parent (desktop), otherwise
|
|
||||||
* desktop will not get them if Wallpaper is visible
|
|
||||||
*/
|
|
||||||
case FL_DND_ENTER:
|
case FL_DND_ENTER:
|
||||||
case FL_DND_DRAG:
|
case FL_DND_DRAG:
|
||||||
case FL_DND_LEAVE:
|
case FL_DND_LEAVE:
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
*
|
*
|
||||||
* ede-desktop, desktop and icon manager
|
* ede-desktop, desktop and icon manager
|
||||||
* Part of Equinox Desktop Environment (EDE).
|
* Part of Equinox Desktop Environment (EDE).
|
||||||
* Copyright (c) 2006-2008 EDE Authors.
|
* Copyright (c) 2006-2009 EDE Authors.
|
||||||
*
|
*
|
||||||
* This program is licensed under terms of the
|
* This program is licensed under terms of the
|
||||||
* GNU General Public License version 2 or newer.
|
* GNU General Public License version 2 or newer.
|
||||||
@@ -16,22 +16,24 @@
|
|||||||
#include <X11/Xlib.h> // XImage, Pixmap
|
#include <X11/Xlib.h> // XImage, Pixmap
|
||||||
#include <FL/Fl_Box.H>
|
#include <FL/Fl_Box.H>
|
||||||
|
|
||||||
/*
|
enum WallpaperState {
|
||||||
* Class responsible for displaying images at background
|
WALLPAPER_CENTER,
|
||||||
* their scaling (TODO), caching(TODO) and making coffee at the spare time.
|
WALLPAPER_STRETCH,
|
||||||
*/
|
WALLPAPER_TILE
|
||||||
|
};
|
||||||
|
|
||||||
class Wallpaper : public Fl_Box {
|
class Wallpaper : public Fl_Box {
|
||||||
private:
|
private:
|
||||||
Pixmap rootpmap_pixmap;
|
Pixmap rootpmap_pixmap;
|
||||||
bool tiled;
|
WallpaperState state;
|
||||||
void set_rootpmap(void);
|
|
||||||
|
|
||||||
|
void set_rootpmap(void);
|
||||||
public:
|
public:
|
||||||
Wallpaper(int X, int Y, int W, int H);
|
Wallpaper(int X, int Y, int W, int H) : Fl_Box(X, Y, W, H), rootpmap_pixmap(0), state(WALLPAPER_CENTER) { }
|
||||||
~Wallpaper();
|
~Wallpaper();
|
||||||
|
|
||||||
bool set(const char* path);
|
bool load(const char* path, WallpaperState s);
|
||||||
bool set_tiled(const char* path);
|
|
||||||
virtual void draw(void);
|
virtual void draw(void);
|
||||||
virtual int handle(int event);
|
virtual int handle(int event);
|
||||||
};
|
};
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
#include <FL/Fl_Box.H>
|
#include <FL/Fl_Box.H>
|
||||||
#include <FL/Fl_Shared_Image.H>
|
#include <FL/Fl_Shared_Image.H>
|
||||||
#include <FL/Fl_Menu_Button.H>
|
#include <FL/Fl_Menu_Button.H>
|
||||||
#include <FL/fl_ask.H>
|
|
||||||
|
|
||||||
#include <edelib/Debug.h>
|
#include <edelib/Debug.h>
|
||||||
#include <edelib/File.h>
|
#include <edelib/File.h>
|
||||||
@@ -38,6 +37,7 @@
|
|||||||
#include <edelib/Run.h>
|
#include <edelib/Run.h>
|
||||||
#include <edelib/Util.h>
|
#include <edelib/Util.h>
|
||||||
#include <edelib/Nls.h>
|
#include <edelib/Nls.h>
|
||||||
|
#include <edelib/MessageBox.h>
|
||||||
|
|
||||||
#include "ede-desktop.h"
|
#include "ede-desktop.h"
|
||||||
#include "DesktopIcon.h"
|
#include "DesktopIcon.h"
|
||||||
@@ -65,8 +65,8 @@
|
|||||||
*/
|
*/
|
||||||
#define NOT_SELECTABLE(widget) ((widget == this) || (widget == wallpaper) || (widget == dmenu))
|
#define NOT_SELECTABLE(widget) ((widget == this) || (widget == wallpaper) || (widget == dmenu))
|
||||||
|
|
||||||
void background_conf_cb(Fl_Widget*, void*);
|
static void background_conf_cb(Fl_Widget*, void*);
|
||||||
void icons_conf_cb(Fl_Widget*, void*);
|
static void icons_conf_cb(Fl_Widget*, void*);
|
||||||
|
|
||||||
Fl_Menu_Item desktop_menu[] = {
|
Fl_Menu_Item desktop_menu[] = {
|
||||||
{_(" &New desktop item "), 0, 0, 0, FL_SUBMENU},
|
{_(" &New desktop item "), 0, 0, 0, FL_SUBMENU},
|
||||||
@@ -98,39 +98,33 @@ inline bool intersects(int x1, int y1, int w1, int h1, int x2, int y2, int w2, i
|
|||||||
MAX(y1, y2) <= MIN(h1, h2));
|
MAX(y1, y2) <= MIN(h1, h2));
|
||||||
}
|
}
|
||||||
|
|
||||||
// assume fl_open_display() is called before
|
static void exit_signal(int signum) {
|
||||||
inline void dpy_sizes(int& width, int& height) {
|
|
||||||
width = DisplayWidth(fl_display, fl_screen);
|
|
||||||
height = DisplayHeight(fl_display, fl_screen);
|
|
||||||
}
|
|
||||||
|
|
||||||
void exit_signal(int signum) {
|
|
||||||
E_DEBUG(E_STRLOC ": Exiting (got signal %d)\n", signum);
|
E_DEBUG(E_STRLOC ": Exiting (got signal %d)\n", signum);
|
||||||
running = false;
|
running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void restart_signal(int signum) {
|
static void restart_signal(int signum) {
|
||||||
E_DEBUG(E_STRLOC ": Restarting (got signal %d)\n", signum);
|
E_DEBUG(E_STRLOC ": Restarting (got signal %d)\n", signum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dir_watch_cb(const char* dir, const char* changed, int flags, void* data) {
|
static void dir_watch_cb(const char* dir, const char* changed, int flags, void* data) {
|
||||||
Desktop::instance()->dir_watch(dir, changed, flags);
|
Desktop::instance()->dir_watch(dir, changed, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void settings_changed_cb(void* data) {
|
static void settings_changed_cb(void* data) {
|
||||||
Desktop::instance()->read_config();
|
Desktop::instance()->read_config();
|
||||||
Desktop::instance()->redraw();
|
Desktop::instance()->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void background_conf_cb(Fl_Widget*, void*) {
|
static void background_conf_cb(Fl_Widget*, void*) {
|
||||||
Desktop::instance()->execute("ede-desktop-conf");
|
Desktop::instance()->execute("ede-desktop-conf");
|
||||||
}
|
}
|
||||||
|
|
||||||
void icons_conf_cb(Fl_Widget*, void*) {
|
static void icons_conf_cb(Fl_Widget*, void*) {
|
||||||
Desktop::instance()->execute("ede-desktop-conf --icons");
|
Desktop::instance()->execute("ede-desktop-conf --icons");
|
||||||
}
|
}
|
||||||
|
|
||||||
int desktop_xmessage_handler(int event) {
|
static int desktop_xmessage_handler(int event) {
|
||||||
if(fl_xevent->type == PropertyNotify) {
|
if(fl_xevent->type == PropertyNotify) {
|
||||||
if(fl_xevent->xproperty.atom == _XA_NET_CURRENT_DESKTOP) {
|
if(fl_xevent->xproperty.atom == _XA_NET_CURRENT_DESKTOP) {
|
||||||
Desktop::instance()->notify_desktop_changed();
|
Desktop::instance()->notify_desktop_changed();
|
||||||
@@ -154,7 +148,7 @@ Desktop::Desktop() : DESKTOP_WINDOW(0, 0, 100, 100, "") {
|
|||||||
#ifdef USE_EDELIB_WINDOW
|
#ifdef USE_EDELIB_WINDOW
|
||||||
window_id(EDE_DESKTOP_UID);
|
window_id(EDE_DESKTOP_UID);
|
||||||
foreign_callback(settings_changed_cb);
|
foreign_callback(settings_changed_cb);
|
||||||
//DESKTOP_WINDOW::single_buffer(true);
|
/* DESKTOP_WINDOW::single_buffer(true); */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
selbox = new SelectionOverlay;
|
selbox = new SelectionOverlay;
|
||||||
@@ -162,7 +156,7 @@ Desktop::Desktop() : DESKTOP_WINDOW(0, 0, 100, 100, "") {
|
|||||||
selbox->show = false;
|
selbox->show = false;
|
||||||
|
|
||||||
gisett = new GlobalIconSettings;
|
gisett = new GlobalIconSettings;
|
||||||
// gnome light blue
|
/* gnome light blue */
|
||||||
gisett->label_background = 138;
|
gisett->label_background = 138;
|
||||||
gisett->label_foreground = FL_WHITE;
|
gisett->label_foreground = FL_WHITE;
|
||||||
gisett->label_fontsize = 12;
|
gisett->label_fontsize = 12;
|
||||||
@@ -172,9 +166,8 @@ Desktop::Desktop() : DESKTOP_WINDOW(0, 0, 100, 100, "") {
|
|||||||
gisett->one_click_exec = false;
|
gisett->one_click_exec = false;
|
||||||
gisett->auto_arrange = true;
|
gisett->auto_arrange = true;
|
||||||
|
|
||||||
dsett = new DesktopSettings;
|
/* default background color */
|
||||||
dsett->color = FL_GRAY;
|
color(FL_GRAY);
|
||||||
dsett->wp_use = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Desktop::~Desktop() {
|
Desktop::~Desktop() {
|
||||||
@@ -183,7 +176,6 @@ Desktop::~Desktop() {
|
|||||||
save_icons_positions();
|
save_icons_positions();
|
||||||
|
|
||||||
delete gisett;
|
delete gisett;
|
||||||
delete dsett;
|
|
||||||
delete selbox;
|
delete selbox;
|
||||||
delete dbus;
|
delete dbus;
|
||||||
|
|
||||||
@@ -207,23 +199,22 @@ void Desktop::init_internals(void) {
|
|||||||
wallpaper = new Wallpaper(0, 0, w(), h());
|
wallpaper = new Wallpaper(0, 0, w(), h());
|
||||||
end();
|
end();
|
||||||
|
|
||||||
set_bg_color(dsett->color, false);
|
|
||||||
|
|
||||||
dbus = new edelib::EdbusConnection();
|
dbus = new edelib::EdbusConnection();
|
||||||
if(!dbus->connect(edelib::EDBUS_SESSION)) {
|
if(!dbus->connect(edelib::EDBUS_SESSION)) {
|
||||||
E_WARNING("Unable to connecto to session bus. Disabling dbus interface...\n");
|
E_WARNING(E_STRLOC ": Unable to connect to session bus. Disabling dbus interface...\n");
|
||||||
delete dbus;
|
delete dbus;
|
||||||
dbus = NULL;
|
dbus = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// read main config
|
/* read main config */
|
||||||
read_config();
|
read_config();
|
||||||
|
|
||||||
// now try to load icons, looking inside ~/Desktop directory
|
/* now try to load icons from "Desktop" directory */
|
||||||
p = edelib::dir_home();
|
p = edelib::dir_home();
|
||||||
edelib::String desktop_path = edelib::build_filename(p.c_str(), "Desktop");
|
edelib::String desktop_path = edelib::build_filename(p.c_str(), "Desktop");
|
||||||
|
|
||||||
// setup watcher used for Desktop and Trash directories
|
/* setup watcher used for Desktop and Trash directories */
|
||||||
edelib::DirWatch::init();
|
edelib::DirWatch::init();
|
||||||
|
|
||||||
if(edelib::dir_exists(desktop_path.c_str())) {
|
if(edelib::dir_exists(desktop_path.c_str())) {
|
||||||
@@ -276,8 +267,7 @@ Desktop* Desktop::instance(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function must be overriden so window can inform
|
* This function must be overriden so window can inform wm to see it as desktop. It will send data when window
|
||||||
* wm to see it as desktop. It will send data when window
|
|
||||||
* is created, but before is shown.
|
* is created, but before is shown.
|
||||||
*/
|
*/
|
||||||
void Desktop::show(void) {
|
void Desktop::show(void) {
|
||||||
@@ -287,10 +277,7 @@ void Desktop::show(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* If someone intentionaly hide desktop then quit from it */
|
||||||
* If someone intentionaly hide desktop
|
|
||||||
* then quit from it.
|
|
||||||
*/
|
|
||||||
void Desktop::hide(void) {
|
void Desktop::hide(void) {
|
||||||
running = false;
|
running = false;
|
||||||
}
|
}
|
||||||
@@ -298,53 +285,35 @@ void Desktop::hide(void) {
|
|||||||
void Desktop::update_workarea(void) {
|
void Desktop::update_workarea(void) {
|
||||||
int X, Y, W, H;
|
int X, Y, W, H;
|
||||||
if(!net_get_workarea(X, Y, W, H)) {
|
if(!net_get_workarea(X, Y, W, H)) {
|
||||||
E_WARNING(E_STRLOC ": wm does not support _NET_WM_WORKAREA; using screen sizes...\n");
|
E_DEBUG(E_STRLOC ": wm does not support _NET_WM_WORKAREA; using screen sizes...\n");
|
||||||
X = Y = 0;
|
X = Y = 0;
|
||||||
dpy_sizes(W, H);
|
|
||||||
|
W = DisplayWidth(fl_display, fl_screen);
|
||||||
|
H = DisplayHeight(fl_display, fl_screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
resize(X, Y, W, H);
|
resize(X, Y, W, H);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Desktop::set_bg_color(int c, bool do_redraw) {
|
|
||||||
if(color() == c)
|
|
||||||
return;
|
|
||||||
|
|
||||||
dsett->color = c;
|
|
||||||
color(c);
|
|
||||||
if(do_redraw)
|
|
||||||
redraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Desktop::read_config(void) {
|
void Desktop::read_config(void) {
|
||||||
edelib::Resource conf;
|
edelib::Resource conf;
|
||||||
|
|
||||||
if(!conf.load(CONFIG_NAME)) {
|
if(!conf.load(CONFIG_NAME)) {
|
||||||
E_WARNING(E_STRLOC ": Can't load %s, using default...\n", CONFIG_NAME);
|
E_WARNING(E_STRLOC ": Can't load %s, using default values\n", CONFIG_NAME);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
bool wuse;
|
||||||
* TODO:
|
|
||||||
* Add IconArea[X,Y,W,H] so icons can live
|
|
||||||
* inside that area only (aka margins).
|
|
||||||
*/
|
|
||||||
int default_bg_color = FL_BLUE;
|
|
||||||
int default_wp_use = false;
|
|
||||||
char wpath[256];
|
char wpath[256];
|
||||||
|
int bcolor, wmode;
|
||||||
|
|
||||||
conf.get("Desktop", "color", dsett->color, default_bg_color);
|
conf.get("Desktop", "color", bcolor, FL_GRAY);
|
||||||
conf.get("Desktop", "wallpaper_use", dsett->wp_use, default_wp_use);
|
conf.get("Desktop", "wallpaper_use", wuse, false);
|
||||||
conf.get("Desktop", "wallpaper", wpath, sizeof(wpath));
|
conf.get("Desktop", "wallpaper", wpath, sizeof(wpath));
|
||||||
|
conf.get("Desktop", "wallpaper_mode", wmode, WALLPAPER_CENTER);
|
||||||
|
|
||||||
// keep path but disable wallpaper if file does not exists
|
/* '138' is gnome light blue */
|
||||||
if(!edelib::file_exists(wpath)) {
|
|
||||||
E_DEBUG(E_STRLOC ": %s as wallpaper does not exists\n", wpath);
|
|
||||||
dsett->wp_use = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// '138' is gnome light blue
|
|
||||||
conf.get("Icons", "label_background", gisett->label_background, 138);
|
conf.get("Icons", "label_background", gisett->label_background, 138);
|
||||||
|
|
||||||
conf.get("Icons", "label_foreground", gisett->label_foreground, FL_WHITE);
|
conf.get("Icons", "label_foreground", gisett->label_foreground, FL_WHITE);
|
||||||
conf.get("Icons", "label_fontsize", gisett->label_fontsize, 12);
|
conf.get("Icons", "label_fontsize", gisett->label_fontsize, 12);
|
||||||
conf.get("Icons", "label_maxwidth", gisett->label_maxwidth, 75);
|
conf.get("Icons", "label_maxwidth", gisett->label_maxwidth, 75);
|
||||||
@@ -353,8 +322,15 @@ void Desktop::read_config(void) {
|
|||||||
conf.get("Icons", "one_click_exec", gisett->one_click_exec, false);
|
conf.get("Icons", "one_click_exec", gisett->one_click_exec, false);
|
||||||
conf.get("Icons", "auto_arrange", gisett->auto_arrange, true);
|
conf.get("Icons", "auto_arrange", gisett->auto_arrange, true);
|
||||||
|
|
||||||
if(dsett->wp_use)
|
/* prevent wild values */
|
||||||
wallpaper->set(wpath);
|
if(wmode != WALLPAPER_CENTER && wmode != WALLPAPER_TILE && wmode != WALLPAPER_STRETCH)
|
||||||
|
wmode = WALLPAPER_CENTER;
|
||||||
|
|
||||||
|
if(wuse && !wallpaper->load(wpath, (WallpaperState)wmode))
|
||||||
|
E_WARNING(E_STRLOC ": unable to load wallpaper '%s'\n", wpath);
|
||||||
|
|
||||||
|
/* change background color too */
|
||||||
|
color(bcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Desktop::load_icons(const char* path) {
|
void Desktop::load_icons(const char* path) {
|
||||||
@@ -368,7 +344,7 @@ void Desktop::load_icons(const char* path) {
|
|||||||
|
|
||||||
StringList lst;
|
StringList lst;
|
||||||
|
|
||||||
// list with full path; icon basename is extracted in add_icon_by_path()
|
/* list with full path; icon basename is extracted in add_icon_by_path() */
|
||||||
if(!dir_list(path, lst, true)) {
|
if(!dir_list(path, lst, true)) {
|
||||||
E_DEBUG(E_STRLOC ": Can't read %s\n", path);
|
E_DEBUG(E_STRLOC ": Can't read %s\n", path);
|
||||||
return;
|
return;
|
||||||
@@ -389,9 +365,8 @@ bool Desktop::add_icon_by_path(const char* path, edelib::Resource* conf) {
|
|||||||
/*
|
/*
|
||||||
* see is possible .desktop file; icon, name fields are filled from read_desktop_file()
|
* see is possible .desktop file; icon, name fields are filled from read_desktop_file()
|
||||||
*
|
*
|
||||||
* FIXME: maybe the good thing is to use MimeType to check .desktop;
|
* FIXME: maybe the good thing is to use MimeType to check .desktop; extension does not have
|
||||||
* extension does not have to be always present, or .desktop does not have to be
|
* to be always present, or .desktop does not have to be Desktop File at all
|
||||||
* Desktop File at all
|
|
||||||
*/
|
*/
|
||||||
if(edelib::str_ends(path, ".desktop")) {
|
if(edelib::str_ends(path, ".desktop")) {
|
||||||
if(read_desktop_file(path, is))
|
if(read_desktop_file(path, is))
|
||||||
@@ -399,11 +374,11 @@ bool Desktop::add_icon_by_path(const char* path, edelib::Resource* conf) {
|
|||||||
} else {
|
} else {
|
||||||
edelib::MimeType mt;
|
edelib::MimeType mt;
|
||||||
|
|
||||||
// then try to figure out it's mime; if fails, ignore it
|
/* then try to figure out it's mime; if fails, ignore it */
|
||||||
if(mt.set(path)) {
|
if(mt.set(path)) {
|
||||||
E_DEBUG(E_STRLOC ": Loading icon as mime-type %s\n", mt.icon_name().c_str());
|
E_DEBUG(E_STRLOC ": Loading icon as mime-type %s\n", mt.icon_name().c_str());
|
||||||
is.icon = mt.icon_name();
|
is.icon = mt.icon_name();
|
||||||
// icon label path's basename
|
/* icon label path's basename */
|
||||||
is.name = base;
|
is.name = base;
|
||||||
is.type = ICON_FILE;
|
is.type = ICON_FILE;
|
||||||
|
|
||||||
@@ -421,12 +396,12 @@ bool Desktop::add_icon_by_path(const char* path, edelib::Resource* conf) {
|
|||||||
*/
|
*/
|
||||||
is.key_name = base;
|
is.key_name = base;
|
||||||
|
|
||||||
// random_pos() is used if X/Y keys are not found
|
/* random_pos() is used if X/Y keys are not found */
|
||||||
int icon_x = random_pos(w() - 10);
|
int icon_x = random_pos(w() - 10);
|
||||||
int icon_y = random_pos(w() - 10);
|
int icon_y = random_pos(w() - 10);
|
||||||
|
|
||||||
if(conf) {
|
if(conf) {
|
||||||
// we load positions from used ede-desktop-icos.conf only
|
/* we load positions from used ede-desktop-icos.conf only */
|
||||||
conf->get(base, "X", icon_x, icon_x, edelib::RES_USER_ONLY);
|
conf->get(base, "X", icon_x, icon_x, edelib::RES_USER_ONLY);
|
||||||
conf->get(base, "Y", icon_y, icon_y, edelib::RES_USER_ONLY);
|
conf->get(base, "Y", icon_y, icon_y, edelib::RES_USER_ONLY);
|
||||||
}
|
}
|
||||||
@@ -436,7 +411,7 @@ bool Desktop::add_icon_by_path(const char* path, edelib::Resource* conf) {
|
|||||||
is.y = icon_y;
|
is.y = icon_y;
|
||||||
is.full_path = path;
|
is.full_path = path;
|
||||||
|
|
||||||
DesktopIcon* dic = new DesktopIcon(gisett, &is, dsett->color);
|
DesktopIcon* dic = new DesktopIcon(gisett, &is, color());
|
||||||
add_icon(dic);
|
add_icon(dic);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -495,7 +470,7 @@ bool Desktop::remove_icon_by_path(const char* path) {
|
|||||||
if(found) {
|
if(found) {
|
||||||
DesktopIcon* ic = (*it);
|
DesktopIcon* ic = (*it);
|
||||||
icons.erase(it);
|
icons.erase(it);
|
||||||
// Fl_Group::remove() does not delete child, just pops it out
|
/* Fl_Group::remove() does not delete child, just pops it out */
|
||||||
remove(ic);
|
remove(ic);
|
||||||
delete ic;
|
delete ic;
|
||||||
}
|
}
|
||||||
@@ -503,7 +478,6 @@ bool Desktop::remove_icon_by_path(const char* path) {
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
// read .desktop files
|
|
||||||
bool Desktop::read_desktop_file(const char* path, IconSettings& is) {
|
bool Desktop::read_desktop_file(const char* path, IconSettings& is) {
|
||||||
E_ASSERT(path != NULL);
|
E_ASSERT(path != NULL);
|
||||||
|
|
||||||
@@ -522,8 +496,9 @@ bool Desktop::read_desktop_file(const char* path, IconSettings& is) {
|
|||||||
int buffsz = sizeof(buff);
|
int buffsz = sizeof(buff);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for 'EmptyIcon' key since via it is determined
|
* Check for 'EmptyIcon' key since via it is determined is icon trash type or not
|
||||||
* is icon trash type or not (in case of trash, 'Icon' key is used for full trash).
|
* (in case of trash, 'Icon' key is used for full trash).
|
||||||
|
*
|
||||||
* FIXME: any other way to check for trash icons ???
|
* FIXME: any other way to check for trash icons ???
|
||||||
*/
|
*/
|
||||||
if(dconf.get("Desktop Entry", "EmptyIcon", buff, buffsz)) {
|
if(dconf.get("Desktop Entry", "EmptyIcon", buff, buffsz)) {
|
||||||
@@ -646,19 +621,17 @@ void Desktop::move_selection(int x, int y, bool apply) {
|
|||||||
tmp_y = y - selection_y;
|
tmp_y = y - selection_y;
|
||||||
|
|
||||||
ic->drag(prev_x + tmp_x, prev_y + tmp_y, apply);
|
ic->drag(prev_x + tmp_x, prev_y + tmp_y, apply);
|
||||||
|
#if 0
|
||||||
// very slow if not checked
|
// very slow if not checked
|
||||||
//if(apply == true)
|
if(apply == true)
|
||||||
// ic->fast_redraw();
|
ic->fast_redraw();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
selection_x = x;
|
selection_x = x;
|
||||||
selection_y = y;
|
selection_y = y;
|
||||||
|
|
||||||
/*
|
/* Redraw whole screen so it reflects new icon position */
|
||||||
* Redraw whole screen so it reflects
|
|
||||||
* new icon position
|
|
||||||
*/
|
|
||||||
if(apply)
|
if(apply)
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
@@ -798,7 +771,7 @@ void Desktop::dnd_drop_source(const char* src, int src_len, int x, int y) {
|
|||||||
sptr = src_copy;
|
sptr = src_copy;
|
||||||
|
|
||||||
if(!edelib::file_exists(sptr) && !edelib::dir_exists(sptr)) {
|
if(!edelib::file_exists(sptr) && !edelib::dir_exists(sptr)) {
|
||||||
fl_message("Droping file content is not implemented yet. Soon, soon... :)");
|
edelib::message("Droping file content is not implemented yet. Soon, soon... :)");
|
||||||
delete [] src_copy;
|
delete [] src_copy;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -838,7 +811,7 @@ void Desktop::dnd_drop_source(const char* src, int src_len, int x, int y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!is_read) {
|
if(!is_read) {
|
||||||
// absolute path is (for now) seen as non-url
|
/* absolute path is (for now) seen as non-url */
|
||||||
if(sptr[0] == '/')
|
if(sptr[0] == '/')
|
||||||
is.cmd_is_url = false;
|
is.cmd_is_url = false;
|
||||||
else
|
else
|
||||||
@@ -872,8 +845,7 @@ void Desktop::draw(void) {
|
|||||||
|
|
||||||
if(damage() & (FL_DAMAGE_ALL | FL_DAMAGE_EXPOSE)) {
|
if(damage() & (FL_DAMAGE_ALL | FL_DAMAGE_EXPOSE)) {
|
||||||
/*
|
/*
|
||||||
* If any overlay was previously visible during full
|
* If any overlay was previously visible during full redraw, it will not be cleared because of fast flip.
|
||||||
* redraw, it will not be cleared because of fast flip.
|
|
||||||
* This will assure that does not happened.
|
* This will assure that does not happened.
|
||||||
*/
|
*/
|
||||||
clear_xoverlay();
|
clear_xoverlay();
|
||||||
@@ -967,8 +939,7 @@ int Desktop::handle(int event) {
|
|||||||
|
|
||||||
case FL_PUSH: {
|
case FL_PUSH: {
|
||||||
/*
|
/*
|
||||||
* First check where we clicked. If we do it on desktop
|
* First check where we clicked. If we do it on desktop unfocus any possible focused childs, and handle
|
||||||
* unfocus any possible focused childs, and handle
|
|
||||||
* specific clicks. Otherwise, do rest for childs.
|
* specific clicks. Otherwise, do rest for childs.
|
||||||
*/
|
*/
|
||||||
Fl_Widget* clicked = Fl::belowmouse();
|
Fl_Widget* clicked = Fl::belowmouse();
|
||||||
@@ -977,8 +948,8 @@ int Desktop::handle(int event) {
|
|||||||
E_DEBUG(E_STRLOC ": DESKTOP CLICK !!!\n");
|
E_DEBUG(E_STRLOC ": DESKTOP CLICK !!!\n");
|
||||||
if(!selectionbuff.empty()) {
|
if(!selectionbuff.empty()) {
|
||||||
/*
|
/*
|
||||||
* Only focused are in selectionbuff, so this is
|
* Only focused are in selectionbuff, so this is fine to do; also will prevent
|
||||||
* fine to do; also will prevent full redraw when is clicked on desktop
|
* full redraw when is clicked on desktop
|
||||||
*/
|
*/
|
||||||
unfocus_all();
|
unfocus_all();
|
||||||
selectionbuff.clear();
|
selectionbuff.clear();
|
||||||
@@ -1012,18 +983,10 @@ int Desktop::handle(int event) {
|
|||||||
return 1;
|
return 1;
|
||||||
} else if(SELECTION_SINGLE) {
|
} else if(SELECTION_SINGLE) {
|
||||||
if(!in_selection(tmp_icon)) {
|
if(!in_selection(tmp_icon)) {
|
||||||
/*
|
|
||||||
* for testing:
|
|
||||||
* notify_box(tmp_icon->label());
|
|
||||||
*/
|
|
||||||
select_only(tmp_icon);
|
select_only(tmp_icon);
|
||||||
}
|
}
|
||||||
} else if(Fl::event_button() == 3) {
|
} else if(Fl::event_button() == 3) {
|
||||||
select_only(tmp_icon);
|
select_only(tmp_icon);
|
||||||
/*
|
|
||||||
* for testing:
|
|
||||||
* notify_box(tmp_icon->label());
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1057,10 +1020,10 @@ int Desktop::handle(int event) {
|
|||||||
|
|
||||||
selbox->show = true;
|
selbox->show = true;
|
||||||
|
|
||||||
// see if there some icons inside selection area
|
/* see if there some icons inside selection area */
|
||||||
select_in_area();
|
select_in_area();
|
||||||
|
|
||||||
// redraw selection box
|
/* redraw selection box */
|
||||||
damage(EDAMAGE_OVERLAY);
|
damage(EDAMAGE_OVERLAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1079,9 +1042,8 @@ int Desktop::handle(int event) {
|
|||||||
/*
|
/*
|
||||||
* Now pickup those who are in is_focused() state.
|
* Now pickup those who are in is_focused() state.
|
||||||
*
|
*
|
||||||
* Possible flickers due overlay will be later removed when is
|
* Possible flickers due overlay will be later removed when is called move_selection(), which
|
||||||
* called move_selection(), which will in turn redraw icons again
|
* will in turn redraw icons again after position them.
|
||||||
* after position them.
|
|
||||||
*/
|
*/
|
||||||
if(!selectionbuff.empty())
|
if(!selectionbuff.empty())
|
||||||
selectionbuff.clear();
|
selectionbuff.clear();
|
||||||
@@ -1101,8 +1063,7 @@ int Desktop::handle(int event) {
|
|||||||
/*
|
/*
|
||||||
* Do not send FL_RELEASE during move
|
* Do not send FL_RELEASE during move
|
||||||
*
|
*
|
||||||
* TODO: should be alowed FL_RELEASE to multiple icons? (aka. run
|
* TODO: should be alowed FL_RELEASE to multiple icons? (aka. run command for all selected icons)?
|
||||||
* command for all selected icons ?
|
|
||||||
*/
|
*/
|
||||||
if(selectionbuff.size() == 1 && !moving)
|
if(selectionbuff.size() == 1 && !moving)
|
||||||
(*selectionbuff.begin())->handle(FL_RELEASE);
|
(*selectionbuff.begin())->handle(FL_RELEASE);
|
||||||
@@ -1151,7 +1112,7 @@ int main() {
|
|||||||
|
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
|
|
||||||
// a lot of preparing code depends on this
|
/* a lot of preparing code depends on this */
|
||||||
fl_open_display();
|
fl_open_display();
|
||||||
|
|
||||||
#ifndef USE_EDELIB_WINDOW
|
#ifndef USE_EDELIB_WINDOW
|
||||||
@@ -1162,10 +1123,7 @@ int main() {
|
|||||||
Desktop::init();
|
Desktop::init();
|
||||||
Desktop::instance()->show();
|
Desktop::instance()->show();
|
||||||
|
|
||||||
/*
|
/* XSelectInput will redirect PropertyNotify messages, which are listened for */
|
||||||
* XSelectInput will redirect PropertyNotify messages, which
|
|
||||||
* are listened for
|
|
||||||
*/
|
|
||||||
XSelectInput(fl_display, RootWindow(fl_display, fl_screen), PropertyChangeMask | StructureNotifyMask | ClientMessage);
|
XSelectInput(fl_display, RootWindow(fl_display, fl_screen), PropertyChangeMask | StructureNotifyMask | ClientMessage);
|
||||||
|
|
||||||
Fl::add_handler(desktop_xmessage_handler);
|
Fl::add_handler(desktop_xmessage_handler);
|
||||||
|
@@ -30,11 +30,6 @@
|
|||||||
#define EDAMAGE_CHILD_LABEL 0x10
|
#define EDAMAGE_CHILD_LABEL 0x10
|
||||||
#define EDAMAGE_OVERLAY 0x20
|
#define EDAMAGE_OVERLAY 0x20
|
||||||
|
|
||||||
struct DesktopSettings {
|
|
||||||
int color; // background color
|
|
||||||
bool wp_use; // use wallpaper or not
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GlobalIconSettings {
|
struct GlobalIconSettings {
|
||||||
int label_background;
|
int label_background;
|
||||||
int label_foreground;
|
int label_foreground;
|
||||||
@@ -107,7 +102,6 @@ private:
|
|||||||
SelectionOverlay* selbox;
|
SelectionOverlay* selbox;
|
||||||
|
|
||||||
GlobalIconSettings* gisett;
|
GlobalIconSettings* gisett;
|
||||||
DesktopSettings* dsett;
|
|
||||||
|
|
||||||
Fl_Menu_Button* dmenu;
|
Fl_Menu_Button* dmenu;
|
||||||
Wallpaper* wallpaper;
|
Wallpaper* wallpaper;
|
||||||
@@ -161,8 +155,6 @@ public:
|
|||||||
void update_workarea(void);
|
void update_workarea(void);
|
||||||
void area(int& X, int& Y, int& W, int& H) { X = x(); Y = y(); W = w(); H = h(); }
|
void area(int& X, int& Y, int& W, int& H) { X = x(); Y = y(); W = w(); H = h(); }
|
||||||
|
|
||||||
void set_bg_color(int c, bool do_redraw = true);
|
|
||||||
|
|
||||||
void notify_desktop_changed(void);
|
void notify_desktop_changed(void);
|
||||||
|
|
||||||
void dir_watch(const char* dir, const char* changed, int flags);
|
void dir_watch(const char* dir, const char* changed, int flags);
|
||||||
|
Reference in New Issue
Block a user