aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2001-02-12 18:58:51 +0000
committerCarsten Haitzler <raster@rasterman.com>2001-02-12 18:58:51 +0000
commitf3e2ca146f97c0f62d2c1ce7ee143bb9d9c10ebf (patch)
treebe1525b4d8911618bb497d470dc2c308d9dc2883
parent9cc55ff857d608193ed80d2e562dfe52170a356c (diff)
downloadenlightenment-f3e2ca146f97c0f62d2c1ce7ee143bb9d9c10ebf.tar.gz
enlightenment-f3e2ca146f97c0f62d2c1ce7ee143bb9d9c10ebf.tar.xz
enlightenment-f3e2ca146f97c0f62d2c1ce7ee143bb9d9c10ebf.zip
been working on E............ needs efsd now, desktops are now views, new
background, lists directory, cleaned up some bugs here and there, errrr...... cleaned up menu code and some fixups, added fs abstraction init and working on it.... SVN revision: 4192
-rw-r--r--README57
-rw-r--r--data/images/bg.jpgbin0 -> 179312 bytes
-rw-r--r--data/images/bg.pngbin262896 -> 0 bytes
-rw-r--r--data/orig/icon_file.pngbin0 -> 3407 bytes
-rw-r--r--data/orig/icon_file.xcfbin0 -> 7481 bytes
-rw-r--r--src/Makefile.am1
-rw-r--r--src/actions.c3
-rw-r--r--src/background.c43
-rw-r--r--src/border.c15
-rw-r--r--src/desktops.c389
-rw-r--r--src/e.h51
-rw-r--r--src/fs.c77
-rw-r--r--src/icons.c30
-rw-r--r--src/main.c2
-rw-r--r--src/menu.c31
-rw-r--r--src/util.c33
-rw-r--r--src/view.c343
17 files changed, 595 insertions, 480 deletions
diff --git a/README b/README
index 0f64e13f0..05cc3f0db 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
-------------------------------------------------------------------------------
- Enlightenment 0.17.0 CVS Code....
+ Enlightenment 0.17.pre CVS Code....
-------------------------------------------------------------------------------
The Rasterman - raster@valinux.com, raster@rasterman.com
@@ -18,10 +18,11 @@ you at all use this code, you are HEAVILY URGED, when it is finally released,
to remove all traces of anything this CVS code base has installed on your
system (it is COMPLETELY up to you to keep track of that - do NOT expect any
help), and then install the full release on a cleaned system. Don't come
-asking "can I just keep using CVS" oonce things are released - thqat is the
-reason I pu this paragraph here - so you don't ask. The asnwer is the same
+asking "can I just keep using CVS" once things are released - that is the
+reason I put this paragraph here - so you don't ask. The asnwer is the same
as above - if there is a proper final release use that. CVS is really only
-for those havily hacking on the code.
+for those havily hacking on the code, or whose curiosity is too much to resist
+not giving it a look and try.
Now we have that warning over and done with. How to build and install from
CVS?
@@ -49,21 +50,22 @@ Enlightenment does not check for previously running Window Managers right
now - so you need to make sure no other WM is running - E will not do that
for you.
-Enlightenment has no menus or keybindings or any way of launching
-applications right now - you'll have to figure out an alternative way of
-doing it.
+Enlightenment has no keybindings right now, but does have a primitve menu for
+launching some applications. It is configurable - it's in a database file
+and tere is a script that builds this menu - you could build a new one after
+editing the script or do whatever your like.
Enlightenment only handles a small subset of ICCCM and thus will have bugs -
-some applications will not behave correctly and may apear in odd spots or
+some applications will not behave correctly and may appear in odd spots or
not resize or place themselves properly etc. Expect this - it's code being
worked on. Just be happy it does as much as it already does.
Enlightenment RELIES on lots of libraires that have been written. Ecore,
-Ebits, Evas, Edb, Imlib2 just to mention a few. Especially Ebits, Ecore and
-Evas change in CVS often - you will need the absolute latest of these if you
-wish Enlightenment 0.17 code to run properly or compile. If you update
-Enlightenment from CVS update these too to get any changes they have in
-their trees.
+Ebits, Evas, Edb, Imlib2, Efsd just to mention a few. Especially Ebits,
+Ecore, Efsd and Evas change in CVS often - you will need the absolute latest
+of these if you wish Enlightenment 0.17 code to run properly or compile. If
+you update Enlightenment from CVS update these too to get any changes they
+have in their trees.
If you plan on working on the code... STOP! don't rush in and work on it -
even if you have CVS commit access - EXPECT me (Raster) to revert any changes
@@ -75,22 +77,27 @@ intricate than E 0.16 - but at the same time it's much cleaner and more
object oriented. Learn it well first. Some parts of E 0.17 are "hacked" with
hard-coded stuff, just so, for now, it works. They will be virtualized and
imporved over time. If you have plans - tell me about them first - discuss
-them before you go impliment them. I know I already have a lot of the
-components of E 0.17's code planned in my head - but I won't get to them for
-a while - and if people go impliment or hack bad stuff in, it means I have to
-spend lots of time fixing something that is bad in the first place, or we
-end up doing duplicate work. There *IS* a plan - believe it or not - but to
-be honest - it's more complex and large than I can just write down in a
-README, so talk about your ideas first. I'm going to be ruthless in keeping
-the code neat, clean and free of nasty hacks (except ones I put in as
-temporary stop-gap measures to make the thing work - since I know where
-those are and what I need to do to do it right). If you can't find me or I
-don't reply to your e-mail - don't get impatient - just wait. I currently
+them before you go impliment them - once you've discussed them and we all
+aree on how it should be done, you can go ahead and do it. I know I already
+have a lot of the components of E 0.17's code planned in my head - but I
+won't get to them for a while - and if people go impliment or hack bad stuff
+in, it means I have to spend lots of time fixing something that is bad in the
+first place, or we end up doing duplicate work. There *IS* a plan - believe
+it or not - but to be honest - it's more complex and large than I can just
+write down in a README, so talk about your ideas first. I'm going to be
+ruthless in keeping the code neat, clean and free of nasty hacks (except ones
+I put in as temporary stop-gap measures to make the thing work - since I know
+where those are and what I need to do to do it right). If you can't find me
+or I don't reply to your e-mail - don't get impatient - just wait. I currently
have no network access at home, so I'm doing a chunk of code offline. I'll
get to your mail and queries as time allows.
If you have problems with the code or bugs to report, kindly forward them to
/dev/null (the code is in now way or form ready for bug reports - I don't
-want crap filling my mailbox).
+want crap filling my mailbox), unless its a patch hat fixes a silly bug
+somewhere. Only experienced people should in any way consider sending a bug
+report as I need useful reports, not junk cluttering my mailbox.
I hope that clears things up for now.
+
+In the meantime - have fun.
diff --git a/data/images/bg.jpg b/data/images/bg.jpg
new file mode 100644
index 000000000..bc9a2d634
--- /dev/null
+++ b/data/images/bg.jpg
Binary files differ
diff --git a/data/images/bg.png b/data/images/bg.png
deleted file mode 100644
index 2065e15e8..000000000
--- a/data/images/bg.png
+++ /dev/null
Binary files differ
diff --git a/data/orig/icon_file.png b/data/orig/icon_file.png
new file mode 100644
index 000000000..d17f59669
--- /dev/null
+++ b/data/orig/icon_file.png
Binary files differ
diff --git a/data/orig/icon_file.xcf b/data/orig/icon_file.xcf
new file mode 100644
index 000000000..4c89b719d
--- /dev/null
+++ b/data/orig/icon_file.xcf
Binary files differ
diff --git a/src/Makefile.am b/src/Makefile.am
index 6cbbc5275..347bced16 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,6 +8,7 @@ bin_PROGRAMS = enlightenment
enlightenment_SOURCES = \
actions.c \
+background.c \
border.c \
config.c \
desktops.c \
diff --git a/src/actions.c b/src/actions.c
index 7ddaed9b3..aa78aae32 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -426,7 +426,8 @@ e_actions_init(void)
-
+/* FIXME: these REALLY need to go into other file(s) but it's not worht it */
+/* yet at this point. it can be done later */
static void
e_act_move_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry)
diff --git a/src/background.c b/src/background.c
new file mode 100644
index 000000000..fe801c854
--- /dev/null
+++ b/src/background.c
@@ -0,0 +1,43 @@
+#include "e.h"
+
+void
+e_background_free(E_Background *bg)
+{
+ IF_FREE(bg->image);
+ if ((bg->evas) && (bg->obj))
+ evas_del_object(bg->evas, bg->obj);
+ FREE(bg);
+}
+
+E_Background *
+e_background_new(void)
+{
+ E_Background *bg;
+
+ bg = NEW(E_Background, 1);
+ ZERO(bg, E_Background, 1);
+ OBJ_INIT(bg, e_background_free);
+
+ return bg;
+}
+
+void
+e_background_realize(E_Background *bg, Evas evas)
+{
+ Evas_Object o;
+ int iw, ih;
+
+ if (bg->evas) return;
+ /* FIXME: boring for now - just a scaled image */
+ bg->evas = evas;
+ bg->obj = evas_add_image_from_file(bg->evas, bg->image);
+ evas_set_layer(bg->evas, bg->obj, 0);
+ evas_move(bg->evas, bg->obj, 0, 0);
+ evas_resize(bg->evas, bg->obj, bg->geom.w, bg->geom.h);
+ evas_set_image_fill(bg->evas, bg->obj, 0, 0, bg->geom.w, bg->geom.h);
+ evas_show(bg->evas, bg->obj);
+ o = evas_add_image_from_file(bg->evas, PACKAGE_DATA_DIR"/data/images/e_logo.png");
+ evas_get_image_size(bg->evas, o, &iw, &ih);
+ evas_move(bg->evas, o, (bg->geom.w - iw) / 2, (bg->geom.h - ih) / 2);
+ evas_show(bg->evas, o);
+}
diff --git a/src/border.c b/src/border.c
index 400256f5b..ed210ee43 100644
--- a/src/border.c
+++ b/src/border.c
@@ -123,7 +123,9 @@ e_configure_request(Eevent * ev)
if (e->mask & EV_VALUE_Y)
b->current.requested.y = e->y;
if (e->mask & EV_VALUE_W)
- b->current.requested.w = e->w + pl + pr;
+ {
+ b->current.requested.w = e->w + pl + pr;
+ }
if (e->mask & EV_VALUE_H)
{
if (b->current.shaded == b->client.h)
@@ -1188,6 +1190,8 @@ e_border_adopt(Window win, int use_client_pos)
/* fix size so it matches the hints a client asks for */
b->changed = 1;
e_border_adjust_limits(b);
+ b->current.requested.h = b->current.h;
+ b->current.requested.w = b->current.w;
e_border_raise(b);
e_window_show(win);
return b;
@@ -1632,7 +1636,10 @@ e_border_adjust_limits(E_Border *b)
{
int w, h, pl, pr, pt, pb, mx, my;
- if (b->mode.move) e_resist_border(b);
+ if (b->mode.move)
+ {
+ e_resist_border(b);
+ }
else
{
b->current.x = b->current.requested.x;
@@ -1642,8 +1649,8 @@ e_border_adjust_limits(E_Border *b)
b->current.w = b->current.requested.w;
b->current.h = b->current.requested.h - b->current.shaded;
- if (!b->current.shaded)
- {
+ if ((!b->current.shaded) && (!b->mode.move))
+ {
if (b->current.w < 1) b->current.w = 1;
if (b->current.h < 1) b->current.h = 1;
diff --git a/src/desktops.c b/src/desktops.c
index 2253f0a0f..4f92a70ab 100644
--- a/src/desktops.c
+++ b/src/desktops.c
@@ -6,315 +6,15 @@ static int screen_w, screen_h;
static int current_desk = 0;
static void e_idle(void *data);
-static void e_key_down(Eevent * ev);
-static void e_key_up(Eevent * ev);
-static void e_mouse_down(Eevent * ev);
-static void e_mouse_up(Eevent * ev);
-static void e_mouse_in(Eevent * ev);
-static void e_mouse_out(Eevent * ev);
-static void e_window_expose(Eevent * ev);
static void
e_idle(void *data)
{
- Evas_List l;
-
- for (l = desktops; l; l = l->next)
- {
- E_Desktop *desk;
-
- desk = l->data;
- e_desktops_update(desk);
- }
e_db_flush();
return;
UN(data);
}
-/* handling key down events */
-static void
-e_key_down(Eevent * ev)
-{
- Ev_Key_Down *e;
-
- e = ev->event;
- {
- Evas_List l;
-
- for (l = desktops; l; l = l->next)
- {
- E_Desktop *desk;
-
- desk = l->data;
-
- if (desk->win.desk == e->win)
- {
- if (!strcmp(e->key, "Up"))
- {
- }
- else if (!strcmp(e->key, "Down"))
- {
- }
- else if (!strcmp(e->key, "Left"))
- {
- }
- else if (!strcmp(e->key, "Right"))
- {
- }
- else if (!strcmp(e->key, "Escape"))
- {
- }
- else
- {
- /* infact we should pass this onto the view handling */
- /* this desktop here */
- char *type;
-
- type = e_key_press_translate_into_typeable(e);
- if (type)
- {
- }
- }
- }
- }
- }
-}
-
-/* handling key up events */
-static void
-e_key_up(Eevent * ev)
-{
- Ev_Key_Up *e;
-
- e = ev->event;
- {
- Evas_List l;
-
- for (l = desktops; l; l = l->next)
- {
- E_Desktop *desk;
-
- desk = l->data;
-
- if (desk->win.desk == e->win)
- {
- }
- }
- }
-}
-
-/* handling mouse down events */
-static void
-e_mouse_down(Eevent * ev)
-{
- Ev_Mouse_Down *e;
-
- e = ev->event;
- {
- Evas_List l;
-
- for (l = desktops; l; l = l->next)
- {
- E_Desktop *desk;
-
- desk = l->data;
-
- if (desk->win.desk == e->win)
- {
- Evas evas;
- int x, y;
-
- evas = desk->evas.desk;
- e_window_get_root_relative_location(evas_get_window(evas),
- &x, &y);
- x = e->rx - x;
- y = e->ry - y;
- evas_event_button_down(evas, x, y, e->button);
- if (e->button == 1)
- {
- static E_Build_Menu *buildmenu = NULL;
-
- if (!buildmenu)
- {
- char *apps_menu_db;
-
- apps_menu_db = e_config_get("apps_menu");
- if (apps_menu_db) buildmenu = e_build_menu_new_from_db(apps_menu_db);
- }
- if (buildmenu)
- {
- static E_Menu *menu = NULL;
- menu = buildmenu->menu;
- if (menu)
- e_menu_show_at_mouse(menu, e->rx, e->ry, e->time);
- }
- }
- return;
- }
- }
- }
-}
-
-/* handling mouse up events */
-static void
-e_mouse_up(Eevent * ev)
-{
- Ev_Mouse_Up *e;
-
- e = ev->event;
- {
- Evas_List l;
-
- for (l = desktops; l; l = l->next)
- {
- E_Desktop *desk;
-
- desk = l->data;
-
- if (desk->win.desk == e->win)
- {
- Evas evas;
- int x, y;
-
- evas = desk->evas.desk;
- e_window_get_root_relative_location(evas_get_window(evas),
- &x, &y);
- x = e->rx - x;
- y = e->ry - y;
- evas_event_button_up(evas, x, y, e->button);
- return;
- }
- }
- }
-}
-
-/* handling mouse move events */
-static void
-e_mouse_move(Eevent * ev)
-{
- Ev_Mouse_Move *e;
-
- e = ev->event;
- {
- Evas_List l;
-
- for (l = desktops; l; l = l->next)
- {
- E_Desktop *desk;
-
- desk = l->data;
-
- if (desk->win.desk == e->win)
- {
- Evas evas;
- int x, y;
-
- evas = desk->evas.desk;
- e_window_get_root_relative_location(evas_get_window(evas),
- &x, &y);
- x = e->rx - x;
- y = e->ry - y;
- evas_event_move(evas, x, y);
- return;
- }
- }
- }
-}
-
-/* handling mouse enter events */
-static void
-e_mouse_in(Eevent * ev)
-{
- Ev_Window_Enter *e;
-
- e = ev->event;
- {
- Evas_List l;
-
- for (l = desktops; l; l = l->next)
- {
- E_Desktop *desk;
-
- desk = l->data;
-
- if (desk->win.desk == e->win)
- {
- Evas evas;
- int x, y;
-
- /* focus handling for desktop */
- e_focus_to_window(e->win);
- evas = desk->evas.desk;
- e_window_get_root_relative_location(evas_get_window(evas),
- &x, &y);
- x = e->rx - x;
- y = e->ry - y;
- evas_event_move(evas, x, y);
- evas_event_enter(evas);
- return;
- }
- }
- }
-}
-
-/* handling mouse leave events */
-static void
-e_mouse_out(Eevent * ev)
-{
- Ev_Window_Leave *e;
-
- e = ev->event;
- {
- Evas_List l;
-
- for (l = desktops; l; l = l->next)
- {
- E_Desktop *desk;
-
- desk = l->data;
-
- if (desk->win.desk == e->win)
- {
- Evas evas;
- int x, y;
-
- evas = desk->evas.desk;
- e_window_get_root_relative_location(evas_get_window(evas),
- &x, &y);
- x = e->rx - x;
- y = e->ry - y;
- evas_event_move(evas, x, y);
- evas_event_leave(evas);
- return;
- }
- }
- }
-}
-
-/* handling expose events */
-static void
-e_window_expose(Eevent * ev)
-{
- Ev_Window_Expose *e;
-
- e = ev->event;
- {
- Evas_List l;
-
- for (l = desktops; l; l = l->next)
- {
- E_Desktop *desk;
-
- desk = l->data;
- if (!desk->evas.pmap)
- {
- if (evas_get_window(desk->evas.desk) == e->win)
- evas_update_rect(desk->evas.desk, e->x, e->y, e->w, e->h);
- }
- }
- }
-}
-
void
e_desktops_init(void)
{
@@ -325,14 +25,6 @@ e_desktops_init(void)
e_window_show(e_base_win);
desk = e_desktops_new();
e_desktops_show(desk);
- e_event_filter_handler_add(EV_MOUSE_DOWN, e_mouse_down);
- e_event_filter_handler_add(EV_MOUSE_UP, e_mouse_up);
- e_event_filter_handler_add(EV_MOUSE_MOVE, e_mouse_move);
- e_event_filter_handler_add(EV_MOUSE_IN, e_mouse_in);
- e_event_filter_handler_add(EV_MOUSE_OUT, e_mouse_out);
- e_event_filter_handler_add(EV_WINDOW_EXPOSE, e_window_expose);
- e_event_filter_handler_add(EV_KEY_DOWN, e_key_down);
- e_event_filter_handler_add(EV_KEY_UP, e_key_up);
e_event_filter_idle_handler_add(e_idle, NULL);
e_icccm_advertise_e_compat();
@@ -459,7 +151,6 @@ e_desktops_free(E_Desktop *desk)
}
}
e_window_destroy(desk->win.main);
- if (desk->evas.pmap) e_pixmap_free(desk->evas.pmap);
IF_FREE(desk->name);
IF_FREE(desk->dir);
FREE(desk);
@@ -468,47 +159,20 @@ e_desktops_free(E_Desktop *desk)
void
e_desktops_init_file_display(E_Desktop *desk)
{
- int max_colors = 216;
- int font_cache = 1024 * 1024;
- int image_cache = 8192 * 1024;
- char *font_dir;
-
- font_dir = e_config_get("fonts");
- /* software */
- desk->evas.desk = evas_new_all(e_display_get(),
- desk->win.container,
- 0, 0, screen_w, screen_h,
- RENDER_METHOD_ALPHA_SOFTWARE,
- max_colors,
- font_cache,
- image_cache,
- font_dir);
- desk->win.desk = evas_get_window(desk->evas.desk);
- e_add_child(desk->win.container, desk->win.desk);
- /* pixmap backing for desktop */
- desk->evas.pmap = e_pixmap_new(desk->win.desk, screen_w, screen_h, 0);
- evas_set_output(desk->evas.desk, e_display_get(), desk->evas.pmap,
- evas_get_visual(desk->evas.desk), evas_get_colormap(desk->evas.desk));
- e_window_set_background_pixmap(desk->win.desk, desk->evas.pmap);
- /* normal stuff */
- e_window_set_events(desk->win.desk, XEV_EXPOSE | XEV_MOUSE_MOVE | XEV_BUTTON | XEV_IN_OUT | XEV_KEY);
+ desk->view = e_view_new();
+ desk->view->size.w = desk->real.w;
+ desk->view->size.h = desk->real.h;
+ desk->view->bg = e_background_new();
+ desk->view->bg->image = strdup(PACKAGE_DATA_DIR"/data/images/bg.jpg");
+ /* fixme later */
+ /* uncomment this and comment out the next line for some tress testing */
+/* desk->view->dir = strdup("/dev");*/
+ desk->view->dir = strdup(e_file_home());
+ e_view_realize(desk->view);
+ if (desk->view->options.back_pixmap) e_view_update(desk->view);
+ desk->win.desk = desk->view->win.base;
+ e_window_reparent(desk->win.desk, desk->win.container, 0, 0);
e_window_show(desk->win.desk);
- {
- Evas_Object o;
- Evas e;
- char buf[4096];
-
- e = desk->evas.desk;
- sprintf(buf, "%sbg.png", e_config_get("images"));
- o = evas_add_image_from_file(e, buf);
- evas_move(e, o, 0, 0);
- evas_resize(e, o, screen_w, screen_h);
- evas_show(e, o);
- sprintf(buf, "%se_logo.png", e_config_get("images"));
- o = evas_add_image_from_file(e, buf);
- evas_move(e, o, 0, 0);
- evas_show(e, o);
- }
}
E_Desktop *
@@ -565,13 +229,13 @@ e_desktops_delete(E_Desktop *d)
void
e_desktops_show(E_Desktop *d)
{
- e_desktops_update(d);
e_window_show(d->win.main);
}
void
e_desktops_hide(E_Desktop *d)
{
+ if (d->view->options.back_pixmap) e_view_update(d->view);
e_window_hide(d->win.main);
}
@@ -603,28 +267,3 @@ e_desktops_get_current(void)
{
return current_desk;
}
-
-void
-e_desktops_update(E_Desktop *desk)
-{
- Imlib_Updates up;
-
- up = evas_render_updates(desk->evas.desk);
- if (up)
- {
- Imlib_Updates u;
-
- for (u = up; u; u = imlib_updates_get_next(u))
- {
- int x, y, w, h;
-
- imlib_updates_get_coordinates(u, &x, &y, &w, &h);
- e_window_clear_area(desk->win.desk, x, y, w, h);
- }
- imlib_updates_free(up);
- }
- if (desk->changed)
- {
- desk->changed = 0;
- }
-}
diff --git a/src/e.h b/src/e.h
index a5ee21aff..7d20873ee 100644
--- a/src/e.h
+++ b/src/e.h
@@ -132,6 +132,7 @@ typedef struct _E_Rect E_Rect;
typedef struct _E_Active_Action_Timer E_Active_Action_Timer;
typedef struct _E_View E_View;
typedef struct _E_Icon E_Icon;
+typedef struct _E_Background E_Background;
typedef struct _E_Menu E_Menu;
typedef struct _E_Menu_Item E_Menu_Item;
typedef struct _E_Build_Menu E_Build_Menu;
@@ -279,10 +280,7 @@ struct _E_Desktop
Window container;
Window desk;
} win;
- struct {
- Pixmap pmap;
- Evas desk;
- } evas;
+ E_View *view;
int x, y;
struct {
int w, h;
@@ -307,7 +305,7 @@ struct _E_View
{
OBJ_PROPERTIES;
- char *directory;
+ char *dir;
struct {
Evas_Render_Method render_method;
@@ -330,10 +328,21 @@ struct _E_View
int x, y;
} location;
struct {
+ Evas_Object obj_rect;
+ Evas_Object obj_l1;
+ Evas_Object obj_l2;
+ Evas_Object obj_l3;
+ Evas_Object obj_l4;
int on;
+ int start_x, start_y;
int x, y, w, h;
} selection;
+ E_Background *bg;
+
+ int is_listing;
+ int monitor_id;
+
Evas_List icons;
int changed;
@@ -344,9 +353,9 @@ struct _E_Icon
OBJ_PROPERTIES;
char *file;
- char *dir;
E_View *view;
+
int x, y, w, h;
struct {
int text_location;
@@ -363,13 +372,30 @@ struct _E_Icon
Ebits_Object base_text;
} obj;
struct {
- int clicked;
- int selected;
- int hilited;
+ int clicked;
+ int selected;
+ int hilited;
} state;
+ char *icon;
+ int visible;
int changed;
};
+struct _E_Background
+{
+ OBJ_PROPERTIES;
+
+ Evas evas;
+ struct {
+ int sx, sy;
+ int w, h;
+ } geom;
+
+ /* FIXME: REALLY boring for now - just a scaled image - temporoary */
+ char *image;
+ Evas_Object obj;
+};
+
struct _E_Menu
{
OBJ_PROPERTIES;
@@ -548,7 +574,10 @@ int e_file_is_dir(char *file);
char *e_file_home(void);
int e_file_mkdir(char *dir);
int e_file_cp(char *src, char *dst);
-
+char *e_file_real(char *file);
+char *e_file_get_file(char *file);
+char *e_file_get_dir(char *file);
+
void e_exec_set_args(int argc, char **argv);
void e_exec_restart(void);
pid_t e_exec_run(char *exe);
@@ -604,3 +633,5 @@ E_Build_Menu *e_build_menu_new_from_db(char *file);
void e_fs_add_event_handler(void (*func) (EfsdEvent *ev));
void e_fs_init(void);
+EfsdConnection *e_fs_get_connection(void);
+
diff --git a/src/fs.c b/src/fs.c
index 9a0811f7f..bc50c5602 100644
--- a/src/fs.c
+++ b/src/fs.c
@@ -9,22 +9,55 @@ static void
_e_fs_fd_handle(int fd)
{
EfsdEvent ev;
+ int i = 1;
- #if 0 /* WE REALLY need NON BLOCKING comms with efsd! cK!!!!! */
- while (efsd_read_event(ec->fd, &ev) >= 0)
+ /* VERY nasty - sicne efas has no way of checkign If an event is in the */
+ /* event queue waiting to be picked up - i cant loop and get the events */
+ printf("_e_fs_fd_handle(%i)\n", fd);
+ while (i >= 0)
{
- Evas_List l;
+ fd_set fdset;
+ struct timeval tv;
- for (l = fs_handlers; l; l = l->next)
+ FD_ZERO(&fdset);
+ FD_SET(fd, &fdset);
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+ select(fd + 1, &fdset, NULL, NULL, &tv);
+ if (FD_ISSET(fd, &fdset))
{
- void (*func) (EfsdEvent *ev);
-
- func = l->data;
- func(&ev);
+ i = efsd_next_event(ec, &ev);
+ if (i < 0)
+ {
+ efsd_close(ec);
+ e_del_event_fd(fd);
+ /* FIXME: need to queue a popup dialog here saying */
+ /* efsd went wonky */
+ printf("EEEEEEEEEEK efsd went wonky\n");
+/*
+ ec = efsd_open();
+ if (ec)
+ e_add_event_fd(efsd_get_connection_fd(ec),
+ _e_fs_fd_handle);
+*/
+ }
+ if (i >= 0)
+ {
+ Evas_List l;
+
+ for (l = fs_handlers; l; l = l->next)
+ {
+ void (*func) (EfsdEvent *ev);
+
+ func = l->data;
+ func(&ev);
+ }
+ efsd_cleanup_event(&ev);
+ }
}
- efsd_cleanup_event(&ev);
+ else
+ i = -1;
}
- #endif
}
void
@@ -50,16 +83,32 @@ e_fs_init(void)
{
ec = efsd_open();
sleep(1);
- if (i > 8) break;
+ /* > than 4 seconds later efsd isnt there... try forced start */
+ if (i > 4)
+ {
+ e_exec_run("efsd --forcestart");
+ for (i = 0; (!ec); i++)
+ {
+ ec = efsd_open();
+ sleep(1);
+ /* > 4 seconds later forced efsd not alive - give up */
+ if (i > 4) break;
+ }
+ break;
+ }
}
}
+ /* after several atempts to talk to efsd - lets give up */
if (!ec)
{
fprintf(stderr, "efsd is not running - please run efsd.\n");
exit(-1);
}
e_add_event_fd(efsd_get_connection_fd(ec), _e_fs_fd_handle);
-
- /* HACK FIXME: testing.... */
- efsd_start_monitor(ec, getenv("HOME"));
+}
+
+EfsdConnection *
+e_fs_get_connection(void)
+{
+ return ec;
}
diff --git a/src/icons.c b/src/icons.c
index b0d03ccb9..8579f46cd 100644
--- a/src/icons.c
+++ b/src/icons.c
@@ -22,3 +22,33 @@ e_icon_calulcate_geometry(E_Icon *icon)
{
if (!icon->view) return;
}
+
+void
+e_icon_realize(E_Icon *icon)
+{
+ int fx, fy;
+ int iw, ih;
+ double tw, th;
+
+ icon->obj.icon = evas_add_image_from_file(icon->view->evas, icon->icon);
+ icon->obj.filename = evas_add_text(icon->view->evas, "borzoib", 8, icon->file);
+ evas_get_geometry(icon->view->evas, icon->obj.filename, NULL, NULL, &tw, &th);
+ evas_get_image_size(icon->view->evas, icon->obj.icon, & iw, &ih);
+ evas_set_color(icon->view->evas, icon->obj.filename, 0, 0, 0, 255);
+ fx = icon->x + ((iw - tw) / 2);
+ fy = icon->y + ih;
+ evas_set_layer(icon->view->evas, icon->obj.icon, 10);
+ evas_set_layer(icon->view->evas, icon->obj.filename, 10);
+ evas_move(icon->view->evas, icon->obj.icon, icon->x, icon->y);
+ evas_move(icon->view->evas, icon->obj.filename, fx, fy);
+ if (icon->visible)
+ {
+ evas_show(icon->view->evas, icon->obj.icon);
+ evas_show(icon->view->evas, icon->obj.filename);
+ }
+}
+
+void
+e_icon_unrealize(E_Icon *icon)
+{
+}
diff --git a/src/main.c b/src/main.c
index 7e5a2c5aa..b96dc897a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -47,11 +47,11 @@ main(int argc, char **argv)
e_event_filter_init();
e_ev_x_init();
+ e_fs_init();
e_desktops_init();
e_border_init();
e_actions_init();
e_menu_init();
- /* e_fs_init(); */
e_view_init();
setup();
diff --git a/src/menu.c b/src/menu.c
index ecc63e4ec..f7aaaaec8 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -39,6 +39,7 @@ e_scroller_timer(int val, void *data)
scroll_speed = (int)(((t - last_time) / 0.02) * (double)scroll_speed);
last_time = t;
+ ok = 0;
if (mouse_x >= (screen_w - resist))
{
int scroll = 0;
@@ -49,10 +50,7 @@ e_scroller_timer(int val, void *data)
m = l->data;
if ((m->current.x + m->current.w) > screen_w)
- {
- scroll = m->current.x + m->current.w - screen_w;
- break;
- }
+ scroll = m->current.x + m->current.w - screen_w;
}
if (scroll)
{
@@ -71,10 +69,7 @@ e_scroller_timer(int val, void *data)
m = l->data;
if (m->current.x < 0)
- {
- scroll = -m->current.x;
- break;
- }
+ scroll = -m->current.x;
}
if (scroll)
{
@@ -93,10 +88,7 @@ e_scroller_timer(int val, void *data)
m = l->data;
if ((m->current.y + m->current.h) > screen_h)
- {
- scroll = m->current.y + m->current.h - screen_h;
- break;
- }
+ scroll = m->current.y + m->current.h - screen_h;
}
if (scroll)
{
@@ -115,10 +107,7 @@ e_scroller_timer(int val, void *data)
m = l->data;
if (m->current.y < 0)
- {
- scroll = -m->current.y;
- break;
- }
+ scroll = -m->current.y;
}
if (scroll)
{
@@ -127,7 +116,7 @@ e_scroller_timer(int val, void *data)
ok = 1;
}
}
- if (ok)
+ if ((ok) && (open_menus))
e_add_event_timer("menu_scroller", 0.02, e_scroller_timer, val + 1, NULL);
return;
UN(data);
@@ -208,7 +197,11 @@ e_key_down(Eevent * ev)
E_Menu *m;
m = l->data;
- if ((e->win == m->win.main) || (e->win == m->win.evas)) ok = 1;
+ if ((e->win == m->win.main) || (e->win == m->win.evas))
+ {
+ ok = 1;
+ break;
+ }
}
}
if (ok)
@@ -223,6 +216,7 @@ e_key_down(Eevent * ev)
if (m->selected)
{
mi = m->selected;
+ break;
}
}
if (!strcmp(e->key, "Up"))
@@ -446,6 +440,7 @@ e_window_expose(Eevent * ev)
{
m->first_expose = 1;
evas_update_rect(m->evas, e->x, e->y, e->w, e->h);
+ break;
}
}
}
diff --git a/src/util.c b/src/util.c
index 20c2596b5..952da38af 100644
--- a/src/util.c
+++ b/src/util.c
@@ -78,3 +78,36 @@ e_file_cp(char *src, char *dst)
fclose(f2);
return 1;
}
+
+char *
+e_file_real(char *file)
+{
+ char buf[4096];
+
+ if (!realpath(file, buf)) return strdup("");
+ return strdup(buf);
+}
+
+char *
+e_file_get_file(char *file)
+{
+ char *p;
+ char buf[4096];
+
+ p = strchr(file, '/');
+ if (!p) return strdup(file);
+ return strdup(&(p[1]));
+}
+
+char *
+e_file_get_dir(char *file)
+{
+ char *p;
+ char buf[4096];
+
+ strcpy(buf, file);
+ p = strchr(buf, '/');
+ if (!p) return strdup(file);
+ *p = 0;
+ return strdup(buf);
+}
diff --git a/src/view.c b/src/view.c
index da602062a..bbcb61d60 100644
--- a/src/view.c
+++ b/src/view.c
@@ -12,12 +12,14 @@ static void e_mouse_move(Eevent * ev);
static void e_mouse_in(Eevent * ev);
static void e_mouse_out(Eevent * ev);
static void e_window_expose(Eevent * ev);
+static void e_view_handle_fs(EfsdEvent *ev);
static void
e_idle(void *data)
{
Evas_List l;
-
+
+ printf("view idle.\n");
for (l = views; l; l = l->next)
{
E_View *v;
@@ -83,6 +85,7 @@ e_key_down(Eevent * ev)
{
}
}
+ return;
}
}
}
@@ -94,6 +97,7 @@ e_key_up(Eevent * ev)
Evas_List l;
e = ev->event;
+ return;
for (l = views; l; l = l->next)
{
E_View *v;
@@ -116,7 +120,40 @@ e_mouse_down(Eevent * ev)
v = l->data;
if (e->win == v->win.main)
{
+ /* FIXME: */
+ /* normally would handle selection in evasa object callbacks */
+ /* but for now it's handled here */
+ if (e->button == 1)
+ {
+ v->selection.on = 1;
+ v->selection.start_x = e->x;
+ v->selection.start_y = e->y;
+ v->selection.x = e->x;
+ v->selection.y = e->y;
+ v->selection.w = 1;
+ v->selection.h = 1;
+ if (!v->selection.obj_rect)
+ {
+ v->selection.obj_rect = evas_add_rectangle(v->evas);
+ v->selection.obj_l1 = evas_add_line(v->evas);
+ v->selection.obj_l2 = evas_add_line(v->evas);
+ v->selection.obj_l3 = evas_add_line(v->evas);
+ v->selection.obj_l4 = evas_add_line(v->evas);
+ evas_set_color(v->evas, v->selection.obj_rect, 255, 255, 255, 100);
+ evas_set_color(v->evas, v->selection.obj_l1, 0, 0, 0, 200);
+ evas_set_color(v->evas, v->selection.obj_l2, 0, 0, 0, 200);
+ evas_set_color(v->evas, v->selection.obj_l3, 0, 0, 0, 200);
+ evas_set_color(v->evas, v->selection.obj_l4, 0, 0, 0, 200);
+ evas_set_layer(v->evas, v->selection.obj_rect, 100);
+ evas_set_layer(v->evas, v->selection.obj_l1, 100);
+ evas_set_layer(v->evas, v->selection.obj_l2, 100);
+ evas_set_layer(v->evas, v->selection.obj_l3, 100);
+ evas_set_layer(v->evas, v->selection.obj_l4, 100);
+ }
+ e_view_update_selection(v, e->x, e->y);
+ }
evas_event_button_down(v->evas, e->x, e->y, e->button);
+ return;
}
}
}
@@ -135,6 +172,54 @@ e_mouse_up(Eevent * ev)
v = l->data;
if (e->win == v->win.main)
{
+ /* FIXME: temporary for now- should only do this if its a deskop */
+ /* view and desktops accept focus on click. */
+ /* e_focus_to_window(e->win); */
+ if ((v->selection.w < 6) && (v->selection.h < 6))
+ {
+ if (e->button == 1)
+ {
+ static E_Build_Menu *buildmenu = NULL;
+
+ if (!buildmenu)
+ {
+ char *apps_menu_db;
+
+ apps_menu_db = e_config_get("apps_menu");
+ if (apps_menu_db) buildmenu = e_build_menu_new_from_db(apps_menu_db);
+ }
+ if (buildmenu)
+ {
+ static E_Menu *menu = NULL;
+ menu = buildmenu->menu;
+ if (menu)
+ e_menu_show_at_mouse(menu, e->rx, e->ry, e->time);
+ }
+ }
+ else if (e->button == 3)
+ {
+ static E_Menu *menu = NULL;
+
+ if (!menu)
+ {
+ E_Menu_Item *menuitem;
+
+ menu = e_menu_new();
+ menu->pad.icon = 2;
+ menu->pad.state = 2;
+ menuitem = e_menu_item_new("Enlightenment "VERSION);
+ menuitem->icon = strdup(PACKAGE_DATA_DIR"/data/images/e_logo.png");
+ e_menu_add_item(menu, menuitem);
+ }
+ if (menu)
+ e_menu_show_at_mouse(menu, e->rx, e->ry, e->time);
+ }
+ }
+ if (e->button == 1)
+ {
+ v->selection.on = 0;
+ e_view_update_selection(v, e->x, e->y);
+ }
evas_event_button_up(v->evas, e->x, e->y, e->button);
}
}
@@ -154,7 +239,9 @@ e_mouse_move(Eevent * ev)
v = l->data;
if (e->win == v->win.main)
{
+ e_view_update_selection(v, e->x, e->y);
evas_event_move(v->evas, e->x, e->y);
+ return;
}
}
}
@@ -173,7 +260,11 @@ e_mouse_in(Eevent * ev)
v = l->data;
if (e->win == v->win.main)
{
+ /* FIXME: temporary for now- should only do this if its a deskop */
+ /* view and desktops accept focus on mouse. */
+ e_focus_to_window(e->win);
evas_event_enter(v->evas);
+ return;
}
}
}
@@ -193,6 +284,7 @@ e_mouse_out(Eevent * ev)
if (e->win == v->win.main)
{
evas_event_leave(v->evas);
+ return;
}
}
}
@@ -212,11 +304,198 @@ e_window_expose(Eevent * ev)
if (e->win == v->win.main)
{
if (!(v->pmap))
- evas_update_rect(v->evas, e->x, e->y, e->w, e->h);
+ evas_update_rect(v->evas, e->x, e->y, e->w, e->h);
+ v->changed = 1;
+ return;
}
}
}
+int
+e_view_filter_file(E_View *v, char *file)
+{
+ if (file[0] == '.') return 0;
+ return 1;
+}
+
+void
+e_view_update_selection(E_View *v, int x, int y)
+{
+ if (v->selection.on)
+ {
+ if (x < v->selection.start_x)
+ {
+ v->selection.w = (-(x - v->selection.start_x)) + 1;
+ v->selection.x = x;
+ }
+ else
+ {
+ v->selection.w = (x - v->selection.start_x) + 1;
+ v->selection.x = v->selection.start_x;
+ }
+ if (y < v->selection.start_y)
+ {
+ v->selection.h = (-(y - v->selection.start_y)) + 1;
+ v->selection.y = y;
+ }
+ else
+ {
+ v->selection.h = (y - v->selection.start_y) + 1;
+ v->selection.y = v->selection.start_y;
+ }
+ evas_move(v->evas, v->selection.obj_rect, v->selection.x, v->selection.y);
+ evas_resize(v->evas, v->selection.obj_rect, v->selection.w, v->selection.h);
+ evas_set_line_xy(v->evas, v->selection.obj_l1, v->selection.x, v->selection.y, v->selection.x + v->selection.w - 1, v->selection.y);
+ evas_set_line_xy(v->evas, v->selection.obj_l2, v->selection.x, v->selection.y, v->selection.x, v->selection.y + v->selection.h - 1);
+ evas_set_line_xy(v->evas, v->selection.obj_l3, v->selection.x, v->selection.y + v->selection.h - 1, v->selection.x + v->selection.w - 1, v->selection.y + v->selection.h - 1);
+ evas_set_line_xy(v->evas, v->selection.obj_l4, v->selection.x + v->selection.w - 1, v->selection.y, v->selection.x + v->selection.w - 1, v->selection.y + v->selection.h - 1);
+ evas_show(v->evas, v->selection.obj_rect);
+ evas_show(v->evas, v->selection.obj_l1);
+ evas_show(v->evas, v->selection.obj_l2);
+ evas_show(v->evas, v->selection.obj_l3);
+ evas_show(v->evas, v->selection.obj_l4);
+ }
+ else
+ {
+ evas_hide(v->evas, v->selection.obj_rect);
+ evas_hide(v->evas, v->selection.obj_l1);
+ evas_hide(v->evas, v->selection.obj_l2);
+ evas_hide(v->evas, v->selection.obj_l3);
+ evas_hide(v->evas, v->selection.obj_l4);
+ }
+}
+
+void
+e_view_file_added(int id, char *file)
+{
+ E_Icon *icon;
+ E_View *v;
+ char *realfile;
+ char buf[4096];
+
+ /* if we get a path - ignore it - its not a file in the a dir */
+ printf("e_view_file_added(%i, \"%s\");\n", id, file);
+ if (!file) return;
+ if (file[0] == '/') return;
+ v = e_view_find_by_monitor_id(id);
+ if (!v) return;
+ /* filter files here */
+ if (!e_view_filter_file(v, file)) return;
+ icon = e_icon_new();
+ icon->file = strdup(file);
+ icon->x = rand()%(v->size.w - 60);
+ icon->y = rand()%(v->size.h - 60);
+ icon->changed = 1;
+ icon->visible = 1;
+ icon->icon = strdup(PACKAGE_DATA_DIR"/data/icons/file/default.db:/icon/normal");
+ e_view_add_icon(v, icon);
+ v->changed = 1;
+}
+
+void
+e_view_file_deleted(int id, char *file)
+{
+ E_Icon *icon;
+ E_View *v;
+ char *realfile;
+
+ printf("e_view_file_deleted(%i, \"%s\");\n", id, file);
+ v = e_view_find_by_monitor_id(id);
+ if (!v) return;
+}
+
+static void
+e_view_handle_fs(EfsdEvent *ev)
+{
+ switch (ev->type)
+ {
+ case FILECHANGE:
+ switch (ev->efsd_filechange_event.changecode)
+ {
+ case FAMCreated:
+ e_view_file_added(ev->efsd_filechange_event.id,
+ ev->efsd_filechange_event.file);
+ break;
+ case FAMExists:
+ e_view_file_added(ev->efsd_filechange_event.id,
+ ev->efsd_filechange_event.file);
+ break;
+ case FAMDeleted:
+ e_view_file_deleted(ev->efsd_filechange_event.id,
+ ev->efsd_filechange_event.file);
+ break;
+ case FAMChanged:
+ printf("FAMChanged: %i %s\n",
+ ev->efsd_filechange_event.id,
+ ev->efsd_filechange_event.file);
+ break;
+ case FAMMoved:
+ printf("FAMMoved: %i %s\n",
+ ev->efsd_filechange_event.id,
+ ev->efsd_filechange_event.file);
+ break;
+ case FAMEndExist:
+ printf("FAMEndExist: %i %s\n",
+ ev->efsd_filechange_event.id,
+ ev->efsd_filechange_event.file);
+ break;
+ default:
+ break;
+ }
+ break;
+ case REPLY:
+ switch (ev->efsd_reply_event.command.type)
+ {
+ case REMOVE:
+ break;
+ case MOVE:
+ break;
+ case SYMLINK:
+ break;
+ case LISTDIR:
+ break;
+ case MAKEDIR:
+ break;
+ case CHMOD:
+ break;
+ case STAT:
+ break;
+ case CLOSE:
+ break;
+ case SETMETA:
+ break;
+ case GETMETA:
+ break;
+ case STARTMON:
+ printf("Startmon event %i\n",
+ ev->efsd_reply_event.command.efsd_file_cmd.id);
+ break;
+ case STOPMON:
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+E_View *
+e_view_find_by_monitor_id(int id)
+{
+ Evas_List l;
+
+ for (l = views; l; l = l->next)
+ {
+ E_View *v;
+
+ v = l->data;
+ if (v->monitor_id == id) return v;
+ }
+ return NULL;
+}
+
void
e_view_free(E_View *v)
{
@@ -232,10 +511,15 @@ e_view_new(void)
v = NEW(E_View, 1);
ZERO(v, E_View, 1);
OBJ_INIT(v, e_view_free);
-
+
+#if 1
+ /* ONLY alpha software can be "backing stored" */
v->options.render_method = RENDER_METHOD_ALPHA_SOFTWARE;
v->options.back_pixmap = 1;
-
+#else
+ v->options.render_method = RENDER_METHOD_BASIC_HARDWARE;
+ v->options.back_pixmap = 0;
+#endif
views = evas_list_append(views, v);
return v;
}
@@ -250,32 +534,12 @@ void
e_view_set_dir(E_View *v, char *dir)
{
/* stop monitoring old dir */
- IF_FREE(v->directory);
- v->directory = strdup(dir);
+ IF_FREE(v->dir);
+ v->dir = e_file_real(dir);
/* start monitoring new dir */
-
- {
- /* bad hack- lets just add some dummy stuff for testing */
- int i;
- char *files[8] = {
- "The first file",
- "Some more things",
- "K is a FISH!",
- "Possum Eyes",
- "Nasty Bums",
- "BLUMFRUB!",
- "Oh lookie here now!",
- "Last one...."
- };
- for (i = 0; i < 8; i++)
- {
- E_Icon *icon;
-
- icon = e_icon_new();
- icon->file = strdup(files[i]);
- e_view_add_icon(v, icon);
- }
- }
+ v->monitor_id = efsd_start_monitor(e_fs_get_connection(), v->dir);
+ printf("%i %s\n", v->monitor_id, v->dir);
+ v->is_listing = 1;
v->changed = 1;
}
@@ -290,7 +554,7 @@ e_view_add_icon(E_View *v, E_Icon *icon)
{
if (icon->view) return;
icon->view = v;
- icon->changed = 1;
+ e_icon_realize(icon);
v->changed = 1;
}
@@ -298,6 +562,7 @@ void
e_view_del_icon(E_View *v, E_Icon *icon)
{
if (!icon->view) return;
+ e_icon_unrealize(icon);
icon->view = NULL;
icon->changed = 1;
v->changed = 1;
@@ -334,11 +599,24 @@ e_view_realize(E_View *v)
evas_get_colormap(v->evas));
e_window_set_background_pixmap(v->win.main, v->pmap);
}
+ if (v->bg)
+ {
+ v->bg->geom.w = v->size.w;
+ v->bg->geom.h = v->size.h;
+ e_background_realize(v->bg, v->evas);
+ }
e_window_set_events(v->win.main,
XEV_EXPOSE | XEV_MOUSE_MOVE |
XEV_BUTTON | XEV_IN_OUT | XEV_KEY);
e_window_show(v->win.main);
- e_view_set_dir(v, v->directory);
+ {
+ char *dir;
+
+ dir = v->dir;
+ v->dir = NULL;
+ e_view_set_dir(v, dir);
+ IF_FREE(dir);
+ }
v->changed = 1;
}
@@ -374,7 +652,7 @@ e_view_update(E_View *v)
}
else
evas_render(v->evas);
- v->changed = 0;
+/* v->changed = 0;*/
}
void
@@ -390,4 +668,5 @@ e_view_init(void)
e_event_filter_handler_add(EV_KEY_UP, e_key_up);
e_event_filter_handler_add(EV_MOUSE_WHEEL, e_wheel);
e_event_filter_idle_handler_add(e_idle, NULL);
+ e_fs_add_event_handler(e_view_handle_fs);
}