mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Added support for wallpaper size update when screen sizes are changed. Also, there are some tricks applied so wallpaper scaling be done only when really is needed.
This commit is contained in:
parent
f0c50eeebf
commit
8f8a937e98
@ -168,6 +168,7 @@ static void folder_create_cb(Fl_Widget*, void *d) {
|
||||
|
||||
Desktop::Desktop() : EDE_DESKTOP_WINDOW(0, 0, 100, 100, EDE_DESKTOP_APP) {
|
||||
end();
|
||||
|
||||
/* use nice darker blue color as default for background */
|
||||
color(fl_rgb_color(73, 64, 102));
|
||||
|
||||
@ -232,12 +233,30 @@ void Desktop::update_workarea(void) {
|
||||
if(!netwm_workarea_get_size(X, Y, W, H))
|
||||
Fl::screen_xywh(X, Y, W, H);
|
||||
|
||||
E_DEBUG(E_STRLOC ": resizing to %i %i %i %i\n", X, Y, W, H);
|
||||
update_workarea(X, Y, W, H);
|
||||
}
|
||||
|
||||
void Desktop::update_workarea(int X, int Y, int W, int H) {
|
||||
/* prevent multiple calls with the same values */
|
||||
if(X == x() && Y == y() && W == w() && H == h())
|
||||
return;
|
||||
|
||||
E_DEBUG(E_STRLOC ": resizing to %i %i %i %i (was: %i %i %i %i)\n",
|
||||
X, Y, W, H, x(), y(), w(), h());
|
||||
|
||||
/*
|
||||
* Check if wallpaper needs resizing. Sometimes, while screen size is updated
|
||||
* X11 can change x/y, but keep w/h; here, wallpaper size update is not needed.
|
||||
*/
|
||||
bool resize_wallpaper = !(W == w() && H == h());
|
||||
|
||||
resize(X, Y, W, H);
|
||||
|
||||
/* also resize wallpaper if given */
|
||||
if(wallpaper && wallpaper->visible())
|
||||
wallpaper->resize(0, 0, w(), h());
|
||||
if(wallpaper && wallpaper->visible() && resize_wallpaper) {
|
||||
E_DEBUG(E_STRLOC ": resizing wallpaper to %i %i\n", W, H);
|
||||
wallpaper->resize(0, 0, W, H);
|
||||
}
|
||||
}
|
||||
|
||||
void Desktop::read_config(void) {
|
||||
|
@ -72,6 +72,7 @@ public:
|
||||
|
||||
void show(void);
|
||||
void update_workarea(void);
|
||||
void update_workarea(int X, int Y, int W, int H);
|
||||
void read_config(void);
|
||||
|
||||
void read_desktop_folder(const char *dpath = NULL);
|
||||
|
@ -370,10 +370,6 @@ void Wallpaper::set_rootpmap(void) {
|
||||
bool Wallpaper::load(const char *path, int s, bool rootpmap) {
|
||||
E_ASSERT(path != NULL);
|
||||
|
||||
/* in case this function gets multiple calls */
|
||||
if(wpath == path && state == s && rootpmap == use_rootpmap)
|
||||
return true;
|
||||
|
||||
Fl_Shared_Image *img = Fl_Shared_Image::get(path);
|
||||
E_RETURN_VAL_IF_FAIL(img != NULL, false);
|
||||
|
||||
@ -423,7 +419,7 @@ void Wallpaper::draw(void) {
|
||||
|
||||
iw = im->w();
|
||||
ih = im->h();
|
||||
|
||||
|
||||
E_RETURN_IF_FAIL(iw > 0 && ih > 0);
|
||||
|
||||
if(state == WALLPAPER_CENTER) {
|
||||
@ -476,7 +472,7 @@ int Wallpaper::handle(int event) {
|
||||
void Wallpaper::resize(int X, int Y, int W, int H) {
|
||||
if(X == x() && Y == y() && W == w() && H == h())
|
||||
return;
|
||||
|
||||
|
||||
Fl_Box::resize(X, Y, W, H);
|
||||
if(image()) {
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user