diff --git a/TODO b/TODO index 7e089c438..80a6d620d 100644 --- a/TODO +++ b/TODO @@ -8,6 +8,16 @@ Some of the things (in very short form) that need to be done to E17... BUGS / FIXES ------------------------------------------------------------------------------- +* shelf autohide uses mouse in/out events for the shelf object. this is not all + good as it conflicts with edge flip for desktops (if shelves slide off the + screen) also it doesn't account for window placement and sizing when the + shelf is hidden so you cant maximize to the now available region when the + shelf hides. i think hiding needs to be done noutside of the theme and by + the shelf itself. e will still emit signals to let the theme do things, but + e will also handle the hide/show based on a unified edge mouse event trap or + trap on the region the shelf would normally be in. also need a way to lock + the gadcon and thus gadcon asks shelf to lock in (stay visible) for things + like popping up menus, popups etc. * shelves seem to get confused with their contents if you have 3 shelves over 2 screens/zones - when you go back to 1 screen form 2, one of the shelves gts the contents from the now non-existant shelf. diff --git a/data/themes/default_shelf.edc b/data/themes/default_shelf.edc index 53097342e..ddb9a0145 100644 --- a/data/themes/default_shelf.edc +++ b/data/themes/default_shelf.edc @@ -15,10 +15,101 @@ group { } parts { part { - name: "base"; + name: "item_clip_bottom"; + type: RECT; mouse_events: 0; description { state: "default" 0.0; + color: 255 255 255 0; + } + description { + state: "hidden" 0.0; + inherit: "default" 0.0; + rel1 { + relative: 0.0 1.0; + offset: 0 -2; + } + rel2 { + relative: 1.0 2.0; + offset: -1 -3; + } + } + } + part { + name: "item_clip_top"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 0; + } + description { + state: "hidden" 0.0; + inherit: "default" 0.0; + rel1 { + relative: 0.0 -1.0; + offset: 0 2; + } + rel2 { + relative: 1.0 0.0; + offset: -1 1; + } + } + } + part { + name: "item_clip_left"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 0; + } + description { + state: "hidden" 0.0; + inherit: "default" 0.0; + rel1 { + relative: -1.0 0.0; + offset: 2 0; + } + rel2 { + relative: 0.0 1.0; + offset: 1 -1; + } + } + } + part { + name: "item_clip_right"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 0; + } + description { + state: "hidden" 0.0; + inherit: "default" 0.0; + rel1 { + relative: 1.0 0.0; + offset: -2 0; + } + rel2 { + relative: 2.0 1.0; + offset: -3 -1; + } + } + } + part { + name: "base"; + mouse_events: 0; +// clip_to: "item_clip"; + description { + state: "default" 0.0; + rel1 { + to: "item_clip_top"; + } + rel2 { + to: "item_clip_top"; + } image { normal: "e17_shelf_bg_h.png"; border: 19 19 9 9; @@ -35,6 +126,12 @@ group { description { state: "top_left" 0.0; inherit: "default" 0.0; + rel1 { + to: "item_clip_top"; + } + rel2 { + to: "item_clip_top"; + } fill { origin { offset: -16 -6; @@ -47,6 +144,12 @@ group { description { state: "top_right" 0.0; inherit: "default" 0.0; + rel1 { + to: "item_clip_top"; + } + rel2 { + to: "item_clip_top"; + } fill { origin { offset: 0 -6; @@ -59,6 +162,12 @@ group { description { state: "bottom" 0.0; inherit: "default" 0.0; + rel1 { + to: "item_clip_bottom"; + } + rel2 { + to: "item_clip_bottom"; + } fill { origin { offset: 0 0; @@ -71,6 +180,12 @@ group { description { state: "bottom_left" 0.0; inherit: "default" 0.0; + rel1 { + to: "item_clip_bottom"; + } + rel2 { + to: "item_clip_bottom"; + } fill { origin { offset: -16 0; @@ -83,6 +198,12 @@ group { description { state: "bottom_right" 0.0; inherit: "default" 0.0; + rel1 { + to: "item_clip_bottom"; + } + rel2 { + to: "item_clip_bottom"; + } fill { origin { offset: 0 0; @@ -94,6 +215,13 @@ group { } description { state: "left" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_left"; + } + rel2 { + to: "item_clip_left"; + } image { normal: "e17_shelf_bg_v.png"; border: 9 9 19 19; @@ -109,6 +237,13 @@ group { } description { state: "left_top" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_left"; + } + rel2 { + to: "item_clip_left"; + } image { normal: "e17_shelf_bg_v.png"; border: 9 9 19 19; @@ -124,6 +259,13 @@ group { } description { state: "left_bottom" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_left"; + } + rel2 { + to: "item_clip_left"; + } image { normal: "e17_shelf_bg_v.png"; border: 9 9 19 19; @@ -139,6 +281,13 @@ group { } description { state: "right" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_right"; + } + rel2 { + to: "item_clip_right"; + } image { normal: "e17_shelf_bg_v.png"; border: 9 9 19 19; @@ -154,6 +303,13 @@ group { } description { state: "right_top" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_right"; + } + rel2 { + to: "item_clip_right"; + } image { normal: "e17_shelf_bg_v.png"; border: 9 9 19 19; @@ -169,6 +325,13 @@ group { } description { state: "right_bottom" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_right"; + } + rel2 { + to: "item_clip_right"; + } image { normal: "e17_shelf_bg_v.png"; border: 9 9 19 19; @@ -187,134 +350,170 @@ group { name: "e.swallow.content"; mouse_events: 0; type: SWALLOW; +// clip_to: "item_clip"; description { state: "default" 0.0; rel1 { + to: "item_clip_top"; relative: 0.0 0.0; offset: 18 2; } rel2 { + to: "item_clip_top"; relative: 1.0 1.0; offset: -19 -3; } } description { state: "top_left" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_top"; relative: 0.0 0.0; offset: 2 2; } rel2 { + to: "item_clip_top"; relative: 1.0 1.0; offset: -19 -3; } } description { state: "top_right" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_top"; relative: 0.0 0.0; offset: 18 2; } rel2 { + to: "item_clip_top"; relative: 1.0 1.0; offset: -3 -3; } } description { state: "bottom" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_bottom"; relative: 0.0 0.0; offset: 18 2; } rel2 { + to: "item_clip_bottom"; relative: 1.0 1.0; offset: -19 -3; } } description { state: "bottom_left" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_bottom"; relative: 0.0 0.0; offset: 2 2; } rel2 { + to: "item_clip_bottom"; relative: 1.0 1.0; offset: -19 -3; } } description { state: "bottom_right" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_bottom"; relative: 0.0 0.0; offset: 18 2; } rel2 { + to: "item_clip_bottom"; relative: 1.0 1.0; offset: -3 -3; } } description { state: "left" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_left"; relative: 0.0 0.0; offset: 2 18; } rel2 { + to: "item_clip_left"; relative: 1.0 1.0; offset: -3 -19; } } description { state: "left_top" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_left"; relative: 0.0 0.0; offset: 2 2; } rel2 { + to: "item_clip_left"; relative: 1.0 1.0; offset: -3 -19; } } description { state: "left_bottom" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_left"; relative: 0.0 0.0; offset: 2 18; } rel2 { + to: "item_clip_left"; relative: 1.0 1.0; offset: -3 -3; } } description { state: "right" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_right"; relative: 0.0 0.0; offset: 2 18; } rel2 { + to: "item_clip_right"; relative: 1.0 1.0; offset: -3 -19; } } description { state: "right_top" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_right"; relative: 0.0 0.0; offset: 2 2; } rel2 { + to: "item_clip_right"; relative: 1.0 1.0; offset: -3 -19; } } description { state: "right_bottom" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_right"; relative: 0.0 0.0; offset: 2 18; } rel2 { + to: "item_clip_right"; relative: 1.0 1.0; offset: -3 -3; } @@ -322,6 +521,28 @@ group { } } programs { + program { + name: "hide"; + signal: "e,state,hidden"; + source: "e"; + action: STATE_SET "hidden" 0.0; + transition: ACCELERATE 0.3; + target: "item_clip_bottom"; + target: "item_clip_top"; + target: "item_clip_left"; + target: "item_clip_right"; + } + program { + name: "show"; + signal: "e,state,visible"; + source: "e"; + transition: DECELERATE 0.3; + action: STATE_SET "default" 0.0; + target: "item_clip_bottom"; + target: "item_clip_top"; + target: "item_clip_left"; + target: "item_clip_right"; + } program { name: "orient1"; signal: "e,state,orientation,top"; @@ -551,6 +772,7 @@ group { + group { @@ -561,10 +783,101 @@ group { } parts { part { - name: "base"; + name: "item_clip_bottom"; + type: RECT; mouse_events: 0; description { state: "default" 0.0; + color: 255 255 255 0; + } + description { + state: "hidden" 0.0; + inherit: "default" 0.0; + rel1 { + relative: 0.0 1.0; + offset: 0 -2; + } + rel2 { + relative: 1.0 2.0; + offset: -1 -3; + } + } + } + part { + name: "item_clip_top"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 0; + } + description { + state: "hidden" 0.0; + inherit: "default" 0.0; + rel1 { + relative: 0.0 -1.0; + offset: 0 2; + } + rel2 { + relative: 1.0 0.0; + offset: -1 1; + } + } + } + part { + name: "item_clip_left"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 0; + } + description { + state: "hidden" 0.0; + inherit: "default" 0.0; + rel1 { + relative: -1.0 0.0; + offset: 2 0; + } + rel2 { + relative: 0.0 1.0; + offset: 1 -1; + } + } + } + part { + name: "item_clip_right"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 0; + } + description { + state: "hidden" 0.0; + inherit: "default" 0.0; + rel1 { + relative: 1.0 0.0; + offset: -2 0; + } + rel2 { + relative: 2.0 1.0; + offset: -3 -1; + } + } + } + part { + name: "base"; + mouse_events: 0; +// clip_to: "item_clip"; + description { + state: "default" 0.0; + rel1 { + to: "item_clip_top"; + } + rel2 { + to: "item_clip_top"; + } image { normal: "e17_shelf_bg2_h.png"; border: 19 19 9 9; @@ -581,6 +894,12 @@ group { description { state: "top_left" 0.0; inherit: "default" 0.0; + rel1 { + to: "item_clip_top"; + } + rel2 { + to: "item_clip_top"; + } fill { origin { offset: -16 -6; @@ -593,6 +912,12 @@ group { description { state: "top_right" 0.0; inherit: "default" 0.0; + rel1 { + to: "item_clip_top"; + } + rel2 { + to: "item_clip_top"; + } fill { origin { offset: 0 -6; @@ -605,6 +930,12 @@ group { description { state: "bottom" 0.0; inherit: "default" 0.0; + rel1 { + to: "item_clip_bottom"; + } + rel2 { + to: "item_clip_bottom"; + } fill { origin { offset: 0 0; @@ -617,6 +948,12 @@ group { description { state: "bottom_left" 0.0; inherit: "default" 0.0; + rel1 { + to: "item_clip_bottom"; + } + rel2 { + to: "item_clip_bottom"; + } fill { origin { offset: -16 0; @@ -629,6 +966,12 @@ group { description { state: "bottom_right" 0.0; inherit: "default" 0.0; + rel1 { + to: "item_clip_bottom"; + } + rel2 { + to: "item_clip_bottom"; + } fill { origin { offset: 0 0; @@ -640,6 +983,13 @@ group { } description { state: "left" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_left"; + } + rel2 { + to: "item_clip_left"; + } image { normal: "e17_shelf_bg2_v.png"; border: 9 9 19 19; @@ -655,6 +1005,13 @@ group { } description { state: "left_top" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_left"; + } + rel2 { + to: "item_clip_left"; + } image { normal: "e17_shelf_bg2_v.png"; border: 9 9 19 19; @@ -670,6 +1027,13 @@ group { } description { state: "left_bottom" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_left"; + } + rel2 { + to: "item_clip_left"; + } image { normal: "e17_shelf_bg2_v.png"; border: 9 9 19 19; @@ -685,6 +1049,13 @@ group { } description { state: "right" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_right"; + } + rel2 { + to: "item_clip_right"; + } image { normal: "e17_shelf_bg2_v.png"; border: 9 9 19 19; @@ -700,6 +1071,13 @@ group { } description { state: "right_top" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_right"; + } + rel2 { + to: "item_clip_right"; + } image { normal: "e17_shelf_bg2_v.png"; border: 9 9 19 19; @@ -715,6 +1093,13 @@ group { } description { state: "right_bottom" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_right"; + } + rel2 { + to: "item_clip_right"; + } image { normal: "e17_shelf_bg2_v.png"; border: 9 9 19 19; @@ -733,134 +1118,170 @@ group { name: "e.swallow.content"; mouse_events: 0; type: SWALLOW; +// clip_to: "item_clip"; description { state: "default" 0.0; rel1 { + to: "item_clip_top"; relative: 0.0 0.0; offset: 18 2; } rel2 { + to: "item_clip_top"; relative: 1.0 1.0; offset: -19 -3; } } description { state: "top_left" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_top"; relative: 0.0 0.0; offset: 2 2; } rel2 { + to: "item_clip_top"; relative: 1.0 1.0; offset: -19 -3; } } description { state: "top_right" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_top"; relative: 0.0 0.0; offset: 18 2; } rel2 { + to: "item_clip_top"; relative: 1.0 1.0; offset: -3 -3; } } description { state: "bottom" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_bottom"; relative: 0.0 0.0; offset: 18 2; } rel2 { + to: "item_clip_bottom"; relative: 1.0 1.0; offset: -19 -3; } } description { state: "bottom_left" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_bottom"; relative: 0.0 0.0; offset: 2 2; } rel2 { + to: "item_clip_bottom"; relative: 1.0 1.0; offset: -19 -3; } } description { state: "bottom_right" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_bottom"; relative: 0.0 0.0; offset: 18 2; } rel2 { + to: "item_clip_bottom"; relative: 1.0 1.0; offset: -3 -3; } } description { state: "left" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_left"; relative: 0.0 0.0; offset: 2 18; } rel2 { + to: "item_clip_left"; relative: 1.0 1.0; offset: -3 -19; } } description { state: "left_top" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_left"; relative: 0.0 0.0; offset: 2 2; } rel2 { + to: "item_clip_left"; relative: 1.0 1.0; offset: -3 -19; } } description { state: "left_bottom" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_left"; relative: 0.0 0.0; offset: 2 18; } rel2 { + to: "item_clip_left"; relative: 1.0 1.0; offset: -3 -3; } } description { state: "right" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_right"; relative: 0.0 0.0; offset: 2 18; } rel2 { + to: "item_clip_right"; relative: 1.0 1.0; offset: -3 -19; } } description { state: "right_top" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_right"; relative: 0.0 0.0; offset: 2 2; } rel2 { + to: "item_clip_right"; relative: 1.0 1.0; offset: -3 -19; } } description { state: "right_bottom" 0.0; + inherit: "default" 0.0; rel1 { + to: "item_clip_right"; relative: 0.0 0.0; offset: 2 18; } rel2 { + to: "item_clip_right"; relative: 1.0 1.0; offset: -3 -3; } @@ -868,6 +1289,28 @@ group { } } programs { + program { + name: "hide"; + signal: "e,state,hidden"; + source: "e"; + action: STATE_SET "hidden" 0.0; + transition: ACCELERATE 0.3; + target: "item_clip_bottom"; + target: "item_clip_top"; + target: "item_clip_left"; + target: "item_clip_right"; + } + program { + name: "show"; + signal: "e,state,visible"; + source: "e"; + transition: DECELERATE 0.3; + action: STATE_SET "default" 0.0; + target: "item_clip_bottom"; + target: "item_clip_top"; + target: "item_clip_left"; + target: "item_clip_right"; + } program { name: "orient1"; signal: "e,state,orientation,top"; @@ -1096,14 +1539,352 @@ group { item: "shaped" "1"; } parts { + part { + name: "item_clip_bottom"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 0; + } + description { + state: "hidden" 0.0; + inherit: "default" 0.0; + rel1 { + relative: 0.0 1.0; + offset: 0 -2; + } + rel2 { + relative: 1.0 2.0; + offset: -1 -3; + } + } + } + part { + name: "item_clip_top"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 0; + } + description { + state: "hidden" 0.0; + inherit: "default" 0.0; + rel1 { + relative: 0.0 -1.0; + offset: 0 2; + } + rel2 { + relative: 1.0 0.0; + offset: -1 1; + } + } + } + part { + name: "item_clip_left"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 0; + } + description { + state: "hidden" 0.0; + inherit: "default" 0.0; + rel1 { + relative: -1.0 0.0; + offset: 2 0; + } + rel2 { + relative: 0.0 1.0; + offset: 1 -1; + } + } + } + part { + name: "item_clip_right"; + type: RECT; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 0; + } + description { + state: "hidden" 0.0; + inherit: "default" 0.0; + rel1 { + relative: 1.0 0.0; + offset: -2 0; + } + rel2 { + relative: 2.0 1.0; + offset: -3 -1; + } + } + } part { name: "e.swallow.content"; mouse_events: 0; type: SWALLOW; +// clip_to: "item_clip"; description { state: "default" 0.0; + rel1 { + to: "base"; + } + rel2 { + to: "base"; + } } } + part { + name: "base"; + mouse_events: 1; + type: RECT; + repeat_events: 1; +// clip_to: "item_clip"; + description { + state: "default" 0.0; + color: 255 255 255 0; + rel1 { + to: "item_clip_top"; + } + rel2 { + to: "item_clip_top"; + } + } + description { + state: "top_left" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_top"; + } + rel2 { + to: "item_clip_top"; + } + } + description { + state: "top_right" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_top"; + } + rel2 { + to: "item_clip_top"; + } + } + description { + state: "bottom" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_bottom"; + } + rel2 { + to: "item_clip_bottom"; + } + } + description { + state: "bottom_left" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_bottom"; + } + rel2 { + to: "item_clip_bottom"; + } + } + description { + state: "bottom_right" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_bottom"; + } + rel2 { + to: "item_clip_bottom"; + } + } + description { + state: "left" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_left"; + } + rel2 { + to: "item_clip_left"; + } + } + description { + state: "left_top" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_left"; + } + rel2 { + to: "item_clip_left"; + } + } + description { + state: "left_bottom" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_left"; + } + rel2 { + to: "item_clip_left"; + } + } + description { + state: "right" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_right"; + } + rel2 { + to: "item_clip_right"; + } + } + description { + state: "right_top" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_right"; + } + rel2 { + to: "item_clip_right"; + } + } + description { + state: "right_bottom" 0.0; + inherit: "default" 0.0; + rel1 { + to: "item_clip_right"; + } + rel2 { + to: "item_clip_right"; + } + } + } + } + programs { + program { + name: "hide"; + signal: "e,state,hidden"; + source: "e"; + action: STATE_SET "hidden" 0.0; + transition: ACCELERATE 0.3; + target: "item_clip_bottom"; + target: "item_clip_top"; + target: "item_clip_left"; + target: "item_clip_right"; + } + program { + name: "show"; + signal: "e,state,visible"; + source: "e"; + transition: DECELERATE 0.3; + action: STATE_SET "default" 0.0; + target: "item_clip_bottom"; + target: "item_clip_top"; + target: "item_clip_left"; + target: "item_clip_right"; + } + program { + name: "orient1"; + signal: "e,state,orientation,top"; + source: "e"; + action: STATE_SET "default" 0.0; + target: "base"; + target: "e.swallow.content"; + } + program { + name: "orient2"; + signal: "e,state,orientation,top_left"; + source: "e"; + action: STATE_SET "top_left" 0.0; + target: "base"; + target: "e.swallow.content"; + } + program { + name: "orient3"; + signal: "e,state,orientation,top_right"; + source: "e"; + action: STATE_SET "top_right" 0.0; + target: "base"; + target: "e.swallow.content"; + } + program { + name: "orient4"; + signal: "e,state,orientation,bottom"; + source: "e"; + action: STATE_SET "bottom" 0.0; + target: "base"; + target: "e.swallow.content"; + } + program { + name: "orient5"; + signal: "e,state,orientation,bottom_left"; + source: "e"; + action: STATE_SET "bottom_left" 0.0; + target: "base"; + target: "e.swallow.content"; + } + program { + name: "orient6"; + signal: "e,state,orientation,bottom_right"; + source: "e"; + action: STATE_SET "bottom_right" 0.0; + target: "base"; + target: "e.swallow.content"; + } + program { + name: "orient7"; + signal: "e,state,orientation,left"; + source: "e"; + action: STATE_SET "left" 0.0; + target: "base"; + target: "e.swallow.content"; + } + program { + name: "orient8"; + signal: "e,state,orientation,left_top"; + source: "e"; + action: STATE_SET "left_top" 0.0; + target: "base"; + target: "e.swallow.content"; + } + program { + name: "orient9"; + signal: "e,state,orientation,left_bottom"; + source: "e"; + action: STATE_SET "left_bottom" 0.0; + target: "base"; + target: "e.swallow.content"; + } + program { + name: "orient10"; + signal: "e,state,orientation,right"; + source: "e"; + action: STATE_SET "right" 0.0; + target: "base"; + target: "e.swallow.content"; + } + program { + name: "orient11"; + signal: "e,state,orientation,right_top"; + source: "e"; + action: STATE_SET "right_top" 0.0; + target: "base"; + target: "e.swallow.content"; + } + program { + name: "orient12"; + signal: "e,state,orientation,right_bottom"; + source: "e"; + action: STATE_SET "right_bottom" 0.0; + target: "base"; + target: "e.swallow.content"; + } } } diff --git a/src/bin/.cvsignore b/src/bin/.cvsignore index cb5e16f6a..e580006cc 100644 --- a/src/bin/.cvsignore +++ b/src/bin/.cvsignore @@ -10,3 +10,4 @@ enlightenment_imc enlightenment_start enlightenment_sys enlightenment_thumb +enlightenment_fm diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 3e4af5a6f..c3d9d838f 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -19,7 +19,8 @@ enlightenment_remote \ enlightenment_imc \ enlightenment_start \ enlightenment_thumb \ -enlightenment_sys +enlightenment_sys \ +enlightenment_fm ENLIGHTENMENTHEADERS = \ e.h \ @@ -377,13 +378,19 @@ e_start_main.c enlightenment_start_LDFLAGS = @dlopen_libs@ enlightenment_thumb_SOURCES = \ -e.h \ e_thumb_main.c \ e_user.c \ e_sha1.c enlightenment_thumb_LDFLAGS = @e_libs@ @dlopen_libs@ +enlightenment_fm_SOURCES = \ +e_fm_main.c \ +e_user.c \ +e_sha1.c + +enlightenment_fm_LDFLAGS = @e_libs@ @dlopen_libs@ + enlightenment_sys_SOURCES = \ e_sys_main.c diff --git a/src/bin/e.h b/src/bin/e.h index 9ef9e670b..e4f35725a 100644 --- a/src/bin/e.h +++ b/src/bin/e.h @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/src/bin/e_border.c b/src/bin/e_border.c index 87c6bf492..b10a733ad 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -422,6 +422,7 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map, int internal) bd->resize_mode = RESIZE_NONE; bd->layer = 100; + bd->saved.layer = bd->layer; bd->changes.icon = 1; bd->changes.size = 1; bd->changes.shape = 1; @@ -974,6 +975,7 @@ e_border_layer_set(E_Border *bd, int layer) raise = e_config->transient.raise; + bd->saved.layer = bd->layer; bd->layer = layer; if (e_config->transient.layer) { @@ -2071,7 +2073,7 @@ e_border_unfullscreen(E_Border *bd) e_border_move_resize(bd, bd->saved.x, bd->saved.y, bd->saved.w, bd->saved.h); /* FIXME: Find right layer */ - e_border_layer_set(bd, 100); + e_border_layer_set(bd, bd->saved.layer); e_hints_window_fullscreen_set(bd, 0); bd->client.border.changed = 1; diff --git a/src/bin/e_border.h b/src/bin/e_border.h index 0e2293d3e..896637e32 100644 --- a/src/bin/e_border.h +++ b/src/bin/e_border.h @@ -389,6 +389,7 @@ struct _E_Border struct { int x, y, w, h; + unsigned int layer; } saved; struct { diff --git a/src/bin/e_config.c b/src/bin/e_config.c index 00c31fa1e..0b2346fb9 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -121,6 +121,7 @@ e_config_init(void) E_CONFIG_VAL(D, T, style, STR); E_CONFIG_VAL(D, T, size, INT); E_CONFIG_VAL(D, T, overlap, INT); + E_CONFIG_VAL(D, T, autohide, INT); _e_config_desktop_bg_edd = E_CONFIG_DD_NEW("E_Config_Desktop_Background", E_Config_Desktop_Background); #undef T @@ -1133,7 +1134,7 @@ e_config_init(void) { E_Config_Shelf *cf_es; -#define CFG_SHELF(_name, _con, _zone, _pop, _lay, _orient, _fita, _fits, _style, _size, _overlap) \ +#define CFG_SHELF(_name, _con, _zone, _pop, _lay, _orient, _fita, _fits, _style, _size, _overlap, _autohide) \ cf_es = E_NEW(E_Config_Shelf, 1); \ cf_es->name = evas_stringshare_add(_name); \ cf_es->container = _con; \ @@ -1146,30 +1147,31 @@ e_config_init(void) cf_es->style = evas_stringshare_add(_style); \ cf_es->size = _size; \ cf_es->overlap = _overlap; \ + cf_es->autohide = _autohide; \ e_config->shelves = evas_list_append(e_config->shelves, cf_es) /* shelves for 4 zones on head 0 by default */ CFG_SHELF("shelf", 0, 0, 1, 200, E_GADCON_ORIENT_BOTTOM, - 1, 0, "default", 40, 0); + 1, 0, "default", 40, 0, 0); CFG_SHELF("shelf", 0, 1, 1, 200, E_GADCON_ORIENT_BOTTOM, - 1, 0, "default", 40, 0); + 1, 0, "default", 40, 0, 0); CFG_SHELF("shelf", 0, 2, 1, 200, E_GADCON_ORIENT_BOTTOM, - 1, 0, "default", 40, 0); + 1, 0, "default", 40, 0, 0); CFG_SHELF("shelf", 0, 3, 1, 200, E_GADCON_ORIENT_BOTTOM, - 1, 0, "default", 40, 0); + 1, 0, "default", 40, 0, 0); /* shelves for heada 1, 2, and 3 by default */ CFG_SHELF("shelf", 1, 0, 1, 200, E_GADCON_ORIENT_BOTTOM, - 1, 0, "default", 40, 0); + 1, 0, "default", 40, 0, 0); CFG_SHELF("shelf", 2, 0, 1, 200, E_GADCON_ORIENT_BOTTOM, - 1, 0, "default", 40, 0); + 1, 0, "default", 40, 0, 0); CFG_SHELF("shelf", 3, 0, 1, 200, E_GADCON_ORIENT_BOTTOM, - 1, 0, "default", 40, 0); + 1, 0, "default", 40, 0, 0); } IFCFGEND; diff --git a/src/bin/e_config.h b/src/bin/e_config.h index cb98715df..b8e130e8c 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -390,6 +390,7 @@ struct _E_Config_Shelf const char *style; int size; int overlap; + int autohide; }; struct _E_Config_Mime_Icon diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index c23ae361f..bf43c2da4 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -20,22 +20,15 @@ typedef enum _E_Fm2_Action_Type FILE_CHANGE } E_Fm2_Action_Type; -typedef enum _E_Fm2_Fop_Type -{ - FOP_DELETE, - FOP_MOVE, - FOP_LINK, - FOP_ADD -} E_Fm2_Fop_Type; - typedef struct _E_Fm2_Smart_Data E_Fm2_Smart_Data; typedef struct _E_Fm2_Region E_Fm2_Region; +typedef struct _E_Fm2_Finfo E_Fm2_Finfo; typedef struct _E_Fm2_Action E_Fm2_Action; -typedef struct _E_Fm2_Fop E_Fm2_Fop; -typedef struct _E_Fm2_Fop_Item E_Fm2_Fop_Item; +typedef struct _E_Fm2_Client E_Fm2_Client; struct _E_Fm2_Smart_Data { + int id; Evas_Coord x, y, w, h; Evas_Object *obj; Evas_Object *clip; @@ -67,20 +60,18 @@ struct _E_Fm2_Smart_Data Evas_List *icons; Evas_List *queue; - Ecore_Idler *scan_idler; Ecore_Timer *scan_timer; Ecore_Timer *sort_idler; Ecore_Job *scroll_job; Ecore_Job *resize_job; Ecore_Job *refresh_job; - DIR *dir; - FILE *order; E_Menu *menu; E_Entry_Dialog *entry_dialog; unsigned char iconlist_changed : 1; unsigned char order_file : 1; unsigned char typebuf_visible : 1; unsigned char show_hidden_files : 1; + unsigned char listing : 1; E_Fm2_Config *config; @@ -98,15 +89,10 @@ struct _E_Fm2_Smart_Data unsigned char deletions : 1; } live; - struct { - Ecore_File_Monitor *monitor; - } monitor; - struct { char *buf; } typebuf; - E_Fm2_Fop *fop; int busy_count; E_Object *eobj; @@ -155,41 +141,32 @@ struct _E_Fm2_Icon unsigned char down_sel : 1; }; +struct _E_Fm2_Finfo +{ + struct stat st; + int broken_link; + const char *lnk; + const char *rlnk; +}; + struct _E_Fm2_Action { E_Fm2_Action_Type type; const char *file; const char *file2; int flags; + E_Fm2_Finfo finf; }; -struct _E_Fm2_Fop +struct _E_Fm2_Client { - Evas_Object *obj; - const char *dir; - Evas_List *items; - Ecore_Idler *idler; - Ecore_Timer *timer; -}; - -struct _E_Fm2_Fop_Item -{ - E_Fm2_Fop_Type type; - E_Fm2_Fop *fop; - const char *file; - const char *file2; - const char *file3; - int after; - DIR *dir; - unsigned char is_dir : 1; - unsigned char file_add : 1; + Ecore_Ipc_Client *cl; + int req; }; static const char *_e_fm2_dev_path_map(const char *dev, const char *path); -static void _e_fm2_file_add(Evas_Object *obj, const char *file, int unique, const char *file_rel, int after); +static void _e_fm2_file_add(Evas_Object *obj, const char *file, int unique, const char *file_rel, int after, E_Fm2_Finfo *finf); static void _e_fm2_file_del(Evas_Object *obj, const char *file); -static void _e_fm2_scan_start(Evas_Object *obj); -static void _e_fm2_scan_stop(Evas_Object *obj); static void _e_fm2_queue_process(Evas_Object *obj); static void _e_fm2_queue_free(Evas_Object *obj); static void _e_fm2_regions_free(Evas_Object *obj); @@ -199,9 +176,9 @@ static void _e_fm2_icons_free(Evas_Object *obj); static void _e_fm2_regions_eval(Evas_Object *obj); static void _e_fm2_config_free(E_Fm2_Config *cfg); -static E_Fm2_Icon *_e_fm2_icon_new(E_Fm2_Smart_Data *sd, const char *file); +static E_Fm2_Icon *_e_fm2_icon_new(E_Fm2_Smart_Data *sd, const char *file, E_Fm2_Finfo *finf); static void _e_fm2_icon_unfill(E_Fm2_Icon *ic); -static int _e_fm2_icon_fill(E_Fm2_Icon *ic); +static int _e_fm2_icon_fill(E_Fm2_Icon *ic, E_Fm2_Finfo *finf); static void _e_fm2_icon_free(E_Fm2_Icon *ic); static void _e_fm2_icon_realize(E_Fm2_Icon *ic); static void _e_fm2_icon_unrealize(E_Fm2_Icon *ic); @@ -253,7 +230,6 @@ static void _e_fm2_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *ev static void _e_fm2_cb_scroll_job(void *data); static void _e_fm2_cb_resize_job(void *data); static int _e_fm2_cb_icon_sort(void *data1, void *data2); -static int _e_fm2_cb_scan_idler(void *data); static int _e_fm2_cb_scan_timer(void *data); static int _e_fm2_cb_sort_idler(void *data); @@ -293,22 +269,14 @@ static void _e_fm2_file_delete_yes_cb(void *data, E_Dialog *dialog); static void _e_fm2_file_delete_no_cb(void *data, E_Dialog *dialog); static void _e_fm2_refresh_job_cb(void *data); -static void _e_fm2_live_file_add(Evas_Object *obj, const char *file, const char *file_rel, int after); +static void _e_fm2_live_file_add(Evas_Object *obj, const char *file, const char *file_rel, int after, E_Fm2_Finfo *finf); static void _e_fm2_live_file_del(Evas_Object *obj, const char *file); -static void _e_fm2_live_file_changed(Evas_Object *obj, char *file); +static void _e_fm2_live_file_changed(Evas_Object *obj, const char *file, E_Fm2_Finfo *finf); static void _e_fm2_live_process_begin(Evas_Object *obj); static void _e_fm2_live_process_end(Evas_Object *obj); static void _e_fm2_live_process(Evas_Object *obj); static int _e_fm2_cb_live_idler(void *data); static int _e_fm2_cb_live_timer(void *data); -static void _e_fm2_cb_file_monitor(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path); - -static E_Fm2_Fop *_e_fm2_fop_add(E_Fm2_Smart_Data *sd); -static void _e_fm2_fop_del(E_Fm2_Fop *fop); -static void _e_fm2_fop_detach(E_Fm2_Smart_Data *sd); -static int _e_fm2_fop_process(E_Fm2_Fop *fop); -static int _e_fm2_cb_fop_idler(void *data); -static int _e_fm2_cb_fop_timer(void *data); static const char *_e_fm2_removable_dev_label_get(const char *uuid); static void _e_fm2_removable_dev_add(const char *uuid); @@ -326,12 +294,18 @@ static void _e_fm2_cb_dbus_method_name_has_owner(void *data, Ecore_DBus_Method_R static void _e_fm2_cb_dbus_method_add_match(void *data, Ecore_DBus_Method_Return *reply); static void _e_fm2_cb_dbus_method_error(void *data, const char *error); +static void _e_fm2_client_spawn(void); +static E_Fm2_Client *_e_fm2_client_get(void); +static void _e_fm2_client_monitor_add(int id, const char *path); +static void _e_fm2_client_monitor_del(int id, const char *path); + static Ecore_DBus_Server *_e_fm2_dbus = NULL; static Evas_List *_e_fm2_dbus_handlers = NULL; static char *_e_fm2_meta_path = NULL; static Evas_Smart *_e_fm2_smart = NULL; static Evas_List *_e_fm2_list = NULL; -static Evas_List *_e_fm2_fop_list = NULL; +static Evas_List *_e_fm2_client_list = NULL; +static int _e_fm2_id = 0; EAPI int E_EVENT_REMOVABLE_ADD = 0; EAPI int E_EVENT_REMOVABLE_DEL = 0; @@ -416,6 +390,7 @@ e_fm2_init(void) E_EVENT_REMOVABLE_ADD = ecore_event_type_new(); E_EVENT_REMOVABLE_DEL = ecore_event_type_new(); } + _e_fm2_client_spawn(); return 1; } @@ -455,8 +430,6 @@ e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path) if (!evas_object_type_get(obj)) return; // safety if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety - _e_fm2_fop_detach(sd); - /* internal config for now - don't see a pont making this configurable */ sd->regions.member_max = 64; @@ -488,6 +461,9 @@ e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path) sd->config->theme.fixed = 0; } + if (sd->realpath) _e_fm2_client_monitor_del(sd->id, sd->realpath); + sd->listing = 0; + if (sd->dev) evas_stringshare_del(sd->dev); if (sd->path) evas_stringshare_del(sd->path); if (sd->realpath) @@ -496,18 +472,22 @@ e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path) evas_stringshare_del(sd->realpath); } sd->dev = sd->path = sd->realpath = NULL; + + sd->order_file = 0; + if (dev) sd->dev = evas_stringshare_add(dev); sd->path = evas_stringshare_add(path); sd->realpath = _e_fm2_dev_path_map(sd->dev, sd->path); _e_fm2_removable_path_mount(sd->realpath); - - _e_fm2_scan_stop(obj); + _e_fm2_queue_free(obj); _e_fm2_regions_free(obj); _e_fm2_icons_free(obj); edje_object_part_text_set(sd->overlay, "e.text.busy_label", ""); - _e_fm2_scan_start(obj); + _e_fm2_client_monitor_add(sd->id, sd->realpath); + sd->listing = 1; + evas_object_smart_callback_call(obj, "dir_changed", NULL); sd->tmp.iter = 0; } @@ -537,13 +517,20 @@ e_fm2_refresh(Evas_Object *obj) if (!evas_object_type_get(obj)) return; // safety if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety - _e_fm2_scan_stop(obj); _e_fm2_queue_free(obj); _e_fm2_regions_free(obj); _e_fm2_icons_free(obj); - _e_fm2_scan_start(obj); -// evas_object_smart_callback_call(obj, "dir_changed", NULL); + sd->order_file = 0; + + if (sd->realpath) + { + sd->listing = 0; + _e_fm2_client_monitor_del(sd->id, sd->realpath); + _e_fm2_client_monitor_add(sd->id, sd->realpath); + sd->listing = 1; + } + sd->tmp.iter = 0; } @@ -608,7 +595,6 @@ e_fm2_config_set(Evas_Object *obj, E_Fm2_Config *cfg) sd->config = E_NEW(E_Fm2_Config, 1); if (!sd->config) return; memcpy(sd->config, cfg, sizeof(E_Fm2_Config)); - if (cfg->view.extra_file_source) sd->config->view.extra_file_source = evas_stringshare_add(cfg->view.extra_file_source); if (cfg->icon.key_hint) sd->config->icon.key_hint = evas_stringshare_add(cfg->icon.key_hint); if (cfg->theme.background) sd->config->theme.background = evas_stringshare_add(cfg->theme.background); if (cfg->theme.frame) sd->config->theme.frame = evas_stringshare_add(cfg->theme.frame); @@ -895,114 +881,6 @@ e_fm2_all_icons_update(void) e_fm2_icons_update(l->data); } -EAPI void -e_fm2_fop_delete_add(Evas_Object *obj, E_Fm2_Icon_Info *ici) -{ - E_Fm2_Smart_Data *sd; - E_Fm2_Fop *fop; - E_Fm2_Fop_Item *fi; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety - /* if no obj fop struct, create fop struct and add idler */ - /* append fop node for delete and this file to the fop */ - - /* if obj is deleted what to do to fop: */ - /* if obj is deleted, detach fop and let it run on its own till end */ - /* if obj changes dir detach fop obj */ - - /* on fop queue empty - deete idler and free fop */ - /* in fop idler go to the item on the head of the fop queue. if it is - * a file or a symlink, delete it directly. if it is a dir then - * opendir it in the fop entry (fope->dir != NULL now) and if dir is - * not null, readdir till end (when at end remove item) and per item - * if it is a file or link - delete it directly, if it is a dir, prepend to - * fop queue. - * per fop item processed, if obj is attached to fop - report status usig - * the status overlay for the fm edj obj. - */ - fop = _e_fm2_fop_add(sd); - if (!fop) return; - - fi = E_NEW(E_Fm2_Fop_Item, 1); - fi->fop = fop; - fi->type = FOP_DELETE; - fi->file = evas_stringshare_add(ici->file); - if ((S_ISDIR(ici->statinfo.st_mode)) && (!ici->real_link)) - fi->is_dir = 1; - fi->fop->items = evas_list_append(fi->fop->items, fi); -// printf("ADD0: %s\n", fi->file); -} - -EAPI void -e_fm2_fop_move_add(Evas_Object *obj, const char *src, const char *dst, const char *rel, int after, int file_add) -{ - E_Fm2_Smart_Data *sd; - E_Fm2_Fop *fop; - E_Fm2_Fop_Item *fi; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety - fop = _e_fm2_fop_add(sd); - if (!fop) return; - fi = E_NEW(E_Fm2_Fop_Item, 1); - fi->fop = fop; - fi->type = FOP_MOVE; - fi->file = evas_stringshare_add(src); - fi->file2 = evas_stringshare_add(dst); - if (rel) fi->file3 = evas_stringshare_add(rel); - fi->after = after; - fi->file_add = file_add; - fi->fop->items = evas_list_append(fi->fop->items, fi); -} - -EAPI void -e_fm2_fop_link_add(Evas_Object *obj, const char *src, const char *dst) -{ - E_Fm2_Smart_Data *sd; - E_Fm2_Fop *fop; - E_Fm2_Fop_Item *fi; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety - fop = _e_fm2_fop_add(sd); - if (!fop) return; - fi = E_NEW(E_Fm2_Fop_Item, 1); - fi->fop = fop; - fi->type = FOP_LINK; - fi->file = evas_stringshare_add(src); - fi->file2 = evas_stringshare_add(dst); - fi->fop->items = evas_list_append(fi->fop->items, fi); -} - -EAPI void -e_fm2_fop_add_add(Evas_Object *obj, const char *file, const char *rel, int after) -{ - E_Fm2_Smart_Data *sd; - E_Fm2_Fop *fop; - E_Fm2_Fop_Item *fi; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; // safety - if (!evas_object_type_get(obj)) return; // safety - if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety - fop = _e_fm2_fop_add(sd); - if (!fop) return; - fi = E_NEW(E_Fm2_Fop_Item, 1); - fi->fop = fop; - fi->type = FOP_ADD; - fi->file = evas_stringshare_add(file); - if (rel) fi->file3 = evas_stringshare_add(rel); - fi->after = after; - fi->fop->items = evas_list_append(fi->fop->items, fi); -} - EAPI Evas_Object * e_fm2_icon_get(Evas *evas, const char *realpath, E_Fm2_Icon *ic, E_Fm2_Icon_Info *ici, @@ -1054,11 +932,7 @@ e_fm2_icon_get(Evas *evas, const char *realpath, { if (ici->icon_type == 1) { - if (ici->pseudo_link) - snprintf(buf, sizeof(buf), "%s/%s", ici->pseudo_dir, ici->file); - else - snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file); - + snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file); oic = e_thumb_icon_add(evas); e_thumb_icon_file_set(oic, buf, NULL); e_thumb_icon_size_set(oic, 128, 128); @@ -1086,10 +960,7 @@ e_fm2_icon_get(Evas *evas, const char *realpath, } else if (!strcmp(icon, "THUMB")) { - if (ici->pseudo_link) - snprintf(buf, sizeof(buf), "%s/%s", ici->pseudo_dir, ici->file); - else - snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file); + snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file); oic = e_thumb_icon_add(evas); e_thumb_icon_file_set(oic, buf, NULL); @@ -1108,10 +979,7 @@ e_fm2_icon_get(Evas *evas, const char *realpath, E_App *app; oic = NULL; - if (ici->pseudo_link) - snprintf(buf, sizeof(buf), "%s/%s", ici->pseudo_dir, ici->file); - else - snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file); + snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file); app = e_app_new(buf, 0); if (app) { @@ -1151,10 +1019,7 @@ e_fm2_icon_get(Evas *evas, const char *realpath, } else { - if (ici->pseudo_link) - snprintf(buf, sizeof(buf), "%s/%s", ici->pseudo_dir, ici->file); - else - snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file); + snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file); /* fallback */ if ( (e_util_glob_case_match(ici->file, "*.edj")) @@ -1281,6 +1146,299 @@ e_fm2_icon_get(Evas *evas, const char *realpath, return oic; } +/* FIXME: tmp delay - fix later */ +static int +_e_fm2_cb_spawn_timer(void *data) +{ + Ecore_Exe *exe; + char buf[4096]; + + snprintf(buf, sizeof(buf), "%s/enlightenment_fm", e_prefix_bin_get()); + exe = ecore_exe_run(buf, NULL); + return 0; +} + +static void +_e_fm2_client_spawn(void) +{ + /* for now spawn the fm 1.0 seconds later making sure e is up - + * in reality this needs to be be done on demand and queued - tracking exe + * as well as clients - so if client dies - we know (before it connects), + * and all requests need to be queued until slave is up. + */ + ecore_timer_add(1.0, _e_fm2_cb_spawn_timer, NULL); +} + +static E_Fm2_Client * +_e_fm2_client_get(void) +{ + Evas_List *l; + E_Fm2_Client *cl, *cl_chosen = NULL; + int min_req = 0x7fffffff; + + /* if we don't have a slave - spane one */ + if (!_e_fm2_client_list) + { +// _e_fm2_client_spawn(); + return NULL; + } + for (l = _e_fm2_client_list; l; l = l->next) + { + cl = l->data; + if (cl->req < min_req) + { + min_req = cl->req; + cl_chosen = cl; + } + } + return cl_chosen; +} + +static void +_e_fm2_client_monitor_add(int id, const char *path) +{ + E_Fm2_Client *cl; + + /* FIXME: for now if there is no client - abort the op entirely */ + cl = _e_fm2_client_get(); + if (!cl) return; + ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, 1, + id, 0, 0, + (void *)path, strlen(path) + 1); + cl->req++; +} + +static void +_e_fm2_client_monitor_del(int id, const char *path) +{ + E_Fm2_Client *cl; + + /* FIXME: for now if there is no client - abort the op entirely */ + cl = _e_fm2_client_get(); + if (!cl) return; + ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, 2, + id, 0, 0, + (void *)path, strlen(path) + 1); + cl->req++; +} + +static void +_e_fm2_client_monitor_list_end(Evas_Object *obj) +{ + E_Fm2_Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + sd->busy_count--; + if (sd->busy_count == 0) + { + edje_object_signal_emit(sd->overlay, "e,state,busy,stop", "e"); + e_fm2_custom_file_flush(); + } + if (sd->tmp.obj) + { + evas_object_del(sd->tmp.obj); + sd->tmp.obj = NULL; + } + if (sd->tmp.obj2) + { + evas_object_del(sd->tmp.obj2); + sd->tmp.obj2 = NULL; + } + if (sd->scan_timer) + { + ecore_timer_del(sd->scan_timer); + sd->scan_timer = NULL; + } + if (sd->sort_idler) + { + ecore_idler_del(sd->sort_idler); + sd->sort_idler = NULL; + } + E_FREE(sd->tmp.list_index); + _e_fm2_queue_free(obj); + _e_fm2_obj_icons_place(sd); + _e_fm2_live_process_begin(obj); +} + +EAPI void +e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e) +{ + Evas_List *l; + E_Fm2_Client *cl; + + if (e->major != 6/*E_IPC_DOMAIN_FM*/) return; + for (l = _e_fm2_client_list; l; l = l->next) + { + cl = l->data; + if (cl->cl == e->client) break; + } + if (!l) + { + cl = E_NEW(E_Fm2_Client, 1); + cl->cl = e->client; + _e_fm2_client_list = evas_list_prepend(_e_fm2_client_list, cl); + } + + for (l = _e_fm2_list; l; l = l->next) + { + unsigned char *p; + char *evdir; + const char *dir, *path, *lnk, *rlnk, *file; + struct stat st; + int broken_link; + E_Fm2_Smart_Data *sd; + void **sdat; + + dir = e_fm2_real_path_get(l->data); + sd = evas_object_smart_data_get(l->data); + switch (e->minor) + { + case 1:/*hello*/ + break; + case 2:/*req ok*/ + cl->req--; + break; + case 3:/*file add*/ + case 5:/*file change*/ + { + E_Fm2_Finfo finf; + + p = e->data; + /* NOTE: i am NOT converting this data to portable arch/os independant + * format. i am ASSUMING e_fm_main and e are local and built together + * and thus this will work. if this ever changes this here needs to + * change */ + memcpy(&st, p, sizeof(struct stat)); + p += sizeof(struct stat); + + broken_link = p[0]; + p += 1; + + path = p; + p += strlen(path) + 1; + + lnk = p; + p += strlen(lnk) + 1; + + rlnk = p; + p += strlen(rlnk) + 1; + + memcpy(&(finf.st), &st, sizeof(struct stat)); + finf.broken_link = broken_link; + finf.lnk = lnk; + finf.rlnk = rlnk; + + evdir = ecore_file_get_dir(path); + if ((sd->id == e->ref_to) && (!strcmp(dir, evdir))) + { + if (e->response == 0)/*live changes*/ + { + if (e->minor == 3)/*file add*/ + { + _e_fm2_live_file_add + (l->data, ecore_file_get_file(path), + NULL, 0, &finf); + } + else if (e->minor == 5)/*file change*/ + { + _e_fm2_live_file_changed + (l->data, (char *)ecore_file_get_file(path), + &finf); + } + } + else/*file add - listing*/ + { + if (e->minor == 3)/*file add*/ + { + if (!sd->scan_timer) + { + sd->scan_timer = + ecore_timer_add(0.5, + _e_fm2_cb_scan_timer, + sd->obj); + sd->busy_count++; + if (sd->busy_count == 1) + edje_object_signal_emit(sd->overlay, "e,state,busy,start", "e"); + } + file = ecore_file_get_file(path); + if ((!strcmp(file, ".order"))) + sd->order_file = 1; + else + { + if (!((file[0] == '.') && + (!sd->show_hidden_files))) + _e_fm2_file_add(l->data, file, + sd->order_file, + NULL, 0, &finf); + } + if (e->response == 2)/* end of scan */ + { + sd->listing = 0; + if (sd->scan_timer) + { + ecore_timer_del(sd->scan_timer); + sd->scan_timer = + ecore_timer_add(0.0001, + _e_fm2_cb_scan_timer, + sd->obj); + } + else + { + _e_fm2_client_monitor_list_end(l->data); + } + } + } + } + } + free(evdir); + } + break; + case 4:/*file del*/ + path = e->data; + evdir = ecore_file_get_dir(path); + if ((sd->id == e->ref_to) && (!strcmp(dir, evdir))) + { + _e_fm2_live_file_del + (l->data, ecore_file_get_file(path)); + } + free(evdir); + break; + case 6:/*mon dir del*/ + path = e->data; + if ((sd->id == e->ref_to) && (!strcmp(dir, path))) + { + } + break; + default: + break; + } + } + if (e->minor == 7) + { + ecore_ipc_client_send(cl->cl, E_IPC_DOMAIN_FM, 12, + 0, 0, e->response, + NULL, 0); + } +} + +EAPI void +e_fm2_client_del(Ecore_Ipc_Event_Client_Del *e) +{ + Evas_List *l; + E_Fm2_Client *cl; + + for (l = _e_fm2_client_list; l; l = l->next) + { + cl = l->data; + if (cl->cl == e->client) + { + _e_fm2_client_list = evas_list_remove_list(_e_fm2_client_list, l); + free(cl); + break; + } + } +} + /* local subsystem functions */ static const char * _e_fm2_dev_path_map(const char *dev, const char *path) @@ -1362,7 +1520,7 @@ _e_fm2_dev_path_map(const char *dev, const char *path) } static void -_e_fm2_file_add(Evas_Object *obj, const char *file, int unique, const char *file_rel, int after) +_e_fm2_file_add(Evas_Object *obj, const char *file, int unique, const char *file_rel, int after, E_Fm2_Finfo *finf) { E_Fm2_Smart_Data *sd; E_Fm2_Icon *ic, *ic2; @@ -1379,7 +1537,6 @@ _e_fm2_file_add(Evas_Object *obj, const char *file, int unique, const char *file if (!strcmp(ic->info.file, file)) { sd->tmp.last_insert = NULL; -// sd->iconlist_changed = 1; return; } } @@ -1389,13 +1546,12 @@ _e_fm2_file_add(Evas_Object *obj, const char *file, int unique, const char *file if (!strcmp(ic->info.file, file)) { sd->tmp.last_insert = NULL; -// sd->iconlist_changed = 1; return; } } } /* create icon obj and append to unsorted list */ - ic = _e_fm2_icon_new(sd, file); + ic = _e_fm2_icon_new(sd, file, finf); if (ic) { if (!file_rel) @@ -1462,100 +1618,6 @@ _e_fm2_file_del(Evas_Object *obj, const char *file) } } -static void -_e_fm2_scan_start(Evas_Object *obj) -{ - E_Fm2_Smart_Data *sd; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; - /* start scanning the dir in an idler and putting found items on the */ - /* queue as icons - waiting for sorting and region insertion by a */ - /* timer that ticks off taking queued icons and putting them in a */ - /* sorted position in the icon list */ - /* this system is great - it completely does the dir scanning in idle - * time when e has nothing better to do - BUt it will mean that the dir - * will first draw with an empty view then slowly fill up as the scan - * happens - this means e remains interactive, but could mean for more - * redraws that we want. what we want to do is maybe bring some of the - * scan forward to here for a short period of time so when the window - * is drawn - its drawn with contents ... if they didnt take too long - * to fill - */ - /* if i add the above pre-scan and it doesnt finish - continue here */ - if ((sd->scan_idler) || (sd->scan_timer)) return; - sd->order_file = 0; - ecore_desktop_instrumentation_reset(); - if (sd->monitor.monitor) ecore_file_monitor_del(sd->monitor.monitor); - sd->monitor.monitor = ecore_file_monitor_add(sd->realpath, _e_fm2_cb_file_monitor, obj); - sd->scan_idler = ecore_idler_add(_e_fm2_cb_scan_idler, obj); - sd->scan_timer = ecore_timer_add(0.5, _e_fm2_cb_scan_timer, obj); - sd->busy_count++; - if (sd->busy_count == 1) - edje_object_signal_emit(sd->overlay, "e,state,busy,start", "e"); -} - -static void -_e_fm2_scan_stop(Evas_Object *obj) -{ - E_Fm2_Smart_Data *sd; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; - if ((sd->dir) || (sd->order)) - { - sd->busy_count--; - if (sd->busy_count == 0) - { - edje_object_signal_emit(sd->overlay, "e,state,busy,stop", "e"); - e_fm2_custom_file_flush(); - } - } - /* stop the scan idler, the sort timer and free the queue */ - if (sd->dir) - { - closedir(sd->dir); - sd->dir = NULL; - } - if (sd->order) - { - fclose(sd->order); - sd->order = NULL; - } - if (sd->tmp.obj) - { - evas_object_del(sd->tmp.obj); - sd->tmp.obj = NULL; - } - if (sd->tmp.obj2) - { - evas_object_del(sd->tmp.obj2); - sd->tmp.obj2 = NULL; - } - if (sd->scan_idler) - { - ecore_idler_del(sd->scan_idler); - sd->scan_idler = NULL; - } - if (sd->scan_timer) - { - ecore_timer_del(sd->scan_timer); - sd->scan_timer = NULL; - } - if (sd->sort_idler) - { - ecore_idler_del(sd->sort_idler); - sd->sort_idler = NULL; - } - - E_FREE(sd->tmp.list_index); - _e_fm2_queue_free(obj); - _e_fm2_obj_icons_place(sd); - ecore_desktop_instrumentation_print(); - - _e_fm2_live_process_begin(obj); -} - static void _e_fm2_queue_process(Evas_Object *obj) { @@ -1614,7 +1676,6 @@ _e_fm2_queue_process(Evas_Object *obj) l = sd->tmp.last_insert; while (sd->queue) { - ic = sd->queue->data; sd->queue = evas_list_remove_list(sd->queue, sd->queue); /* insertion sort - better than qsort for the way we are doing @@ -1655,8 +1716,6 @@ _e_fm2_queue_process(Evas_Object *obj) // added, sd->tmp.iter); snprintf(buf, sizeof(buf), _("%i Files"), evas_list_count(sd->icons)); edje_object_part_text_set(sd->overlay, "e.text.busy_label", buf); - /* FIXME: this could get a lot faster - avoid it or something. scan - speed goes from 200-250 files/0.2 sec to 80 or so in my tests */ if (sd->resize_job) ecore_job_del(sd->resize_job); sd->resize_job = ecore_job_add(_e_fm2_cb_resize_job, obj); evas_object_smart_callback_call(sd->obj, "changed", NULL); @@ -1991,7 +2050,6 @@ _e_fm2_regions_eval(Evas_Object *obj) static void _e_fm2_config_free(E_Fm2_Config *cfg) { - if (cfg->view.extra_file_source) evas_stringshare_del(cfg->view.extra_file_source); if (cfg->icon.key_hint) evas_stringshare_del(cfg->icon.key_hint); if (cfg->theme.background) evas_stringshare_del(cfg->theme.background); if (cfg->theme.frame) evas_stringshare_del(cfg->theme.frame); @@ -2002,7 +2060,7 @@ _e_fm2_config_free(E_Fm2_Config *cfg) /**************************/ static E_Fm2_Icon * -_e_fm2_icon_new(E_Fm2_Smart_Data *sd, const char *file) +_e_fm2_icon_new(E_Fm2_Smart_Data *sd, const char *file, E_Fm2_Finfo *finf) { E_Fm2_Icon *ic; @@ -2011,7 +2069,7 @@ _e_fm2_icon_new(E_Fm2_Smart_Data *sd, const char *file) ic->info.fm = sd->obj; ic->info.file = evas_stringshare_add(file); ic->sd = sd; - if (!_e_fm2_icon_fill(ic)) + if (!_e_fm2_icon_fill(ic, finf)) { evas_stringshare_del(ic->info.file); free(ic); @@ -2030,7 +2088,6 @@ _e_fm2_icon_unfill(E_Fm2_Icon *ic) if (ic->info.icon) evas_stringshare_del(ic->info.icon); if (ic->info.link) evas_stringshare_del(ic->info.link); if (ic->info.real_link) evas_stringshare_del(ic->info.real_link); - if (ic->info.pseudo_dir) evas_stringshare_del(ic->info.pseudo_dir); ic->info.mime = NULL; ic->info.label = NULL; ic->info.comment = NULL; @@ -2038,16 +2095,14 @@ _e_fm2_icon_unfill(E_Fm2_Icon *ic) ic->info.icon = NULL; ic->info.link = NULL; ic->info.real_link = NULL; - ic->info.pseudo_dir = NULL; ic->info.mount = 0; ic->info.removable = 0; - ic->info.pseudo_link = 0; ic->info.deleted = 0; ic->info.broken_link = 0; } static int -_e_fm2_icon_fill(E_Fm2_Icon *ic) +_e_fm2_icon_fill(E_Fm2_Icon *ic, E_Fm2_Finfo *finf) { Evas_Coord mw = 0, mh = 0; Evas_Object *obj, *obj2; @@ -2057,47 +2112,51 @@ _e_fm2_icon_fill(E_Fm2_Icon *ic) snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file); cf = e_fm2_custom_file_get(buf); - lnk = ecore_file_readlink(buf); - if (stat(buf, &(ic->info.statinfo)) == -1) + if (finf) { - if (lnk) - ic->info.broken_link = 1; - else + memcpy(&(ic->info.statinfo), &(finf->st), sizeof(struct stat)); + if ((finf->lnk) && (finf->lnk[0])) + ic->info.link = evas_stringshare_add(finf->lnk); + if ((finf->rlnk) && (finf->rlnk[0])) + ic->info.real_link = evas_stringshare_add(finf->rlnk); + ic->info.broken_link = finf->broken_link; + } + else + { + /* FIXME: this should go away... */ + lnk = ecore_file_readlink(buf); + if (stat(buf, &(ic->info.statinfo)) == -1) { - if (ic->sd->config->view.extra_file_source) + if (lnk) + ic->info.broken_link = 1; + else { - snprintf(buf, sizeof(buf), "%s/%s", - ic->sd->config->view.extra_file_source, ic->info.file); - if (stat(buf, &(ic->info.statinfo)) == -1) - return 0; - ic->info.pseudo_dir = evas_stringshare_add(ic->sd->config->view.extra_file_source); - ic->info.pseudo_link = 1; + return 0; + } + } + if (lnk) + { + if (lnk[0] == '/') + { + ic->info.link = evas_stringshare_add(lnk); + ic->info.real_link = evas_stringshare_add(lnk); } else - return 0; - } - } - if (lnk) - { - if (lnk[0] == '/') - { - ic->info.link = evas_stringshare_add(lnk); - ic->info.real_link = evas_stringshare_add(lnk); - } - else - { - char *rp; - - snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, lnk); - rp = ecore_file_realpath(buf); - if (rp) { - ic->info.link = evas_stringshare_add(rp); - free(rp); + char *rp; + + snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, lnk); + rp = ecore_file_realpath(buf); + if (rp) + { + ic->info.link = evas_stringshare_add(rp); + free(rp); + } + ic->info.real_link = evas_stringshare_add(lnk); } - ic->info.real_link = evas_stringshare_add(lnk); + free(lnk); } - free(lnk); + /* FIXME: end go away chunk */ } if (!ic->info.mime) @@ -2243,7 +2302,6 @@ _e_fm2_icon_free(E_Fm2_Icon *ic) if (ic->info.icon) evas_stringshare_del(ic->info.icon); if (ic->info.link) evas_stringshare_del(ic->info.link); if (ic->info.real_link) evas_stringshare_del(ic->info.real_link); - if (ic->info.pseudo_dir) evas_stringshare_del(ic->info.pseudo_dir); free(ic); } @@ -2408,7 +2466,7 @@ _e_fm2_icon_thumb(E_Fm2_Icon *ic, Evas_Object *oic, int force) ((_e_fm2_icon_visible(ic)) && (!ic->sd->queue) && (!ic->sd->sort_idler) && - (!ic->sd->scan_idler))) + (!ic->sd->listing))) e_thumb_icon_begin(oic); } @@ -2423,8 +2481,6 @@ _e_fm2_icon_select(E_Fm2_Icon *ic) edje_object_signal_emit(ic->obj, "e,state,selected", "e"); edje_object_signal_emit(ic->obj_icon, "e,state,selected", "e"); evas_object_stack_below(ic->obj, ic->sd->drop); -// evas_object_stack_below(ic->sd->drop, ic->sd->overlay); -// evas_object_stack_below(ic->sd->drop_in, ic->sd->overlay); } } @@ -2463,10 +2519,7 @@ _e_fm2_icon_desktop_load(E_Fm2_Icon *ic) char buf[4096]; Ecore_Desktop *desktop; - if (ic->info.pseudo_link) - snprintf(buf, sizeof(buf), "%s/%s", ic->info.pseudo_dir, ic->info.file); - else - snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file); + snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file); desktop = ecore_desktop_get(buf, NULL); if (desktop) @@ -2524,13 +2577,11 @@ _e_fm2_icon_desktop_load(E_Fm2_Icon *ic) if (ic->info.generic) evas_stringshare_del(ic->info.generic); if (ic->info.icon) evas_stringshare_del(ic->info.icon); if (ic->info.link) evas_stringshare_del(ic->info.link); - if (ic->info.pseudo_dir) evas_stringshare_del(ic->info.pseudo_dir); ic->info.label = NULL; ic->info.comment = NULL; ic->info.generic = NULL; ic->info.icon = NULL; ic->info.link = NULL; - ic->info.pseudo_dir = NULL; return 0; } @@ -2844,10 +2895,7 @@ _e_fm2_typebuf_run(Evas_Object *obj) char buf[4096], *dev = NULL; if (ic->sd->dev) dev = strdup(ic->sd->dev); - if (ic->info.pseudo_link) - snprintf(buf, sizeof(buf), "%s/%s", ic->info.pseudo_dir, ic->info.file); - else - snprintf(buf, sizeof(buf), "%s/%s", ic->sd->path, ic->info.file); + snprintf(buf, sizeof(buf), "%s/%s", ic->sd->path, ic->info.file); e_fm2_path_set(ic->sd->obj, dev, buf); E_FREE(dev); } @@ -3288,53 +3336,16 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event) /* if the file is not in the target dir */ if (strcmp(d, sd->realpath)) { - /* if the file is not a pseudo-link */ - if (e_util_strcmp(sd->config->view.extra_file_source, d)) - { - /* move the file into the subdir */ - snprintf(buf, sizeof(buf), "%s/%s", - sd->realpath, ecore_file_get_file(fp)); - e_fm2_fop_move_add(sd->obj, - fp, buf, - NULL, 0, 1); -// if (ecore_file_exists(buf)) -// { -// /* FIXME: error - file exists */ -// } -// else -// { -/*FOPME*/ -// if (ecore_file_mv(fp, buf)) -// _e_fm2_live_file_add(sd->obj, -// ecore_file_get_file(fp), -// NULL, 0); -// } - } - else - _e_fm2_live_file_add(sd->obj, - ecore_file_get_file(fp), - NULL, 0); + _e_fm2_live_file_add(sd->obj, + ecore_file_get_file(fp), + NULL, 0, NULL); } else { /* file is in target dir - move into subdir */ snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, ecore_file_get_file(fp)); - e_fm2_fop_move_add(sd->obj, - fp, buf, - NULL, 0, 1); -// if (ecore_file_exists(buf)) -// { -// /* FIXME: error - file exists */ -// } -// else -// { -/*FOPME*/ -// if (ecore_file_mv(fp, buf)) -// _e_fm2_live_file_add(sd->obj, -// ecore_file_get_file(fp), -// NULL, 0); -// } + printf("mv %s %s\n", (char *)fp, buf); } free(d); } @@ -3355,15 +3366,6 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event) snprintf(buf, sizeof(buf), "%s/%s/%s", sd->realpath, sd->drop_icon->info.file, ecore_file_get_file(fp)); printf("mv %s %s\n", (char *)fp, buf); - e_fm2_fop_move_add(sd->obj, - fp, buf, - NULL, 0, 0); -// if (ecore_file_exists(buf)) -// { -// /* FIXME: error - file exists */ -// } -// else -///*FOPME*/ ecore_file_mv(fp, buf); evas_stringshare_del(fp); } } @@ -3390,28 +3392,16 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event) else { if (sd->config->view.link_drop) - e_fm2_fop_link_add(sd->obj, fp, buf); + { + printf("ln -s %s %s\n", (char *)fp, buf); + } else - e_fm2_fop_move_add(sd->obj, - fp, buf, - NULL, 0, 0); + { + printf("mv %s %s\n", (char *)fp, buf); + } } free(d); } -// d = ecore_file_get_dir(fp); -// if (d) -// { -// if (!strcmp(d, sd->realpath)) -// { -// printf("listrm %s\n", ecore_file_get_file(fp)); -// _e_fm2_live_file_del(sd->obj, ecore_file_get_file(fp)); -// } -// else -// { -///*FOPME*/ ecore_file_symlink(fp, buf); -// } -// free(d); -// } evas_stringshare_del(fp); } if (sd->drop_after == 0) @@ -3420,7 +3410,9 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event) { fp = _e_fm2_icon_desktop_url_eval(ll->data); if (!fp) continue; +/* e_fm2_fop_add_add(sd->obj, fp, sd->drop_icon->info.file, 0); + */ // printf("listadd %s, before %s\n", ecore_file_get_file(fp), sd->drop_icon->info.file); // _e_fm2_live_file_add(sd->obj, // ecore_file_get_file(fp), @@ -3434,7 +3426,9 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event) { fp = _e_fm2_icon_desktop_url_eval(ll->data); if (!fp) continue; +/* e_fm2_fop_add_add(sd->obj, fp, sd->drop_icon->info.file, 1); + */ // printf("listadd %s, after %s\n", ecore_file_get_file(fp), sd->drop_icon->info.file); // _e_fm2_live_file_add(sd->obj, // ecore_file_get_file(fp), @@ -3453,20 +3447,6 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event) snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, ecore_file_get_file(fp)); printf("mv %s %s\n", (char *)fp, buf); - e_fm2_fop_move_add(sd->obj, - fp, buf, - NULL, 0, 1); -// if (ecore_file_exists(buf)) -// { -// /* FIXME: error - file exists */ -// } -// else -// { -///*FOPME*/ if (ecore_file_mv(fp, buf)) -// _e_fm2_live_file_add(sd->obj, -// ecore_file_get_file(fp), -// NULL, 0); -// } evas_stringshare_del(fp); } } @@ -3618,10 +3598,7 @@ _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf char buf[4096], *dev = NULL; if (ic->sd->dev) dev = strdup(ic->sd->dev); - if (ic->info.pseudo_link) - snprintf(buf, sizeof(buf), "%s/%s", ic->info.pseudo_dir, ic->info.file); - else - snprintf(buf, sizeof(buf), "%s/%s", ic->sd->path, ic->info.file); + snprintf(buf, sizeof(buf), "%s/%s", ic->sd->path, ic->info.file); e_fm2_path_set(ic->sd->obj, dev, buf); E_FREE(dev); } @@ -3747,15 +3724,10 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf { ici = l->data; /* file:///path is correct: file:/// with null */ - if (ici->pseudo_link) - snprintf(buf, sizeof(buf), "file://%s/%s", ici->pseudo_dir, ici->file); + if (!strcmp(realpath, "/")) + snprintf(buf, sizeof(buf), "file:///%s", ici->file); else - { - if (!strcmp(realpath, "/")) - snprintf(buf, sizeof(buf), "file:///%s", ici->file); - else - snprintf(buf, sizeof(buf), "file://%s/%s", realpath, ici->file); - } + snprintf(buf, sizeof(buf), "file://%s/%s", realpath, ici->file); fsel = evas_list_append(fsel, strdup(buf)); } evas_list_free(sl); @@ -3976,10 +3948,7 @@ _e_fm2_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info) char buf[4096], *dev = NULL; if (ic->sd->dev) dev = strdup(ic->sd->dev); - if (ic->info.pseudo_link) - snprintf(buf, sizeof(buf), "%s/%s", ic->info.pseudo_dir, ic->info.file); - else - snprintf(buf, sizeof(buf), "%s/%s", ic->sd->path, ic->info.file); + snprintf(buf, sizeof(buf), "%s/%s", ic->sd->path, ic->info.file); e_fm2_path_set(ic->sd->obj, dev, buf); E_FREE(dev); } @@ -4115,7 +4084,13 @@ _e_fm2_cb_resize_job(void *data) if (sd->iconlist_changed) { for (l = sd->icons; l; l = l->next) - _e_fm2_icon_unrealize(l->data); + { + E_Fm2_Icon *ic; + + ic = l->data; + ic->region = NULL; +// _e_fm2_icon_unrealize(ic); + } } _e_fm2_regions_free(sd->obj); _e_fm2_icons_place(sd->obj); @@ -4184,74 +4159,6 @@ _e_fm2_cb_icon_sort(void *data1, void *data2) return strcmp(l1, l2); } -static int -_e_fm2_cb_scan_idler(void *data) -{ - E_Fm2_Smart_Data *sd; - struct dirent *dp; - int len; - char buf[4096]; - - sd = evas_object_smart_data_get(data); - if (!sd) return 0; - - if ((!sd->dir) && (!sd->order)) - { - if (!sd->order_file) - { - snprintf(buf, sizeof(buf), "%s/.order", sd->realpath); - sd->order = fopen(buf, "rb"); - if (sd->order) sd->order_file = 1; - } - if (!sd->order) - { -// sd->order_file = 0; - sd->dir = opendir(sd->realpath); - if (!sd->dir) goto endscan; - } - } - - if (sd->order) - { - if (!fgets(buf, sizeof(buf), sd->order)) - { - /* stop order file read - now pick up real files */ - fclose(sd->order); - sd->order = NULL; - } - else - { - len = strlen(buf); - if ((len > 0) && (buf[len - 1] == '\n')) buf[len - 1] = 0; - _e_fm2_file_add(data, buf, 0, NULL, 0); - } - } - else if (sd->dir) - { - dp = readdir(sd->dir); - if (!dp) goto endscan; - /* no - you don't want the current and parent dir links listed */ - if ((!strcmp(dp->d_name, ".")) || (!strcmp(dp->d_name, ".."))) return 1; - /* skip dotfiles if we're not showing hidden files */ - if (dp->d_name[0] == '.' && !sd->show_hidden_files) return 1; - /* always hide .order files */ - if (!strcmp(dp->d_name, ".order")) return 1; - _e_fm2_file_add(data, dp->d_name, sd->order_file, NULL, 0); - } - return 1; - - endscan: - sd->scan_idler = NULL; - if (sd->scan_timer) - { - ecore_timer_del(sd->scan_timer); - sd->scan_timer = ecore_timer_add(0.0001, _e_fm2_cb_scan_timer, sd->obj); - } - else - _e_fm2_scan_stop(data); - return 0; -} - static int _e_fm2_cb_scan_timer(void *data) { @@ -4261,12 +4168,12 @@ _e_fm2_cb_scan_timer(void *data) if (!sd) return 0; _e_fm2_queue_process(data); sd->scan_timer = NULL; - if ((!sd->queue) && (!sd->scan_idler)) + if (!sd->listing) { - _e_fm2_scan_stop(data); + _e_fm2_client_monitor_list_end(data); return 0; } - if (sd->scan_idler) + if (sd->busy_count > 0) sd->scan_timer = ecore_timer_add(0.2, _e_fm2_cb_scan_timer, sd->obj); else { @@ -4284,10 +4191,10 @@ _e_fm2_cb_sort_idler(void *data) sd = evas_object_smart_data_get(data); if (!sd) return 0; _e_fm2_queue_process(data); - if (!sd->queue) + if (!sd->listing) { sd->sort_idler = NULL; - _e_fm2_scan_stop(data); + _e_fm2_client_monitor_list_end(data); return 0; } return 1; @@ -4335,6 +4242,9 @@ _e_fm2_smart_add(Evas_Object *obj) sd = E_NEW(E_Fm2_Smart_Data, 1); if (!sd) return; + + _e_fm2_id++; + sd->id = _e_fm2_id; sd->obj = obj; sd->clip = evas_object_rectangle_add(evas_object_evas_get(obj)); evas_object_smart_member_add(sd->clip, obj); @@ -4386,15 +4296,8 @@ _e_fm2_smart_del(Evas_Object *obj) sd = evas_object_smart_data_get(obj); if (!sd) return; - _e_fm2_fop_detach(sd); - - if (sd->monitor.monitor) - { - ecore_file_monitor_del(sd->monitor.monitor); - sd->monitor.monitor = NULL; - } + if (sd->realpath) _e_fm2_client_monitor_del(sd->id, sd->realpath); _e_fm2_live_process_end(obj); - _e_fm2_scan_stop(obj); _e_fm2_queue_free(obj); _e_fm2_regions_free(obj); _e_fm2_icons_free(obj); @@ -4545,7 +4448,7 @@ _e_fm2_order_file_rewrite(Evas_Object *obj) E_Fm2_Icon *ic; FILE *f; char buf[4096]; - + sd = evas_object_smart_data_get(obj); if (!sd) return; snprintf(buf, sizeof(buf), "%s/.order", sd->realpath); @@ -4644,6 +4547,7 @@ _e_fm2_menu(Evas_Object *obj, unsigned int timestamp) if (!(sd->icon_menu.flags & E_FM2_MENU_NO_NEW_DIRECTORY)) { + /* FIXME: stat the dir itself - move to e_fm_main */ if (ecore_file_can_write(sd->realpath)) { mi = e_menu_item_new(mn); @@ -4785,6 +4689,7 @@ _e_fm2_icon_menu(E_Fm2_Icon *ic, Evas_Object *obj, unsigned int timestamp) if (!(sd->icon_menu.flags & E_FM2_MENU_NO_NEW_DIRECTORY)) { + /* FIXME: stat the dir itself - move to e_fm_main */ if (ecore_file_can_write(sd->realpath)) { mi = e_menu_item_new(mn); @@ -4805,13 +4710,11 @@ _e_fm2_icon_menu(E_Fm2_Icon *ic, Evas_Object *obj, unsigned int timestamp) if (ic->sd->order_file) { snprintf(buf, sizeof(buf), "%s/.order", sd->realpath); + /* FIXME: stat the .order itself - move to e_fm_main */ can_w2 = ecore_file_can_write(buf); } - if (ic->info.pseudo_link) - snprintf(buf, sizeof(buf), "%s/%s", ic->info.pseudo_dir, ic->info.file); - else - snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, ic->info.file); - if ((ic->info.link) && (!ic->info.pseudo_link)) + snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, ic->info.file); + if (ic->info.link) { struct stat st; @@ -4831,12 +4734,6 @@ _e_fm2_icon_menu(E_Fm2_Icon *ic, Evas_Object *obj, unsigned int timestamp) } } } - else - { - if (ic->info.pseudo_link) - snprintf(buf, sizeof(buf), "%s/.order", sd->realpath); - if (ecore_file_can_write(buf)) can_w = 1; - } sel = e_fm2_selected_list_get(ic->sd->obj); if ((!sel) || evas_list_count(sel) == 1) @@ -4960,6 +4857,7 @@ _e_fm2_toggle_ordering(void *data, E_Menu *m, E_Menu_Item *mi) if (sd->order_file) { snprintf(buf, sizeof(buf), "%s/.order", sd->realpath); + /* FIXME: move to e_fm_main */ ecore_file_unlink(buf); } else @@ -5028,6 +4926,7 @@ _e_fm2_new_directory_yes_cb(char *text, void *data) { snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, text); + /* FIXME: move to e_fm_main */ if (!ecore_file_mkdir(buf)) { man = e_manager_current_get(); @@ -5048,24 +4947,7 @@ _e_fm2_new_directory_yes_cb(char *text, void *data) e_dialog_show(dialog); return; } -/* - if (sd->order_file) - { - FILE *f; - - snprintf(buf, sizeof(buf), "%s/.order", sd->realpath); - f = fopen(buf, "a"); - if (f) - { - fprintf(f, "%s\n", text); - fclose(f); - } - } - */ - _e_fm2_live_file_add(sd->obj, text, NULL, 0); - /* FIXME: disable refresh - modify icons in-place */ -// if (sd->refresh_job) ecore_job_del(sd->refresh_job); -// sd->refresh_job = ecore_job_add(_e_fm2_refresh_job_cb, sd->obj); + _e_fm2_live_file_add(sd->obj, text, NULL, 0, NULL); } } @@ -5129,18 +5011,11 @@ _e_fm2_file_rename_yes_cb(char *text, void *data) ic->entry_dialog = NULL; if ((text) && (strcmp(text, ic->info.file))) { - if (ic->info.pseudo_link) - { - snprintf(oldpath, sizeof(oldpath), "%s/%s", ic->info.pseudo_dir, ic->info.file); - snprintf(newpath, sizeof(newpath), "%s/%s", ic->info.pseudo_dir, text); - } - else - { - snprintf(oldpath, sizeof(oldpath), "%s/%s", ic->sd->realpath, ic->info.file); - snprintf(newpath, sizeof(newpath), "%s/%s", ic->sd->realpath, text); - } + snprintf(oldpath, sizeof(oldpath), "%s/%s", ic->sd->realpath, ic->info.file); + snprintf(newpath, sizeof(newpath), "%s/%s", ic->sd->realpath, text); if (e_filereg_file_protected(oldpath)) return; + /* FIXME: move to e_fm_main */ if (!ecore_file_mv(oldpath, newpath)) { man = e_manager_current_get(); @@ -5162,13 +5037,7 @@ _e_fm2_file_rename_yes_cb(char *text, void *data) } e_fm2_custom_file_rename(oldpath, newpath); _e_fm2_live_file_del(ic->sd->obj, ic->info.file); - _e_fm2_live_file_add(ic->sd->obj, text, NULL, 0); -// evas_stringshare_del(ic->info.file); -// ic->info.file = evas_stringshare_add(text); -// if (ic->sd->order_file) _e_fm2_order_file_rewrite(ic->sd->obj); - /* FIXME: disable refresh - modify icons in-place */ -// if (ic->sd->refresh_job) ecore_job_del(ic->sd->refresh_job); -// ic->sd->refresh_job = ecore_job_add(_e_fm2_refresh_job_cb, ic->sd->obj); + _e_fm2_live_file_add(ic->sd->obj, text, NULL, 0, NULL); } } @@ -5262,7 +5131,6 @@ _e_fm2_file_delete_yes_cb(void *data, E_Dialog *dialog) char buf[4096]; Evas_List *sel, *l; E_Fm2_Icon_Info *ici; - int ok; ic = data; ic->dialog = NULL; @@ -5273,97 +5141,21 @@ _e_fm2_file_delete_yes_cb(void *data, E_Dialog *dialog) { for (l = sel; l; l = l->next) { - ok = 1; ici = l->data; - if (!ici->pseudo_link) - { - snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ici->file); - if (e_filereg_file_protected(buf)) continue; - - /* FIXME: recursive rm might block - need to get smart */ - e_fm2_fop_delete_add(ic->sd->obj, ici); -/* - if (!(ecore_file_recursive_rm(buf))) - { - char text[4096 + 256]; - - ok = 0; - man = e_manager_current_get(); - if (man) - { - con = e_container_current_get(man); - if (con) - { - dialog = e_dialog_new(con, "E", "_fm_file_delete_error_dialog"); - e_dialog_button_add(dialog, _("OK"), NULL, NULL, NULL); - e_dialog_button_focus_num(dialog, 1); - e_dialog_title_set(dialog, _("Error")); - snprintf(text, sizeof(text), - _("Could not delete
" - "%s"), buf); - e_dialog_text_set(dialog, text); - e_win_centered_set(dialog->win, 1); - e_dialog_show(dialog); - // e_object_del(E_OBJECT(dialog)); - } - } - } - else - */ -// ici->deleted = 1; - ok = 0; - } - else ici->deleted = 1; - if (ok) _e_fm2_live_file_del(ic->sd->obj, ici->file); + snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ici->file); + if (e_filereg_file_protected(buf)) continue; + + printf("rm -rf %s\n", buf); } evas_list_free(sel); } else { - if (!ic->info.pseudo_link) - { - snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file); - if (e_filereg_file_protected(buf)) return; - - /* FIXME: recursive rm might block - need to get smart */ - e_fm2_fop_delete_add(ic->sd->obj, &(ic->info)); -/* - if (!(ecore_file_recursive_rm(buf))) - { - char text[4096 + 256]; - - man = e_manager_current_get(); - if (!man) return; - con = e_container_current_get(man); - if (!con) return; - - dialog = e_dialog_new(con, "E", "_fm_file_delete_error_dialog"); - e_dialog_button_add(dialog, _("OK"), NULL, NULL, NULL); - e_dialog_button_focus_num(dialog, 1); - e_dialog_title_set(dialog, _("Error")); - snprintf(text, sizeof(text), - _("Could not delete
" - "%s"), buf); - e_dialog_text_set(dialog, text); - e_win_centered_set(dialog->win, 1); - e_dialog_show(dialog); - // e_object_del(E_OBJECT(dialog)); - return; - } - */ - } - else - { - ic->info.deleted = 1; - _e_fm2_live_file_del(ic->sd->obj, ic->info.file); - } + snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file); + if (e_filereg_file_protected(buf)) return; + printf("rm -rf %s\n", buf); } -// if (ic->sd->order_file) _e_fm2_order_file_rewrite(ic->sd->obj); - /* FIXME: disable refresh - modify icons in-place */ -// if (ic->sd->refresh_job) ecore_job_del(ic->sd->refresh_job); -// ic->sd->refresh_job = ecore_job_add(_e_fm2_refresh_job_cb, ic->sd->obj); - evas_object_smart_callback_call(ic->sd->obj, "files_deleted", NULL); } @@ -5392,7 +5184,7 @@ _e_fm2_refresh_job_cb(void *data) static void -_e_fm2_live_file_add(Evas_Object *obj, const char *file, const char *file_rel, int after) +_e_fm2_live_file_add(Evas_Object *obj, const char *file, const char *file_rel, int after, E_Fm2_Finfo *finf) { E_Fm2_Smart_Data *sd; E_Fm2_Action *a; @@ -5406,6 +5198,9 @@ _e_fm2_live_file_add(Evas_Object *obj, const char *file, const char *file_rel, i a->file = evas_stringshare_add(file); if (file_rel) a->file2 = evas_stringshare_add(file_rel); a->flags = after; + memcpy(&(a->finf), finf, sizeof(E_Fm2_Finfo)); + a->finf.lnk = evas_stringshare_add(a->finf.lnk); + a->finf.rlnk = evas_stringshare_add(a->finf.rlnk); _e_fm2_live_process_begin(obj); } @@ -5426,7 +5221,7 @@ _e_fm2_live_file_del(Evas_Object *obj, const char *file) } static void -_e_fm2_live_file_changed(Evas_Object *obj, char *file) +_e_fm2_live_file_changed(Evas_Object *obj, const char *file, E_Fm2_Finfo *finf) { E_Fm2_Smart_Data *sd; E_Fm2_Action *a; @@ -5438,6 +5233,9 @@ _e_fm2_live_file_changed(Evas_Object *obj, char *file) sd->live.actions = evas_list_append(sd->live.actions, a); a->type = FILE_CHANGE; a->file = evas_stringshare_add(file); + memcpy(&(a->finf), finf, sizeof(E_Fm2_Finfo)); + a->finf.lnk = evas_stringshare_add(a->finf.lnk); + a->finf.rlnk = evas_stringshare_add(a->finf.rlnk); _e_fm2_live_process_begin(obj); } @@ -5447,10 +5245,9 @@ _e_fm2_live_process_begin(Evas_Object *obj) E_Fm2_Smart_Data *sd; sd = evas_object_smart_data_get(obj); - if ((sd->order) || (sd->dir)) return; if (!sd->live.actions) return; if ((sd->live.idler) || (sd->live.timer) || - (sd->scan_idler) || (sd->scan_timer)) return; + (sd->listing) || (sd->scan_timer)) return; sd->live.idler = ecore_idler_add(_e_fm2_cb_live_idler, obj); sd->live.timer = ecore_timer_add(0.2, _e_fm2_cb_live_timer, obj); } @@ -5468,6 +5265,8 @@ _e_fm2_live_process_end(Evas_Object *obj) sd->live.actions = evas_list_remove_list(sd->live.actions, sd->live.actions); if (a->file) evas_stringshare_del(a->file); if (a->file2) evas_stringshare_del(a->file2); + if (a->finf.lnk) evas_stringshare_del(a->finf.lnk); + if (a->finf.rlnk) evas_stringshare_del(a->finf.rlnk); free(a); } if (sd->live.idler) @@ -5499,9 +5298,11 @@ _e_fm2_live_process(Evas_Object *obj) case FILE_ADD: /* new file to sort in place */ if (!((a->file[0] == '.') && (!sd->show_hidden_files))) - _e_fm2_file_add(obj, a->file, 1, a->file2, a->flags); + _e_fm2_file_add(obj, a->file, 1, a->file2, a->flags, &(a->finf)); break; case FILE_DEL: + if (!strcmp(a->file, ".order")) + sd->order_file = 0; if (!((a->file[0] == '.') && (!sd->show_hidden_files))) _e_fm2_file_del(obj, a->file); sd->live.deletions = 1; @@ -5519,7 +5320,7 @@ _e_fm2_live_process(Evas_Object *obj) realized = ic->realized; if (realized) _e_fm2_icon_unrealize(ic); _e_fm2_icon_unfill(ic); - _e_fm2_icon_fill(ic); + _e_fm2_icon_fill(ic, &(a->finf)); if (realized) _e_fm2_icon_realize(ic); break; } @@ -5531,6 +5332,8 @@ _e_fm2_live_process(Evas_Object *obj) } if (a->file) evas_stringshare_del(a->file); if (a->file2) evas_stringshare_del(a->file2); + if (a->finf.lnk) evas_stringshare_del(a->finf.lnk); + if (a->finf.rlnk) evas_stringshare_del(a->finf.rlnk); free(a); } @@ -5553,7 +5356,10 @@ _e_fm2_cb_live_idler(void *data) _e_fm2_live_process_end(data); _e_fm2_cb_live_timer(data); if ((sd->order_file) || (sd->config->view.always_order)) - _e_fm2_order_file_rewrite(data); + { + printf("attempt rewrite of order 3\n"); + _e_fm2_order_file_rewrite(data); + } sd->live.idler = NULL; return 0; } @@ -5587,368 +5393,6 @@ _e_fm2_cb_live_timer(void *data) return 0; } -static void -_e_fm2_cb_file_monitor(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path) -{ - E_Fm2_Smart_Data *sd; - char *file; - - sd = evas_object_smart_data_get(data); - if (!sd) return; - file = (char *)ecore_file_get_file(path); - if (!strcmp(file, ".order")) - { - /* FIXME: for now, ignore, BUT later load up .order - compare with icon - * order in list and fi they differ - use new .order */ - } - else - { - if ((event == ECORE_FILE_EVENT_CREATED_FILE) || - (event == ECORE_FILE_EVENT_CREATED_DIRECTORY)) - { - _e_fm2_live_file_add(sd->obj, file, NULL, 0); -// printf("FADD %s\n", file); - } - else if ((event == ECORE_FILE_EVENT_DELETED_FILE) || - (event == ECORE_FILE_EVENT_DELETED_DIRECTORY)) - { - _e_fm2_live_file_del(sd->obj, file); -// printf("FDEL %s\n", file); - } - else if (event == ECORE_FILE_EVENT_MODIFIED) - { - _e_fm2_live_file_changed(sd->obj, file); -// printf("FMOD %s\n", file); - } - else if (event == ECORE_FILE_EVENT_DELETED_SELF) - { - evas_object_smart_callback_call(sd->obj, "dir_deleted", NULL); - } - } -} - -static E_Fm2_Fop * -_e_fm2_fop_add(E_Fm2_Smart_Data *sd) -{ - if (!sd->fop) - { - sd->fop = E_NEW(E_Fm2_Fop, 1); - if (!sd->fop) return NULL; - sd->fop->obj = sd->obj; - sd->fop->dir = evas_stringshare_add(e_fm2_real_path_get(sd->obj)); - if (!sd->fop->dir) - { - free(sd->fop); - sd->fop = NULL; - return NULL; - } - sd->fop->idler = ecore_idler_add(_e_fm2_cb_fop_idler, sd->fop); - if (!sd->fop->idler) - { - evas_stringshare_del(sd->fop->dir); - free(sd->fop); - sd->fop = NULL; - return NULL; - } - sd->fop->timer = ecore_timer_add(0.2, _e_fm2_cb_fop_timer, sd->fop); - sd->busy_count++; - if (sd->busy_count == 1) - edje_object_signal_emit(sd->overlay, "e,state,busy,start", "e"); - } - _e_fm2_fop_list = evas_list_append(_e_fm2_fop_list, sd->fop); - return sd->fop; -} - -static void -_e_fm2_fop_del(E_Fm2_Fop *fop) -{ - if (fop->idler) - { - ecore_idler_del(fop->idler); - fop->idler = NULL; - } - if (fop->timer) - { - _e_fm2_cb_fop_timer(fop); - ecore_timer_del(fop->timer); - fop->timer = NULL; - } - if (fop->dir) - { - evas_stringshare_del(fop->dir); - fop->dir = NULL; - } - if (fop->obj) - { - E_Fm2_Smart_Data *sd; - - sd = evas_object_smart_data_get(fop->obj); - if (sd) sd->fop = NULL; - fop->obj = NULL; - sd->busy_count--; - if (sd->busy_count == 0) - edje_object_signal_emit(sd->overlay, "e,state,busy,stop", "e"); - } - _e_fm2_fop_list = evas_list_remove(_e_fm2_fop_list, fop); - free(fop); -} - -static void -_e_fm2_fop_detach(E_Fm2_Smart_Data *sd) -{ - if (!sd->fop) return; - sd->fop->obj = NULL; - sd->fop = NULL; - sd->busy_count--; - if (sd->busy_count == 0) - edje_object_signal_emit(sd->overlay, "e,state,busy,stop", "e"); -} - -static int -_e_fm2_fop_process(E_Fm2_Fop *fop) -{ - E_Fm2_Fop_Item *fi, *fi2; - char buf[4096]; - struct dirent *dp; - E_Manager *man; - E_Container *con; - E_Dialog *dialog; - - if (!fop->items) return 0; - fi = fop->items->data; - switch (fi->type) - { - case FOP_DELETE: - if (fi->dir) - { - dp = readdir(fi->dir); - if (!dp) - { - snprintf(buf, sizeof(buf), "%s/%s", fi->fop->dir, fi->file); - if (ecore_file_rmdir(buf)) - { - if ((fi->fop->obj) && (!strchr(fi->file, '/'))) - _e_fm2_live_file_del(fi->fop->obj, fi->file); - } - /* FIXME: if deletign vast dirs and lots of errors happen - * we need a central dialog that just collects all of them - * and not have dozens or 100's of dialogs */ - else - { - char text[4096 + 256]; - - man = e_manager_current_get(); - if (man) - { - con = e_container_current_get(man); - if (con) - { - dialog = e_dialog_new(con, "E", "_fm_file_delete_error_dialog"); - e_dialog_button_add(dialog, _("OK"), NULL, NULL, NULL); - e_dialog_button_focus_num(dialog, 1); - e_dialog_title_set(dialog, _("Error")); - snprintf(text, sizeof(text), - _("Could not delete
" - "%s"), buf); - e_dialog_text_set(dialog, text); - e_win_centered_set(dialog->win, 1); - e_dialog_show(dialog); - } - } - } - } - else - { - if ((!strcmp(dp->d_name, ".")) || (!strcmp(dp->d_name, ".."))) return 1; - fi2 = E_NEW(E_Fm2_Fop_Item, 1); - fi2->fop = fop; - fi2->type = FOP_DELETE; - snprintf(buf, sizeof(buf), "%s/%s/%s", fi->fop->dir, fi->file, dp->d_name); - if (ecore_file_is_dir(buf)) - { - char *lnk; - - lnk = ecore_file_readlink(buf); - if (lnk) free(lnk); - else fi2->is_dir = 1; - } - snprintf(buf, sizeof(buf), "%s/%s", fi->file, dp->d_name); - fi2->file = evas_stringshare_add(buf); - fi->fop->items = evas_list_prepend(fi->fop->items, fi2); -// printf("ADD: %s\n", fi2->file); - return 1; - } - } - else if (fi->is_dir) - { - snprintf(buf, sizeof(buf), "%s/%s", fi->fop->dir, fi->file); - fi->dir = opendir(buf); - if (!fi->dir) - { - if (ecore_file_rmdir(buf)) - { - if ((fi->fop->obj) && (!strchr(fi->file, '/'))) - _e_fm2_live_file_del(fi->fop->obj, fi->file); - } - /* FIXME: if deletign vast dirs and lots of errors happen - * we need a central dialog that just collects all of them - * and not have dozens or 100's of dialogs */ - else - { - char text[4096 + 256]; - - man = e_manager_current_get(); - if (man) - { - con = e_container_current_get(man); - if (con) - { - dialog = e_dialog_new(con, "E", "_fm_file_delete_error_dialog"); - e_dialog_button_add(dialog, _("OK"), NULL, NULL, NULL); - e_dialog_button_focus_num(dialog, 1); - e_dialog_title_set(dialog, _("Error")); - snprintf(text, sizeof(text), - _("Could not delete
" - "%s"), buf); - e_dialog_text_set(dialog, text); - e_win_centered_set(dialog->win, 1); - e_dialog_show(dialog); - } - } - } - } - else - return 1; - } - else - { - snprintf(buf, sizeof(buf), "%s/%s", fi->fop->dir, fi->file); - if (ecore_file_unlink(buf)) - { - e_fm2_custom_file_del(buf); - if ((fi->fop->obj) && (!strchr(fi->file, '/'))) - _e_fm2_live_file_del(fi->fop->obj, fi->file); - } - /* FIXME: if deletign vast dirs and lots of errors happen - * we need a central dialog that just collects all of them - * and not have dozens or 100's of dialogs */ - else - { - char text[4096 + 256]; - - man = e_manager_current_get(); - if (man) - { - con = e_container_current_get(man); - if (con) - { - dialog = e_dialog_new(con, "E", "_fm_file_delete_error_dialog"); - e_dialog_button_add(dialog, _("OK"), NULL, NULL, NULL); - e_dialog_button_focus_num(dialog, 1); - e_dialog_title_set(dialog, _("Error")); - snprintf(text, sizeof(text), - _("Could not delete
" - "%s"), buf); - e_dialog_text_set(dialog, text); - e_win_centered_set(dialog->win, 1); - e_dialog_show(dialog); - } - } - } - } - break; - case FOP_MOVE: - /* FIXME: handle moves */ - if (ecore_file_exists(fi->file2)) - { - /* FIXME: error - file exists */ - } - else - { - if (ecore_file_mv(fi->file, fi->file2)) - { - e_fm2_custom_file_rename(fi->file, fi->file2); - if ((fi->fop->obj) && (fi->file_add)) - _e_fm2_live_file_add(fi->fop->obj, - fi->file, fi->file3, fi->after); - } - else - { - /* FIXME: error - move failed */ - } - } - break; - case FOP_LINK: - if (!ecore_file_symlink(fi->file, fi->file2)) - { - /* FIXME: error - symlink failed */ - } - break; - case FOP_ADD: - if (fi->fop->obj) - _e_fm2_live_file_add(fi->fop->obj, - ecore_file_get_file(fi->file), - fi->file3, fi->after); - break; - default: - break; - } - /* remove and free */ - fop->items = evas_list_remove_list(fop->items, fop->items); - if (fi->file) - { - evas_stringshare_del(fi->file); - fi->file = NULL; - } - if (fi->file2) - { - evas_stringshare_del(fi->file2); - fi->file2 = NULL; - } - if (fi->file3) - { - evas_stringshare_del(fi->file3); - fi->file3 = NULL; - } - if (fi->dir) - { - closedir(fi->dir); - fi->dir = NULL; - } - free(fi); - if (!fop->items) return 0; - return 1; -} - -static int -_e_fm2_cb_fop_idler(void *data) -{ - E_Fm2_Fop *fop; - - fop = data; - if (!_e_fm2_fop_process(fop)) - { - _e_fm2_fop_del(fop); - return 0; - } - return 1; -} - -static int -_e_fm2_cb_fop_timer(void *data) -{ - E_Fm2_Fop *fop; - E_Fm2_Smart_Data *sd; - char buf[4096]; - - fop = data; - if (!fop->obj) return 1; - sd = evas_object_smart_data_get(fop->obj); - snprintf(buf, sizeof(buf), _("%i Queued"), evas_list_count(fop->items)); - edje_object_part_text_set(sd->overlay, "e.text.busy_label", buf); - return 1; -} - typedef struct _E_Fm2_Removable E_Fm2_Removable; struct _E_Fm2_Removable @@ -5972,7 +5416,9 @@ _e_fm2_removable_dev_label_get(const char *uuid) // FIXME: 1. look in config - is there a mapping from uuid -> label // FIXME: 2. look at dev info to get its label snprintf(buf, sizeof(buf), "/dev/disk/by-uuid/%s", uuid); + /* FIXME: move to e_fm_main */ rp1 = ecore_file_realpath(buf); + /* FIXME: move to e_fm_main */ files = ecore_file_ls("/dev/disk/by-label"); if (files) { @@ -5980,6 +5426,7 @@ _e_fm2_removable_dev_label_get(const char *uuid) while ((file = ecore_list_current(files))) { snprintf(buf, sizeof(buf), "/dev/disk/by-label/%s", file); + /* FIXME: move to e_fm_main */ rp2 = ecore_file_realpath(buf); printf("%s (%s) == %s\n", rp2, file, rp1); if ((rp1) && (rp2)) @@ -6094,6 +5541,7 @@ _e_fm2_removable_dev_del(const char *uuid) _e_fm2_removable_dev_umount(uuid); snprintf(buf, sizeof(buf), "%s/.e/e/fileman/favorites/|%s.desktop", e_user_homedir_get(), uuid); + /* FIXME: move to e_fm_main */ ecore_file_unlink(buf); for (l = _e_fm2_removables; l; l = l->next) { diff --git a/src/bin/e_fm.h b/src/bin/e_fm.h index dbdefc119..86f0b72cd 100644 --- a/src/bin/e_fm.h +++ b/src/bin/e_fm.h @@ -56,7 +56,6 @@ struct _E_Fm2_Config /* general view mode */ struct { E_Fm2_View_Mode mode; - const char *extra_file_source; unsigned char open_dirs_in_place; unsigned char selector; unsigned char single_click; @@ -118,12 +117,10 @@ struct _E_Fm2_Icon_Info const char *icon; const char *link; const char *real_link; - const char *pseudo_dir; struct stat statinfo; unsigned char icon_type; unsigned char mount : 1; unsigned char removable : 1; - unsigned char pseudo_link : 1; unsigned char deleted : 1; unsigned char broken_link : 1; }; @@ -180,10 +177,12 @@ EAPI void e_fm2_pan_child_size_get(Evas_Object *obj, Evas_Coord EAPI void e_fm2_all_icons_update(void); +/* EAPI void e_fm2_fop_delete_add(Evas_Object *obj, E_Fm2_Icon_Info *ici); EAPI void e_fm2_fop_move_add(Evas_Object *obj, const char *src, const char *dst, const char *rel, int after, int file_add); EAPI void e_fm2_fop_link_add(Evas_Object *obj, const char *src, const char *dst); EAPI void e_fm2_fop_add_add(Evas_Object *obj, const char *file, const char *rel, int after); +*/ EAPI Evas_Object * e_fm2_icon_get(Evas *evas, const char *realpath, @@ -192,6 +191,9 @@ EAPI Evas_Object * void (*gen_func) (void *data, Evas_Object *obj, void *event_info), void *data, int force_gen, const char **type_ret); +EAPI void e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e); +EAPI void e_fm2_client_del(Ecore_Ipc_Event_Client_Del *e); + extern EAPI int E_EVENT_REMOVABLE_ADD; extern EAPI int E_EVENT_REMOVABLE_DEL; diff --git a/src/bin/e_fm_main.c b/src/bin/e_fm_main.c new file mode 100644 index 000000000..3b66f0fe9 --- /dev/null +++ b/src/bin/e_fm_main.c @@ -0,0 +1,669 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* FIXME: things to add to the slave enlightenment_fm process and ipc to e: + * + * * icon finding + * * .desktop parsing + * * file operations (fop's) (cp, mv, rm etc.) + * * reporting results of fop's + * * dbus removable device monitoring + * * mount/umount of removable devices + * + */ + +#define DEF_SYNC_NUM 8 +#define DEF_ROUND_TRIP 0.05 +#define DEF_ROUND_TRIP_TOLERANCE 0.01 + +typedef enum _E_Fop_Type +{ + E_FOP_NONE, + E_FOP_DEL, + E_FOP_TRASH, + E_FOP_RENAME, + E_FOP_MV, + E_FOP_CP, + E_FOP_MKDIR, + E_FOP_MOUNT, + E_FOP_UMOUNT, + E_FOP_LAST +} E_Fop_Type; + +typedef struct _E_Dir E_Dir; +typedef struct _E_Fop E_Fop; + +struct _E_Dir +{ + int id; + const char *dir; + Ecore_File_Monitor *mon; + int mon_ref; + Evas_List *fq; + Ecore_Idler *idler; + int dot_order; + int sync; + double sync_time; + int sync_num; +}; + +struct _E_Fop +{ + int id; + E_Fop_Type type; + const char *src; + const char *dst; +}; + +/* local subsystem functions */ +static int _e_ipc_init(void); +static int _e_ipc_cb_server_add(void *data, int type, void *event); +static int _e_ipc_cb_server_del(void *data, int type, void *event); +static int _e_ipc_cb_server_data(void *data, int type, void *event); + +static void _e_cb_file_monitor(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path); + +static void _e_file_add_mod(int id, const char *path, int op, int listing); +static void _e_file_add(int id, const char *path, int listing); +static void _e_file_del(int id, const char *path); +static void _e_file_mod(int id, const char *path); +static void _e_file_mon_dir_del(int id, const char *path); +static void _e_file_mon_list_sync(E_Dir *ed); + +static int _e_cb_file_mon_list_idler(void *data); +static char *_e_str_list_remove(Evas_List **list, char *str); + +/* local subsystem globals */ +static Ecore_Ipc_Server *_e_ipc_server = NULL; + +static Evas_List *_e_dirs = NULL; +static int _e_sync_num = 0; + +/* externally accessible functions */ +int +main(int argc, char **argv) +{ + int i; + + for (i = 1; i < argc; i++) + { + if ((!strcmp(argv[i], "-h")) || + (!strcmp(argv[i], "-help")) || + (!strcmp(argv[i], "--help"))) + { + printf( + "This is an internal tool for Enlightenment.\n" + "do not use it.\n" + ); + exit(0); + } + } + + ecore_init(); + ecore_app_args_set(argc, (const char **)argv); + eet_init(); + evas_init(); + edje_init(); + ecore_file_init(); + ecore_ipc_init(); + + if (_e_ipc_init()) ecore_main_loop_begin(); + + if (_e_ipc_server) + { + ecore_ipc_server_del(_e_ipc_server); + _e_ipc_server = NULL; + } + + ecore_ipc_shutdown(); + ecore_file_shutdown(); + ecore_evas_shutdown(); + edje_shutdown(); + evas_shutdown(); + eet_shutdown(); + ecore_shutdown(); + + return 0; +} + +/* local subsystem functions */ +static int +_e_ipc_init(void) +{ + char *sdir; + + sdir = getenv("E_IPC_SOCKET"); + if (!sdir) + { + printf("The E_IPC_SOCKET environment variable is not set. This is\n" + "exported by Enlightenment to all processes it launches.\n" + "This environment variable must be set and must point to\n" + "Enlightenment's IPC socket file (minus port number).\n"); + return 0; + } + _e_ipc_server = ecore_ipc_server_connect(ECORE_IPC_LOCAL_SYSTEM, sdir, 0, NULL); + if (!_e_ipc_server) + { + printf("Cannot connect to enlightenment - abort\n"); + return 0; + } + + ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD, _e_ipc_cb_server_add, NULL); + ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, _e_ipc_cb_server_del, NULL); + ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, _e_ipc_cb_server_data, NULL); + + return 1; +} + +static int +_e_ipc_cb_server_add(void *data, int type, void *event) +{ + Ecore_Ipc_Event_Server_Add *e; + + e = event; + ecore_ipc_server_send(e->server, + 6/*E_IPC_DOMAIN_FM*/, + 1/*hello*/, + 0, 0, 0, NULL, 0); /* send hello */ + return 1; +} + +static int +_e_ipc_cb_server_del(void *data, int type, void *event) +{ + Ecore_Ipc_Event_Server_Del *e; + + e = event; + /* quit now */ + ecore_main_loop_quit(); + return 1; +} + +static int +_e_ipc_cb_server_data(void *data, int type, void *event) +{ + Ecore_Ipc_Event_Server_Data *e; + + e = event; + if (e->major != 6/*E_IPC_DOMAIN_FM*/) return 1; + switch (e->minor) + { + case 1: /* monitor dir (and implicitly list) */ + { + E_Dir *ed, *ped = NULL; + DIR *dir; + + Evas_List *l; + + for (l = _e_dirs; l; l = l->next) + { + E_Dir *ed; + + ed = l->data; + if ((ed->mon) && (!strcmp(ed->dir, e->data))) + { + ped = ed; + break; + } + } + dir = opendir(e->data); + if (!dir) + { + _e_file_mon_dir_del(e->ref, e->data); + } + else + { + Evas_List *files = NULL; + struct dirent *dp; + int dot_order = 0; + char *file; + char buf[4096]; + FILE *f; + + ed = calloc(1, sizeof(E_Dir)); + ed->id = e->ref; + ed->dir = evas_stringshare_add(e->data); + if (!ped) + { + ed->mon = ecore_file_monitor_add(ed->dir, _e_cb_file_monitor, ed); + ed->mon_ref = 1; + } + else + ped->mon_ref++; + _e_dirs = evas_list_append(_e_dirs, ed); + + while (dp = readdir(dir)) + { + if ((!strcmp(dp->d_name, ".")) || (!strcmp(dp->d_name, ".."))) + continue; + if (!strcmp(dp->d_name, ".order")) dot_order = 1; + files = evas_list_append(files, strdup(dp->d_name)); + } + closedir(dir); + if (dot_order) + { + snprintf(buf, sizeof(buf), "%s/.order", e->data); + f = fopen(buf, "r"); + if (f) + { + Evas_List *f2 = NULL; + int len; + char *s; + + while (fgets(buf, sizeof(buf), f)) + { + len = strlen(buf); + if (len > 0) buf[len - 1] = 0; + s = _e_str_list_remove(&files, buf); + if (s) f2 = evas_list_append(f2, s); + } + fclose(f); + while (files) + { + f2 = evas_list_append(f2, files->data); + files = evas_list_remove_list(files, files); + } + files = f2; + } + } + /* FIXME: if .order file- load it, sort all items int it + * that are in files then just append whatever is left in + * alphabetical order + */ + /* FIXME: maybe one day we can sort files here and handle + * .order file stuff here - but not today + */ + ed->dot_order = dot_order; + if (dot_order) + { + if (!strcmp(e->data, "/")) + snprintf(buf, sizeof(buf), "/.order"); + else + snprintf(buf, sizeof(buf), "%s/.order", e->data); + if (evas_list_count(files) == 1) + _e_file_add(ed->id, buf, 2); + else + _e_file_add(ed->id, buf, 1); + } + ed->fq = files; + ed->idler = ecore_idler_add(_e_cb_file_mon_list_idler, ed); + ed->sync_num = DEF_SYNC_NUM; + } + } + break; + case 2: /* monitor dir end */ + { + Evas_List *l, *ll; + + for (l = _e_dirs; l; l = l->next) + { + E_Dir *ed; + + ed = l->data; + if ((e->ref == ed->id) && (!strcmp(ed->dir, e->data))) + { + if (ed->mon) + { + if (ed->mon_ref > 1) + { + for (ll = _e_dirs; ll; ll = ll->next) + { + E_Dir *ped; + + ped = ll->data; + if ((!ped->mon) && + (!strcmp(ped->dir, ed->dir))) + { + ped->mon = ed->mon; + ped->mon_ref = ed->mon_ref - 1; + goto contdel; + } + } + } + ecore_file_monitor_del(ed->mon); + } + contdel: + evas_stringshare_del(ed->dir); + if (ed->idler) ecore_idler_del(ed->idler); + while (ed->fq) + { + free(ed->fq->data); + ed->fq = evas_list_remove_list(ed->fq, ed->fq); + } + free(ed); + _e_dirs = evas_list_remove_list(_e_dirs, l); + break; + } + } + } + break; + case 3: /* fop delete file/dir */ + { + ecore_file_recursive_rm(e->data); + /* FIXME: send back file del if src is monitored */ + } + break; + case 4: /* fop trash file/dir */ + { + ecore_file_recursive_rm(e->data); + /* FIXME: send back file del if src is monitored */ + } + break; + case 5: /* fop rename file/dir */ + /* FIXME: send back file del + add if dir is monitored */ + break; + case 6: /* fop mv file/dir */ + /* FIXME: send back file del + add if src and dest are monitored */ + break; + case 7: /* fop cp file/dir */ + /* FIXME: send back file add if succeeded - and dest monitored */ + break; + case 8: /* fop mkdir */ + { + ecore_file_mkdir(e->data); + /* FIXME: send back file add if succeeded */ + } + break; + case 9: /* fop mount fs */ + /* FIXME: implement later - for now in e */ + break; + case 10: /* fop umount fs */ + /* FIXME: implement later - for now in e */ + break; + case 11: /* quit */ + ecore_main_loop_quit(); + break; + case 12: /* mon list sync */ + { + Evas_List *l; + double stime; + + for (l = _e_dirs; l; l = l->next) + { + E_Dir *ed; + + ed = l->data; + if (ed->fq) + { + if (ed->sync == e->response) + { + stime = ecore_time_get() - ed->sync_time; + /* try keep round trips to round trip tolerance */ + if + (stime < (DEF_ROUND_TRIP - DEF_ROUND_TRIP_TOLERANCE)) + ed->sync_num += 1; + else if + (stime > (DEF_ROUND_TRIP + DEF_ROUND_TRIP_TOLERANCE)) + ed->sync_num -= 1; + /* always sync at least 1 file */ + if (ed->sync_num < 1) ed->sync_num = 1; + ed->idler = ecore_idler_add(_e_cb_file_mon_list_idler, ed); + break; + } + } + } + } + break; + default: + break; + } + /* always send back an "OK" for each request so e can basically keep a + * count of outstanding requests - maybe for balancing between fm + * slaves later. ref_to is set to the the ref id in the request to + * allow for async handling later */ + ecore_ipc_server_send(_e_ipc_server, + 6/*E_IPC_DOMAIN_FM*/, + 2/*req ok*/, + 0, e->ref, 0, NULL, 0); + return 1; +} + +static void +_e_cb_file_monitor(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path) +{ + E_Dir *ed; + char *dir, *rp, *drp; + const char *file; + Evas_List *l; + + dir = ecore_file_get_dir(path); + file = ecore_file_get_file(path); + if ((event == ECORE_FILE_EVENT_CREATED_FILE) || + (event == ECORE_FILE_EVENT_CREATED_DIRECTORY)) + { + rp = ecore_file_realpath(dir); + for (l = _e_dirs; l; l = l->next) + { + ed = l->data; + drp = ecore_file_realpath(ed->dir); + if (!strcmp(rp, drp)) + _e_file_add(ed->id, path, 0); + free(drp); + } + free(rp); + } + else if ((event == ECORE_FILE_EVENT_DELETED_FILE) || + (event == ECORE_FILE_EVENT_DELETED_DIRECTORY)) + { + rp = ecore_file_realpath(dir); + for (l = _e_dirs; l; l = l->next) + { + ed = l->data; + drp = ecore_file_realpath(ed->dir); + if (!strcmp(rp, drp)) + _e_file_del(ed->id, path); + } + free(rp); + } + else if (event == ECORE_FILE_EVENT_MODIFIED) + { + rp = ecore_file_realpath(dir); + for (l = _e_dirs; l; l = l->next) + { + ed = l->data; + drp = ecore_file_realpath(ed->dir); + if (!strcmp(rp, drp)) + _e_file_mod(ed->id, path); + } + free(rp); + } + else if (event == ECORE_FILE_EVENT_DELETED_SELF) + { + rp = ecore_file_realpath(path); + for (l = _e_dirs; l; l = l->next) + { + ed = l->data; + drp = ecore_file_realpath(ed->dir); + if (!strcmp(rp, drp)) + _e_file_mon_dir_del(ed->id, path); + } + free(rp); + } + free(dir); +} + +static void +_e_file_add_mod(int id, const char *path, int op, int listing) +{ + struct stat st; + char *lnk = NULL, *rlnk = NULL; + int broken_lnk = 0; + int bsz = 0; + unsigned char *p, buf + /* file add/change format is as follows: + * + 8 stat_info[stat size] + broken_link[1] + path[n]\0 + lnk[n]\0 + rlnk[n]\0 */ + [sizeof(struct stat) + 1 + 4096 + 4096 + 4096]; + + lnk = ecore_file_readlink(buf); + if (stat(path, &st) == -1) + { + if (lnk) broken_lnk = 1; + else return; + } + if ((lnk) && (lnk[0] != '/')) rlnk = ecore_file_realpath(path); + if (!lnk) lnk = strdup(""); + if (!rlnk) rlnk = strdup(""); + + p = buf; + /* NOTE: i am NOT converting this data to portable arch/os independant + * format. i am ASSUMING e_fm_main and e are local and built together + * and thus this will work. if this ever changes this here needs to + * change */ + memcpy(buf, &st, sizeof(struct stat)); + p += sizeof(struct stat); + + p[0] = broken_lnk; + p += 1; + + strcpy(p, path); + p += strlen(path) + 1; + + strcpy(p, lnk); + p += strlen(lnk) + 1; + + strcpy(p, rlnk); + p += strlen(rlnk) + 1; + + bsz = p - buf; + ecore_ipc_server_send(_e_ipc_server, 6/*E_IPC_DOMAIN_FM*/, op, 0, id, + listing, buf, bsz); + if (lnk) free(lnk); + if (rlnk) free(rlnk); +} + +static void +_e_file_add(int id, const char *path, int listing) +{ +// printf("+++FADD %s\n", path); + _e_file_add_mod(id, path, 3, listing);/*file add*/ +} + +static void +_e_file_del(int id, const char *path) +{ +// printf("+++FDEL %s\n", path); + ecore_ipc_server_send(_e_ipc_server, + 6/*E_IPC_DOMAIN_FM*/, + 4/*file del*/, + 0, id, 0, (void *)path, strlen(path) + 1); +} + +static void +_e_file_mod(int id, const char *path) +{ +// printf("+++FMOD %s\n", path); + _e_file_add_mod(id, path, 5, 0);/*file change*/ +} + +static void +_e_file_mon_dir_del(int id, const char *path) +{ + ecore_ipc_server_send(_e_ipc_server, + 6/*E_IPC_DOMAIN_FM*/, + 6/*mon dir del*/, + 0, id, 0, (void *)path, strlen(path) + 1); +} + +static void +_e_file_mon_list_sync(E_Dir *ed) +{ + _e_sync_num++; + if (_e_sync_num == 0) _e_sync_num = 1; + ed->sync = _e_sync_num; + ed->sync_time = ecore_time_get(); + ecore_ipc_server_send(_e_ipc_server, + 6/*E_IPC_DOMAIN_FM*/, + 7/*mon list sync*/, + 0, ed->id, ed->sync, NULL, 0); +} + +static int +_e_cb_file_mon_list_idler(void *data) +{ + E_Dir *ed; + int n = 0; + char *file, buf[4096]; + + ed = data; + /* FIXME: spool off files in idlers and handle sync req's */ + while (ed->fq) + { + file = ed->fq->data; + if (!((ed->dot_order) && (!strcmp(file, ".order")))) + { + if (!strcmp(ed->dir, "/")) + snprintf(buf, sizeof(buf), "/%s", file); + else + snprintf(buf, sizeof(buf), "%s/%s", ed->dir, file); + if ((!ed->fq->next) || + ((!strcmp(ed->fq->next->data, ".order")) && + (!ed->fq->next->next))) + _e_file_add(ed->id, buf, 2); + else + _e_file_add(ed->id, buf, 1); +// printf("+++ FLIST %s\n", buf); + } + free(file); + ed->fq = evas_list_remove_list(ed->fq, ed->fq); + n++; + if (n == ed->sync_num) + { + _e_file_mon_list_sync(ed); + ed->idler = NULL; + return 0; + } + } + ed->sync_num = DEF_SYNC_NUM; + ed->sync = 0; + ed->sync_time = 0.0; + ed->idler = NULL; + return 0; +} + +static char * +_e_str_list_remove(Evas_List **list, char *str) +{ + Evas_List *l; + + for (l = *list; l; l = l->next) + { + char *s; + + s = l->data; + if (!strcmp(s, str)) + { + *list = evas_list_remove_list(*list, l); + return s; + } + } + return NULL; +} + diff --git a/src/bin/e_fm_prop.c b/src/bin/e_fm_prop.c index b55955076..a1853ae43 100644 --- a/src/bin/e_fm_prop.c +++ b/src/bin/e_fm_prop.c @@ -23,8 +23,6 @@ * advanced (extra) - * * show access date * * show change date - * * show pseudolink status - * * show pseudolink src * * show comment * * show generic * * show mount status diff --git a/src/bin/e_fwin.c b/src/bin/e_fwin.c index f284ab291..9906b66fc 100644 --- a/src/bin/e_fwin.c +++ b/src/bin/e_fwin.c @@ -572,10 +572,7 @@ _e_fwin_file_exec(E_Fwin *fwin, E_Fm2_Icon_Info *ici, E_Fwin_Exec_Type ext) e_zone_exec(fwin->win->border->zone, buf); break; case E_FWIN_EXEC_DESKTOP: - if (ici->pseudo_link) - snprintf(buf, sizeof(buf), "%s/%s", ici->pseudo_dir, ici->file); - else - snprintf(buf, sizeof(buf), "%s/%s", e_fm2_real_path_get(fwin->fm_obj), ici->file); + snprintf(buf, sizeof(buf), "%s/%s", e_fm2_real_path_get(fwin->fm_obj), ici->file); a = e_app_new(buf, 0); if (a) { @@ -821,7 +818,6 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files, int always) fmc.view.selector = 1; fmc.view.single_click = 0; fmc.view.no_subdir_jump = 1; - fmc.view.extra_file_source = NULL; fmc.icon.list.w = 24; fmc.icon.list.h = 24; fmc.icon.fixed.w = 1; diff --git a/src/bin/e_int_config_apps.c b/src/bin/e_int_config_apps.c index 22c81b6d6..7df6dac87 100644 --- a/src/bin/e_int_config_apps.c +++ b/src/bin/e_int_config_apps.c @@ -440,9 +440,9 @@ _cb_files_edited(void *data, E_Menu *m, E_Menu_Item *mi) realpath = e_fm2_real_path_get(cfdata->gui.o_fm_all); - if (info->pseudo_link) - snprintf(buf, sizeof(buf), "%s/%s", info->link, info->file); - else +// if (info->pseudo_link) +// snprintf(buf, sizeof(buf), "%s/%s", info->link, info->file); +// else snprintf(buf, sizeof(buf), "%s/%s", realpath, info->file); if (ecore_file_is_dir(buf)) return; @@ -671,7 +671,6 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf fmc_all.view.selector = 1; fmc_all.view.single_click = 0; fmc_all.view.no_subdir_jump = 0; - fmc_all.view.extra_file_source = cfdata->path_everything; fmc_all.view.always_order = 1; fmc_all.icon.list.w = 24; fmc_all.icon.list.h = 24; @@ -764,7 +763,6 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf fmc.view.selector = 1; fmc.view.single_click = 0; fmc.view.no_subdir_jump = 0; - fmc.view.extra_file_source = cfdata->path_everything; fmc.view.always_order = 1; fmc.view.link_drop = 1; fmc.icon.list.w = 24; diff --git a/src/bin/e_int_config_desklock.c b/src/bin/e_int_config_desklock.c index 996a73040..9f4bdb3cc 100644 --- a/src/bin/e_int_config_desklock.c +++ b/src/bin/e_int_config_desklock.c @@ -218,7 +218,6 @@ _adv_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) fmc.view.selector = 1; fmc.view.single_click = 0; fmc.view.no_subdir_jump = 0; - fmc.view.extra_file_source = NULL; fmc.icon.list.w = 48; fmc.icon.list.h = 48; fmc.icon.fixed.w = 1; diff --git a/src/bin/e_int_config_icon_themes.c b/src/bin/e_int_config_icon_themes.c index 3c1d6fc0b..527a22e88 100644 --- a/src/bin/e_int_config_icon_themes.c +++ b/src/bin/e_int_config_icon_themes.c @@ -236,7 +236,6 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data fmc.view.selector = 1; fmc.view.single_click = 0; fmc.view.no_subdir_jump = 0; - fmc.view.extra_file_source = NULL; fmc.icon.list.w = 24; fmc.icon.list.h = 24; fmc.icon.fixed.w = 1; diff --git a/src/bin/e_int_config_imc.c b/src/bin/e_int_config_imc.c index 0cfdaf8ee..a52b6a7a6 100644 --- a/src/bin/e_int_config_imc.c +++ b/src/bin/e_int_config_imc.c @@ -846,7 +846,6 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data fmc.view.selector = 1; fmc.view.single_click = 0; fmc.view.no_subdir_jump = 0; - fmc.view.extra_file_source = NULL; fmc.icon.list.w = 16; fmc.icon.list.h = 16; fmc.icon.fixed.w = 1; diff --git a/src/bin/e_int_config_shelf.c b/src/bin/e_int_config_shelf.c index be229ed85..1b9259ce2 100644 --- a/src/bin/e_int_config_shelf.c +++ b/src/bin/e_int_config_shelf.c @@ -236,6 +236,7 @@ _cb_add(void *data, void *data2) cfg->style = evas_stringshare_add("default"); cfg->size = 40; cfg->overlap = 0; + cfg->autohide = 0; e_config->shelves = evas_list_append(e_config->shelves, cfg); e_config_save_queue(); diff --git a/src/bin/e_int_config_startup.c b/src/bin/e_int_config_startup.c index 4e17f2dbc..7896438e4 100644 --- a/src/bin/e_int_config_startup.c +++ b/src/bin/e_int_config_startup.c @@ -296,7 +296,6 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf fmc.view.selector = 1; fmc.view.single_click = 0; fmc.view.no_subdir_jump = 0; - fmc.view.extra_file_source = NULL; fmc.icon.list.w = 48; fmc.icon.list.h = 48; fmc.icon.fixed.w = 1; diff --git a/src/bin/e_int_config_theme.c b/src/bin/e_int_config_theme.c index 7de265c4b..67ced1d56 100644 --- a/src/bin/e_int_config_theme.c +++ b/src/bin/e_int_config_theme.c @@ -382,7 +382,6 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf fmc.view.selector = 1; fmc.view.single_click = 0; fmc.view.no_subdir_jump = 0; - fmc.view.extra_file_source = NULL; fmc.icon.list.w = 48; fmc.icon.list.h = 48; fmc.icon.fixed.w = 1; diff --git a/src/bin/e_int_config_wallpaper.c b/src/bin/e_int_config_wallpaper.c index c59fa3abd..c6bb6a4fe 100644 --- a/src/bin/e_int_config_wallpaper.c +++ b/src/bin/e_int_config_wallpaper.c @@ -480,7 +480,6 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf fmc.view.selector = 1; fmc.view.single_click = 0; fmc.view.no_subdir_jump = 0; - fmc.view.extra_file_source = NULL; fmc.icon.list.w = 48; fmc.icon.list.h = 48; fmc.icon.fixed.w = 1; @@ -632,7 +631,6 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data fmc.view.selector = 1; fmc.view.single_click = 0; fmc.view.no_subdir_jump = 0; - fmc.view.extra_file_source = NULL; fmc.icon.list.w = 48; fmc.icon.list.h = 48; fmc.icon.fixed.w = 1; diff --git a/src/bin/e_int_shelf_config.c b/src/bin/e_int_shelf_config.c index 5820f5a92..8d2e80f9d 100644 --- a/src/bin/e_int_shelf_config.c +++ b/src/bin/e_int_shelf_config.c @@ -35,6 +35,7 @@ struct _E_Config_Dialog_Data int size; int layering; int overlapping; + int autohiding; }; /* a nice easy setup function that does the dirty work */ @@ -115,6 +116,7 @@ _fill_data(E_Config_Dialog_Data *cfdata) cfdata->fit_size = cfdata->escfg->fit_size; cfdata->size = cfdata->escfg->size; cfdata->overlapping = cfdata->escfg->overlap; + cfdata->autohiding = cfdata->escfg->autohide; if (cfdata->size <= 24) cfdata->basic_size = 24; else if (cfdata->size <= 32) @@ -335,7 +337,18 @@ _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) } cfdata->escfg->overlap = cfdata->overlapping; - + cfdata->escfg->autohide = cfdata->autohiding; + if (cfdata->escfg->autohide) + { + edje_object_signal_emit(cfdata->es->o_base, "e,state,hidden", "e"); + cfdata->es->hidden = 1; + } + else + { + edje_object_signal_emit(cfdata->es->o_base, "e,state,visible", "e"); + cfdata->es->hidden = 0; + } + if (restart) { zone = cfdata->es->zone; @@ -446,6 +459,8 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data e_widget_framelist_object_append(of, ob); ob = e_widget_check_add(evas, _("Allow windows to overlap the shelf"), &(cfdata->overlapping)); e_widget_framelist_object_append(of, ob); + ob = e_widget_check_add(evas, _("Auto-hide the shelf"), &(cfdata->autohiding)); + e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o2, of, 1, 1, 0.5); of = e_widget_frametable_add(evas, _("Layout"), 1); diff --git a/src/bin/e_ipc.c b/src/bin/e_ipc.c index 9b13a3b10..9ca884e3f 100644 --- a/src/bin/e_ipc.c +++ b/src/bin/e_ipc.c @@ -117,6 +117,7 @@ _e_ipc_cb_client_del(void *data __UNUSED__, int type __UNUSED__, void *event) if (ecore_ipc_client_server_get(e->client) != _e_ipc_server) return 1; /* delete client sruct */ e_thumb_client_del(e); + e_fm2_client_del(e); ecore_ipc_client_del(e->client); return 1; } @@ -146,6 +147,9 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event) case E_IPC_DOMAIN_THUMB: e_thumb_client_data(e); break; + case E_IPC_DOMAIN_FM: + e_fm2_client_data(e); + break; default: break; } diff --git a/src/bin/e_ipc.h b/src/bin/e_ipc.h index e88063466..0f8b9395b 100644 --- a/src/bin/e_ipc.h +++ b/src/bin/e_ipc.h @@ -14,6 +14,7 @@ typedef enum _E_Ipc_Domain E_IPC_DOMAIN_REPLY, E_IPC_DOMAIN_EVENT, E_IPC_DOMAIN_THUMB, + E_IPC_DOMAIN_FM, E_IPC_DOMAIN_LAST } E_Ipc_Domain; diff --git a/src/bin/e_main.c b/src/bin/e_main.c index 457a3a337..36b89417e 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -529,14 +529,6 @@ main(int argc, char **argv) /*** Finished loading subsystems, Loading WM Specifics ***/ - TS("fm2"); - /* init the enlightenment file manager */ - if (!e_fm2_init()) - { - e_error_message_show(_("Enlightenment cannot initialize the File manager.\n")); - _e_main_shutdown(-1); - } - _e_main_shutdown_push(e_fm2_shutdown); TS("dirs"); /* setup directories we will be using for configurations storage etc. */ if (!_e_main_dirs_init()) @@ -680,6 +672,14 @@ main(int argc, char **argv) if (_e_main_ipc_init()) _e_main_shutdown_push(_e_main_ipc_shutdown); + TS("fm2"); + /* init the enlightenment file manager */ + if (!e_fm2_init()) + { + e_error_message_show(_("Enlightenment cannot initialize the File manager.\n")); + _e_main_shutdown(-1); + } + _e_main_shutdown_push(e_fm2_shutdown); TS("msg"); /* setup generic msg handling etc */ if (!e_msg_init()) diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c index cc476b6db..efd2d55d9 100644 --- a/src/bin/e_shelf.c +++ b/src/bin/e_shelf.c @@ -323,6 +323,7 @@ e_shelf_save(E_Shelf *es) cf_es->fit_along = es->fit_along; cf_es->fit_size = es->fit_size; cf_es->overlap = 0; + cf_es->autohide = 0; es->cfg = cf_es; } e_config_save_queue(); @@ -520,6 +521,11 @@ e_shelf_popup_set(E_Shelf *es, int popup) static void _e_shelf_free(E_Shelf *es) { + if (es->hide_timer) + { + ecore_timer_del(es->hide_timer); + es->hide_timer = NULL; + } if (es->menu) { e_menu_post_deactivate_callback_set(es->menu, NULL, NULL); @@ -963,6 +969,37 @@ _e_shelf_cb_mouse_in(void *data, Evas *evas, Evas_Object *obj, void *event_info) es = data; ev = event_info; edje_object_signal_emit(es->o_base, "e,state,focused", "e"); + if (es->cfg->autohide) + { + if (es->hidden) + { + es->hidden = 0; + edje_object_signal_emit(es->o_base, "e,state,visible", "e"); + } + } + if (es->hide_timer) + { + ecore_timer_del(es->hide_timer); + es->hide_timer = NULL; + } +} + +static int +_e_shelf_cb_hide_timer(void *data) +{ + E_Shelf *es; + + es = data; + if (!e_menu_grab_window_get()) + { + if (!es->hidden) + { + edje_object_signal_emit(es->o_base, "e,state,hidden", "e"); + } + } + es->hide_timer = NULL; + es->hidden = 1; + return 0; } static void @@ -973,6 +1010,17 @@ _e_shelf_cb_mouse_out(void *data, Evas *evas, Evas_Object *obj, void *event_info es = data; ev = event_info; + if (es->cfg->autohide) + { + Evas_Coord x, y, w, h; + + evas_object_geometry_get(es->o_base, &x, &y, &w, &h); + if (!E_INSIDE(ev->canvas.x, ev->canvas.y, x, y, w, h)) + { + if (es->hide_timer) ecore_timer_del(es->hide_timer); + es->hide_timer = ecore_timer_add(0.25, _e_shelf_cb_hide_timer, es); + } + } edje_object_signal_emit(es->o_base, "e,state,unfocused", "e"); } diff --git a/src/bin/e_shelf.h b/src/bin/e_shelf.h index 66cbdea98..f8f6b109c 100644 --- a/src/bin/e_shelf.h +++ b/src/bin/e_shelf.h @@ -29,9 +29,11 @@ struct _E_Shelf E_Config_Shelf *cfg; unsigned char fit_along : 1; unsigned char fit_size : 1; + unsigned char hidden : 1; int size; E_Config_Dialog *config_dialog; E_Menu *menu; + Ecore_Timer *hide_timer; }; EAPI int e_shelf_init(void); diff --git a/src/bin/e_sys.c b/src/bin/e_sys.c index 8511e25af..38151be4f 100644 --- a/src/bin/e_sys.c +++ b/src/bin/e_sys.c @@ -41,8 +41,8 @@ e_sys_init(void) /* this is not optimal - but it does work cleanly */ _e_sys_exe_exit_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _e_sys_cb_exit, NULL); - /* delay this for 5.0 seconds while the rest of e starts up */ - ecore_timer_add(5.0, _e_sys_cb_timer, NULL); + /* delay this for 2.0 seconds while the rest of e starts up */ + ecore_timer_add(2.0, _e_sys_cb_timer, NULL); return 1; } diff --git a/src/bin/e_test.c b/src/bin/e_test.c index 506244425..f27d95ab6 100644 --- a/src/bin/e_test.c +++ b/src/bin/e_test.c @@ -536,7 +536,6 @@ _e_test_internal(E_Container *con) fmc.view.selector = 1; fmc.view.single_click = 0; fmc.view.no_subdir_jump = 0; - fmc.view.extra_file_source = NULL; fmc.icon.list.w = 24; fmc.icon.list.h = 24; fmc.icon.fixed.w = 1; @@ -576,7 +575,6 @@ _e_test_internal(E_Container *con) fmc.view.selector = 1; fmc.view.single_click = 1; fmc.view.no_subdir_jump = 1; - fmc.view.extra_file_source = NULL; fmc.icon.list.w = 24; fmc.icon.list.h = 24; fmc.icon.fixed.w = 1; diff --git a/src/bin/e_thumb.c b/src/bin/e_thumb.c index 57cc7e8b8..7e98fa7c5 100644 --- a/src/bin/e_thumb.c +++ b/src/bin/e_thumb.c @@ -35,7 +35,7 @@ static Evas_List *_thumb_queue = NULL; static int _objid = 0; static Evas_Hash *_thumbs = NULL; static int _pending = 0; -static int _num_thumbnailers = 2; +static int _num_thumbnailers = 1; static Ecore_Event_Handler *_exe_del_handler = NULL; static Ecore_Timer *_kill_timer = NULL; diff --git a/src/bin/e_thumb_main.c b/src/bin/e_thumb_main.c index b90d9115d..eac5cf745 100644 --- a/src/bin/e_thumb_main.c +++ b/src/bin/e_thumb_main.c @@ -139,7 +139,10 @@ _e_ipc_cb_server_add(void *data, int type, void *event) Ecore_Ipc_Event_Server_Add *e; e = event; - ecore_ipc_server_send(e->server, 5, 1, 0, 0, 0, NULL, 0); /* send hello */ + ecore_ipc_server_send(e->server, + 5/*E_IPC_DOMAIN_THUMB*/, + 1/*hello*/, + 0, 0, 0, NULL, 0); /* send hello */ return 1; } @@ -164,7 +167,7 @@ _e_ipc_cb_server_data(void *data, int type, void *event) char *key = NULL; e = event; - if (e->major != 5) return 1; + if (e->major != 5/*E_IPC_DOMAIN_THUMB*/) return 1; switch (e->minor) { case 1: @@ -187,7 +190,7 @@ _e_ipc_cb_server_data(void *data, int type, void *event) eth->file = strdup(file); if (key) eth->key = strdup(key); _thumblist = evas_list_append(_thumblist, eth); - if (!_timer) _timer = ecore_timer_add(0.000001, _e_cb_timer, NULL); + if (!_timer) _timer = ecore_timer_add(0.01, _e_cb_timer, NULL); } } break; @@ -234,7 +237,7 @@ _e_cb_timer(void *data) if (eth->key) free(eth->key); free(eth); - if (_thumblist) _timer = ecore_timer_add(0.000001, _e_cb_timer, NULL); + if (_thumblist) _timer = ecore_timer_add(0.01, _e_cb_timer, NULL); else _timer = NULL; } else diff --git a/src/bin/e_widget_fsel.c b/src/bin/e_widget_fsel.c index d32f916f8..4ae979d5c 100644 --- a/src/bin/e_widget_fsel.c +++ b/src/bin/e_widget_fsel.c @@ -395,7 +395,6 @@ e_widget_fsel_add(Evas *evas, const char *dev, const char *path, char *selected, fmc.view.single_click = 1; fmc.view.no_subdir_jump = 1; fmc.view.no_subdir_drop = 1; - fmc.view.extra_file_source = NULL; fmc.view.link_drop = 1; fmc.icon.list.w = 24; fmc.icon.list.h = 24; @@ -437,7 +436,6 @@ e_widget_fsel_add(Evas *evas, const char *dev, const char *path, char *selected, fmc.view.selector = 1; fmc.view.single_click = 0; fmc.view.no_subdir_jump = 0; - fmc.view.extra_file_source = NULL; fmc.icon.list.w = 24; fmc.icon.list.h = 24; fmc.icon.fixed.w = 1; diff --git a/src/bin/e_winlist.c b/src/bin/e_winlist.c index a5e6d3bb4..03081cc65 100644 --- a/src/bin/e_winlist.c +++ b/src/bin/e_winlist.c @@ -45,6 +45,10 @@ static Evas_Object *list_object = NULL; static Evas_Object *icon_object = NULL; static Evas_List *wins = NULL; static Evas_List *win_selected = NULL; +static E_Desk *last_desk = NULL; +static int last_pointer_x = 0; +static int last_pointer_y = 0; +static E_Border *last_border = NULL; static int hold_count = 0; static int hold_mod = 0; static Evas_List *handlers = NULL; @@ -82,7 +86,6 @@ e_winlist_show(E_Zone *zone) Evas_Object *o; Evas_List *l; E_Desk *desk; - E_Border *bd; E_OBJECT_CHECK_RETURN(zone, 0); E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0); @@ -152,12 +155,20 @@ e_winlist_show(E_Zone *zone) e_winlist_hide(); return 1; } - - bd = e_border_focused_get(); - if (bd) + + if (e_config->winlist_list_show_other_desk_windows || + e_config->winlist_list_show_other_screen_windows) + last_desk = e_desk_current_get(winlist->zone); + if (e_config->winlist_warp_while_selecting) + ecore_x_pointer_xy_get(winlist->zone->container->win, + &last_pointer_x, &last_pointer_y); + last_border = e_border_focused_get(); + if (last_border) { - if (!bd->lock_focus_out) - e_border_focus_set(bd, 0, 0); + if (!last_border->lock_focus_out) + e_border_focus_set(last_border, 0, 0); + else + last_border = NULL; } _e_winlist_activate_nth(1); evas_event_thaw(winlist->evas); @@ -485,6 +496,7 @@ _e_winlist_border_del(E_Border *bd) { Evas_List *l; + if (bd == last_border) last_border = NULL; for (l = wins; l; l = l->next) { E_Winlist_Win *ww; @@ -694,6 +706,26 @@ _e_winlist_show_active(void) } } +static void +_e_winlist_restore_desktop(void) +{ + if (last_desk && + (e_config->winlist_list_show_other_desk_windows || + e_config->winlist_list_show_other_screen_windows)) + e_desk_show(last_desk); + if (e_config->winlist_warp_while_selecting) + ecore_x_pointer_warp(winlist->zone->container->win, + last_pointer_x, last_pointer_y); + _e_winlist_deactivate(); + win_selected = NULL; + e_winlist_hide(); + if (last_border) + { + e_border_focus_set(last_border, 1, 1); + last_border = NULL; + } +} + static int _e_winlist_cb_event_border_add(void *data, int type, void *event) { @@ -737,7 +769,7 @@ _e_winlist_cb_key_down(void *data, int type, void *event) else if (!strcmp(ev->keysymbol, "space")) e_winlist_hide(); else if (!strcmp(ev->keysymbol, "Escape")) - e_winlist_hide(); + _e_winlist_restore_desktop(); else if (!strcmp(ev->keysymbol, "1")) _e_winlist_activate_nth(0); else if (!strcmp(ev->keysymbol, "2"))