mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Instead local USE_SHAPE, use HAVE_SHAPE from global config.h.
Some code style update.
This commit is contained in:
parent
5fe543ff4c
commit
0c2831c50e
@ -10,6 +10,10 @@
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/Fl_Shared_Image.H>
|
||||
@ -22,7 +26,7 @@
|
||||
#include <edelib/Nls.h>
|
||||
#include <edelib/Run.h>
|
||||
|
||||
#ifdef USE_SHAPE
|
||||
#ifdef HAVE_SHAPE
|
||||
#include <X11/extensions/shape.h>
|
||||
#endif
|
||||
|
||||
@ -219,7 +223,7 @@ void DesktopIcon::fix_position(int X, int Y) {
|
||||
void DesktopIcon::drag(int x, int y, bool apply) {
|
||||
if(!micon) {
|
||||
micon = new MovableIcon(this);
|
||||
#if USE_SHAPE
|
||||
#if HAVE_SHAPE
|
||||
/*
|
||||
* This is used to calculate correct window startup/ending
|
||||
* position since icon is placed in the middle of the box.
|
||||
@ -243,7 +247,7 @@ void DesktopIcon::drag(int x, int y, bool apply) {
|
||||
}
|
||||
|
||||
if(apply) {
|
||||
#if USE_SHAPE
|
||||
#if HAVE_SHAPE
|
||||
int ix, iy;
|
||||
ix = iy = 0;
|
||||
if(image()) {
|
||||
@ -259,7 +263,7 @@ void DesktopIcon::drag(int x, int y, bool apply) {
|
||||
}
|
||||
}
|
||||
|
||||
// Used only in Desktop::move_selection
|
||||
/* used only in Desktop::move_selection */
|
||||
int DesktopIcon::drag_icon_x(void) {
|
||||
if(!micon)
|
||||
return x();
|
||||
@ -267,7 +271,7 @@ int DesktopIcon::drag_icon_x(void) {
|
||||
return micon->x();
|
||||
}
|
||||
|
||||
// Used only in Desktop::move_selection
|
||||
/* used only in Desktop::move_selection */
|
||||
int DesktopIcon::drag_icon_y(void) {
|
||||
if(!micon)
|
||||
return y();
|
||||
@ -315,7 +319,7 @@ void DesktopIcon::fast_redraw(void) {
|
||||
xpos = x() - 4;
|
||||
}
|
||||
|
||||
// LABEL_OFFSET + 2 include selection box line height too; same for xpos
|
||||
/* LABEL_OFFSET + 2 include selection box line height too; same for xpos */
|
||||
parent()->damage(FL_DAMAGE_ALL, xpos, y(), wsz, h() + lheight + LABEL_OFFSET + 2);
|
||||
}
|
||||
|
||||
@ -325,13 +329,13 @@ void DesktopIcon::draw(void) {
|
||||
if(image() && (damage() & FL_DAMAGE_ALL)) {
|
||||
Fl_Image* im = image();
|
||||
|
||||
// center image in the box
|
||||
/* center image in the box */
|
||||
int ix = (w()/2) - (im->w()/2);
|
||||
int iy = (h()/2) - (im->h()/2);
|
||||
ix += x();
|
||||
iy += y();
|
||||
|
||||
// darker_img is always present if image() is present
|
||||
/* darker_img is always present if image() is present */
|
||||
if(is_focused())
|
||||
darker_img->draw(ix, iy);
|
||||
else
|
||||
@ -354,44 +358,40 @@ void DesktopIcon::draw(void) {
|
||||
int old_font = fl_font();
|
||||
int old_font_sz = fl_size();
|
||||
|
||||
// draw with icon's font
|
||||
/* draw with icon's font */
|
||||
fl_font(labelfont(), labelsize());
|
||||
|
||||
// pseudo-shadow
|
||||
/* pseudo-shadow */
|
||||
fl_color(FL_BLACK);
|
||||
fl_draw(label(), X+1, Y+1, lwidth, lheight, align(), 0, 0);
|
||||
|
||||
fl_color(globals->label_foreground);
|
||||
fl_draw(label(), X, Y, lwidth, lheight, align(), 0, 0);
|
||||
|
||||
// restore old font
|
||||
/* restore old font */
|
||||
fl_font(old_font, old_font_sz);
|
||||
|
||||
if(is_focused()) {
|
||||
/*
|
||||
* draw focused box on our way so later
|
||||
* this can be used to draw customised boxes
|
||||
*/
|
||||
/* draw focused box on our way so later this can be used to draw customised boxes */
|
||||
fl_color(globals->label_foreground);
|
||||
fl_line_style(FL_DOT);
|
||||
|
||||
fl_push_matrix();
|
||||
fl_begin_loop();
|
||||
fl_vertex(X,Y);
|
||||
fl_vertex(X+lwidth,Y);
|
||||
fl_vertex(X+lwidth,Y+lheight);
|
||||
fl_vertex(X,Y+lheight);
|
||||
fl_vertex(X,Y);
|
||||
fl_vertex(X, Y);
|
||||
fl_vertex(X + lwidth, Y);
|
||||
fl_vertex(X + lwidth, Y + lheight);
|
||||
fl_vertex(X, Y + lheight);
|
||||
fl_vertex(X, Y);
|
||||
fl_end_loop();
|
||||
fl_pop_matrix();
|
||||
|
||||
// revert to default line style
|
||||
/* revert to default line style */
|
||||
fl_line_style(0);
|
||||
}
|
||||
|
||||
// revert to old color whatever that be
|
||||
/* revert to old color whatever that be */
|
||||
fl_color(old);
|
||||
|
||||
E_DEBUG(E_STRLOC ": DesktopIcon label redraw\n");
|
||||
}
|
||||
}
|
||||
@ -403,16 +403,14 @@ int DesktopIcon::handle(int event) {
|
||||
case FL_ENTER:
|
||||
case FL_LEAVE:
|
||||
return 1;
|
||||
/*
|
||||
* We have to handle FL_MOVE too, if want to get only once
|
||||
* FL_ENTER when entered or FL_LEAVE when leaved.
|
||||
*/
|
||||
/* We have to handle FL_MOVE too, if want to get only once FL_ENTER when entered or FL_LEAVE when leaved */
|
||||
case FL_MOVE:
|
||||
return 1;
|
||||
case FL_PUSH:
|
||||
if(Fl::event_button() == 3) {
|
||||
// Fl_Menu_Item::popup() by default does not call callbacks
|
||||
/* Fl_Menu_Item::popup() by default does not call callbacks */
|
||||
const Fl_Menu_Item* m = imenu->menu()->popup(Fl::event_x(), Fl::event_y());
|
||||
|
||||
if(m && m->callback())
|
||||
m->do_callback(0, this);
|
||||
}
|
||||
@ -451,7 +449,7 @@ MovableIcon::MovableIcon(DesktopIcon* ic) : Fl_Window(ic->x(), ic->y(), ic->w(),
|
||||
* Force box be same width/height as icon so it
|
||||
* can fit inside masked window.
|
||||
*/
|
||||
#ifdef USE_SHAPE
|
||||
#ifdef HAVE_SHAPE
|
||||
Fl_Image* img = ic->icon_image();
|
||||
if(img)
|
||||
icon_box = new Fl_Box(0, 0, img->w(), img->h());
|
||||
@ -473,7 +471,7 @@ void MovableIcon::show(void) {
|
||||
if(!shown())
|
||||
Fl_X::make_xid(this);
|
||||
|
||||
#ifdef USE_SHAPE
|
||||
#ifdef HAVE_SHAPE
|
||||
if(icon->icon_image()) {
|
||||
mask = create_mask(icon->icon_image());
|
||||
if(mask) {
|
||||
@ -485,6 +483,7 @@ void MovableIcon::show(void) {
|
||||
*/
|
||||
Atom opacity_atom = XInternAtom(fl_display, "_NET_WM_WINDOW_OPACITY", False);
|
||||
unsigned int opacity = 0xc0000000;
|
||||
|
||||
XChangeProperty(fl_display, fl_xid(this), opacity_atom, XA_CARDINAL, 32, PropModeReplace,
|
||||
(unsigned char*)&opacity, 1L);
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
SubDir TOP ede-desktop ;
|
||||
|
||||
ObjectC++Flags DesktopIcon.cpp : -DUSE_SHAPE ;
|
||||
ObjectC++Flags ede-desktop.cpp : -DUSE_EDELIB_WINDOW ;
|
||||
|
||||
SOURCE = ede-desktop.cpp Utils.cpp Wallpaper.cpp DesktopIcon.cpp IconProperties.cpp ;
|
||||
|
@ -199,7 +199,6 @@ void Desktop::init_internals(void) {
|
||||
wallpaper = new Wallpaper(0, 0, w(), h());
|
||||
end();
|
||||
|
||||
|
||||
dbus = new edelib::EdbusConnection();
|
||||
if(!dbus->connect(edelib::EDBUS_SESSION)) {
|
||||
E_WARNING(E_STRLOC ": Unable to connect to session bus. Disabling dbus interface...\n");
|
||||
@ -565,7 +564,7 @@ void Desktop::select(DesktopIcon* ic, bool do_redraw) {
|
||||
if(in_selection(ic))
|
||||
return;
|
||||
|
||||
selectionbuff.push_back(ic);
|
||||
selectionbuf.push_back(ic);
|
||||
|
||||
if(!ic->is_focused()) {
|
||||
ic->do_focus();
|
||||
@ -579,8 +578,8 @@ void Desktop::select_only(DesktopIcon* ic) {
|
||||
E_ASSERT(ic != NULL);
|
||||
|
||||
unfocus_all();
|
||||
selectionbuff.clear();
|
||||
selectionbuff.push_back(ic);
|
||||
selectionbuf.clear();
|
||||
selectionbuf.push_back(ic);
|
||||
|
||||
ic->do_focus();
|
||||
ic->fast_redraw();
|
||||
@ -589,12 +588,12 @@ void Desktop::select_only(DesktopIcon* ic) {
|
||||
bool Desktop::in_selection(const DesktopIcon* ic) {
|
||||
E_ASSERT(ic != NULL);
|
||||
|
||||
if(selectionbuff.empty())
|
||||
if(selectionbuf.empty())
|
||||
return false;
|
||||
|
||||
DesktopIconListIter it, it_end;
|
||||
|
||||
for(it = selectionbuff.begin(), it_end = selectionbuff.end(); it != it_end; ++it) {
|
||||
for(it = selectionbuf.begin(), it_end = selectionbuf.end(); it != it_end; ++it) {
|
||||
if((*it) == ic)
|
||||
return true;
|
||||
}
|
||||
@ -603,7 +602,7 @@ bool Desktop::in_selection(const DesktopIcon* ic) {
|
||||
}
|
||||
|
||||
void Desktop::move_selection(int x, int y, bool apply) {
|
||||
if(selectionbuff.empty())
|
||||
if(selectionbuf.empty())
|
||||
return;
|
||||
|
||||
int prev_x, prev_y, tmp_x, tmp_y;
|
||||
@ -611,7 +610,7 @@ void Desktop::move_selection(int x, int y, bool apply) {
|
||||
|
||||
DesktopIconListIter it, it_end;
|
||||
|
||||
for(it = selectionbuff.begin(), it_end = selectionbuff.end(); it != it_end; ++it) {
|
||||
for(it = selectionbuf.begin(), it_end = selectionbuf.end(); it != it_end; ++it) {
|
||||
ic = (*it);
|
||||
|
||||
prev_x = ic->drag_icon_x();
|
||||
@ -946,13 +945,13 @@ int Desktop::handle(int event) {
|
||||
|
||||
if(NOT_SELECTABLE(clicked)) {
|
||||
E_DEBUG(E_STRLOC ": DESKTOP CLICK !!!\n");
|
||||
if(!selectionbuff.empty()) {
|
||||
if(!selectionbuf.empty()) {
|
||||
/*
|
||||
* Only focused are in selectionbuff, so this is fine to do; also will prevent
|
||||
* Only focused are in selectionbuf, so this is fine to do; also will prevent
|
||||
* full redraw when is clicked on desktop
|
||||
*/
|
||||
unfocus_all();
|
||||
selectionbuff.clear();
|
||||
selectionbuf.clear();
|
||||
}
|
||||
|
||||
// track position so moving can be deduced
|
||||
@ -1005,7 +1004,7 @@ int Desktop::handle(int event) {
|
||||
|
||||
case FL_DRAG:
|
||||
moving = true;
|
||||
if(!selectionbuff.empty()) {
|
||||
if(!selectionbuf.empty()) {
|
||||
E_DEBUG(E_STRLOC ": DRAG icon from desktop\n");
|
||||
move_selection(Fl::event_x_root(), Fl::event_y_root(), false);
|
||||
} else {
|
||||
@ -1045,8 +1044,8 @@ int Desktop::handle(int event) {
|
||||
* Possible flickers due overlay will be later removed when is called move_selection(), which
|
||||
* will in turn redraw icons again after position them.
|
||||
*/
|
||||
if(!selectionbuff.empty())
|
||||
selectionbuff.clear();
|
||||
if(!selectionbuf.empty())
|
||||
selectionbuf.clear();
|
||||
|
||||
DesktopIconListIter it, it_end;
|
||||
for(it = icons.begin(), it_end = icons.end(); it != it_end; ++it) {
|
||||
@ -1057,16 +1056,15 @@ int Desktop::handle(int event) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(!selectionbuff.empty() && moving)
|
||||
if(!selectionbuf.empty() && moving)
|
||||
move_selection(Fl::event_x_root(), Fl::event_y_root(), true);
|
||||
|
||||
/*
|
||||
* Do not send FL_RELEASE during move
|
||||
*
|
||||
* TODO: should be alowed FL_RELEASE to multiple icons? (aka. run command for all selected icons)?
|
||||
*/
|
||||
if(selectionbuff.size() == 1 && !moving)
|
||||
(*selectionbuff.begin())->handle(FL_RELEASE);
|
||||
if(selectionbuf.size() == 1 && !moving)
|
||||
(*selectionbuf.begin())->handle(FL_RELEASE);
|
||||
|
||||
moving = false;
|
||||
return 1;
|
||||
|
@ -108,7 +108,7 @@ private:
|
||||
edelib::EdbusConnection* dbus;
|
||||
|
||||
DesktopIconList icons;
|
||||
DesktopIconList selectionbuff;
|
||||
DesktopIconList selectionbuf;
|
||||
|
||||
edelib::String trash_path;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user