fix up exe to set DISPALY right for executed apps on other managers... this

also technically may allow us to add other properties to a window if i get
ehack back in to then put it on the desktop it was launched on.


SVN revision: 15054
This commit is contained in:
Carsten Haitzler 2005-06-02 09:49:07 +00:00
parent 747900bff1
commit 28d41b1d28
9 changed files with 182 additions and 167 deletions

29
TODO
View File

@ -66,10 +66,11 @@ These are in no particular order:
it was last on (per zone, per container, per manager).
* start module needs to have an way to alert users to "click here" and back
off alerting users as they learn what it is (over time)
* sometiems windows that get shut down/closed get unparented but the whole
* sometimes windows that get shut down/closed get unparented but the whole
border stays around - something is keeping extra references maybe? it is
hidden, until you flip desktops then it appears again - but with no client
around.
around. currently they have a dangling reference - need to find out WHO
added that ref and didnt remove it
* fix action delete (can segv if action is stored for "long runing actions"
like move/resize)
* drop on ibar for re-ordering, removal seems broken (drop location is the
@ -89,8 +90,6 @@ These are in no particular order:
* check window max size. if < size of zone (or maximisation area) disallow
maximising and tell border edje object (via signals) to somehow disable the
maximise buttons :) (and remove from the menu)
* drag and drop need to center icon at correct offset based on mouse down
before drag start
* bug: if you have 2 zones and you fill up zone 2 (right) mostly and then run
a big xev (xev -g 1280x1024) that wont fit it gets placed offscreen to the
right of zone 2
@ -98,26 +97,18 @@ These are in no particular order:
* module api needs to move label and icon to data file, not api
* gadman edit mode for simple gadgets activate with a button bind (eg
alt+click on module like windows) or a pure key binding
* "start button" module to pop up the e menu (left mouse right now)
* click to focus
* make e17 re-locatable (ues environment var, or find out by hunting path
argv[0] if its not a full path or munge the full path to the exe in argv[0])
* java apps seem to have a hard time if we dont pretend to be kwin
(see e_hints.c) - get this stuff upstream to sun and get things fixed in
java.
* make e17 re-locatable (ie use e_prefix.c stuff instead of #defined paths)
* gadget containers (shelves?)
* add key input focus control for desktop modules
* finish off icccm support
* optimize clock theme (speed/cpu) (rotation in edje???)
* add "icon box"
* optimize clock theme (speed/cpu) (rotation in edje??? or evas???)
* fix iconbox to not dissapear to nothing when its empty
* add complete netwm support
* different cursors for different parts of the screen
* alt+tab popup list of windows
* add a "taskbar" module
* add cpu load module
* add a way to access "all" apps app dir
* optimise client manage: list window properties then only fetch the ones
that exist on window map
* non opaque move/resize
* ibar need to support label pop-ups
* ibar should support subdirs with pop-up icons...
@ -136,10 +127,7 @@ These are in no particular order:
* support text and color classes
* add tooltips
* add fullscreen support (e16 xvidmode or xrandr style)
* add screen rotation info to managers (from xrandr)
* make xrandr support get rotation
* add rotation to containers
* fix multihead support (executing with DISPLAY=:0.1 on screen 1 for example)
* make xrandr support get rotation and store it
* maybe add systray module/support?
* allow object paranoia to be a runtime option too
* add sliders, radio and check buttons for clientinfo pane
@ -158,10 +146,9 @@ These are in no particular order:
* need to be able to remember client positons/etc.
* file icons on the desktop (people ask for it) - xdnd for these
* gui config tools for bg's, keybindings, etc. etc. etc.
* "control panel" app to launch the gui config tools
* go through e16 features we dont have and implement the most useful ones (or
re-design and implement)
* libehack from old e17 wrapper for executing apps
* use libehack stuff to track launches of apps etc.
* make it possible to disable border buttons/actions (tell theme what is
disabled)
* make status modules (like cpu meter per window) use ehack to get pid to

View File

@ -511,7 +511,8 @@ ACT_FN_GO(app)
a = e_app_generic_find(p + 1);
else if (!strcmp(p2, "exe:"))
a = e_app_exe_find(p + 1);
if (a) e_app_exec(a);
if (a)
e_zone_app_exec(zone, a);
}
free(p2);
}

View File

@ -256,6 +256,8 @@ e_app_exec(E_App *a)
E_OBJECT_CHECK_RETURN(a, 0);
E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, 0);
if (!a->exe) return 0;
/* FIXME: set up locale, encoding and input method env vars if they are in
* the eapp file */
exe = ecore_exe_run(a->exe, a);
if (!exe) return 0;
a->instances = evas_list_append(a->instances, exe);

View File

@ -345,7 +345,7 @@ _e_int_menus_apps_run(void *data, E_Menu *m, E_Menu_Item *mi)
E_App *a;
a = data;
e_app_exec(a);
e_zone_app_exec(m->zone, a);
}
static void

View File

@ -648,6 +648,7 @@ _e_main_screens_init(void)
E_Container *con;
man = e_manager_new(roots[i]);
man->num = i;
e_init_show();
if (man) e_manager_show(man);
else

View File

@ -16,6 +16,7 @@ struct _E_Manager
E_Object e_obj_inherit;
Ecore_X_Window win;
int num;
int x, y, w, h;
char visible : 1;
Ecore_X_Window root;

View File

@ -294,148 +294,6 @@ e_zone_flip_coords_handle(E_Zone *zone, int x, int y)
}
}
static void
_e_zone_free(E_Zone *zone)
{
E_Container *con;
Evas_List *l;
int x, y;
/* remove handlers */
for (l = zone->handlers; l; l = l->next)
{
Ecore_Event_Handler *h;
h = l->data;
ecore_event_handler_del(h);
}
evas_list_free(zone->handlers);
zone->handlers = NULL;
con = zone->container;
if (zone->name) free(zone->name);
con->zones = evas_list_remove(con->zones, zone);
evas_object_del(zone->bg_event_object);
evas_object_del(zone->bg_clip_object);
evas_object_del(zone->bg_object);
/* free desks */
for (x = 0; x < zone->desk_x_count; x++)
for(y = 0; y < zone->desk_y_count; y++)
e_object_del(E_OBJECT(zone->desks[x + (y * zone->desk_x_count)]));
free(zone->desks);
free(zone);
}
static void
_e_zone_cb_menu_end(void *data, E_Menu *m)
{
e_object_del(E_OBJECT(m));
}
static void
_e_zone_cb_bg_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
E_Zone *zone;
Evas_Event_Mouse_Down *ev;
ev = (Evas_Event_Mouse_Down *)event_info;
zone = data;
if (e_menu_grab_window_get()) return;
if (!zone->cur_mouse_action)
{
if (ecore_event_current_type_get() == ECORE_X_EVENT_MOUSE_BUTTON_DOWN)
{
Ecore_X_Event_Mouse_Button_Down *ev2;
ev2 = ecore_event_current_event_get();
zone->cur_mouse_action =
e_bindings_mouse_down_event_handle(E_BINDING_CONTEXT_ZONE,
E_OBJECT(zone), ev2);
}
}
#if 0 /* FIXME: nuke this later once the new configurable bindings settle */
if (ev->button == 1)
{
E_Menu *m;
m = e_int_menus_main_new();
e_menu_post_deactivate_callback_set(m, _e_zone_cb_menu_end, NULL);
e_menu_activate_mouse(m, zone, ev->output.x, ev->output.y, 1, 1,
E_MENU_POP_DIRECTION_DOWN);
e_util_container_fake_mouse_up_all_later(zone->container);
}
else if (ev->button == 2)
{
E_Menu *m;
m = e_int_menus_clients_new();
/* FIXME: this is a bit of a hack... setting m->con - bad hack */
m->zone = zone;
e_menu_post_deactivate_callback_set(m, _e_zone_cb_menu_end, NULL);
e_menu_activate_mouse(m, zone, ev->output.x, ev->output.y, 1, 1,
E_MENU_POP_DIRECTION_DOWN);
e_util_container_fake_mouse_up_all_later(zone->container);
}
else if (ev->button == 3)
{
E_Menu *m;
m = e_int_menus_favorite_apps_new();
e_menu_post_deactivate_callback_set(m, _e_zone_cb_menu_end, NULL);
e_menu_activate_mouse(m, zone, ev->output.x, ev->output.y, 1, 1,
E_MENU_POP_DIRECTION_DOWN);
e_util_container_fake_mouse_up_all_later(zone->container);
}
#endif
}
static void
_e_zone_cb_bg_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
E_Zone *zone;
Evas_Event_Mouse_Up *ev;
ev = (Evas_Event_Mouse_Up *)event_info;
zone = data;
if (zone->cur_mouse_action)
{
if (ecore_event_current_type_get() == ECORE_X_EVENT_MOUSE_BUTTON_UP)
{
Ecore_X_Event_Mouse_Button_Up *ev2;
ev2 = ecore_event_current_event_get();
if (zone->cur_mouse_action->func.end_mouse)
zone->cur_mouse_action->func.end_mouse(E_OBJECT(zone), "", ev2);
else if (zone->cur_mouse_action->func.end)
zone->cur_mouse_action->func.end(E_OBJECT(zone), "");
}
zone->cur_mouse_action = NULL;
}
else
{
if (ecore_event_current_type_get() == ECORE_X_EVENT_MOUSE_BUTTON_UP)
{
Ecore_X_Event_Mouse_Button_Up *ev2;
ev2 = ecore_event_current_event_get();
e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_ZONE,
E_OBJECT(zone), ev2);
}
}
}
static void
_e_zone_cb_bg_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
E_Zone *zone;
Evas_Event_Mouse_Move *ev;
ev = (Evas_Event_Mouse_Move *)event_info;
zone = data;
}
void
e_zone_desk_count_set(E_Zone *zone, int x_count, int y_count)
{
@ -598,6 +456,169 @@ e_zone_desk_linear_flip_to(E_Zone *zone, int x)
e_zone_desk_flip_to(zone, x, y);
}
int
e_zone_app_exec(E_Zone *zone, E_App *a)
{
int ret;
char *penv_display, *p1, *p2;
char buf[4096], buf2[32];
/* save previous env vars we need to save */
penv_display = getenv("DISPLAY");
if (penv_display) penv_display = strdup(penv_display);
/* set env vars */
p1 = strrchr(penv_display, ':');
p2 = strrchr(penv_display, '.');
if ((p1) && (p2) && (p2 > p1)) /* "blah:x.y" */
{
/* yes it could overflow... but who will voerflow DISPLAY eh? why? to
* "exploit" your own applications running as you?
*/
strcpy(buf, penv_display);
buf[p2 - penv_display + 1] = 0;
snprintf(buf2, sizeof(buf2), "%i", zone->container->manager->num);
strcat(buf, buf2);
}
else if (p1) /* "blah:x */
{
strcpy(buf, penv_display);
snprintf(buf2, sizeof(buf2), ".%i", zone->container->manager->num);
strcat(buf, buf2);
}
else
strcpy(buf, penv_display);
e_util_env_set("DISPLAY", buf);
snprintf(buf, sizeof(buf), "%i %i", zone->desk_x_current, zone->desk_y_current);
e_util_env_set("_E_DESK", buf);
snprintf(buf, sizeof(buf), "%i", zone->num);
e_util_env_set("_E_ZONE", buf);
snprintf(buf, sizeof(buf), "%i", zone->container->num);
e_util_env_set("_E_CONTAINER", buf);
snprintf(buf, sizeof(buf), "%i", zone->container->manager->num);
e_util_env_set("_E_MANAGER", buf);
/* execute */
ret = e_app_exec(a);
/* reset env vars */
if (penv_display)
{
e_util_env_set("DISPLAY", penv_display);
free(penv_display);
}
return ret;
}
/* local subsystem functions */
static void
_e_zone_free(E_Zone *zone)
{
E_Container *con;
Evas_List *l;
int x, y;
/* remove handlers */
for (l = zone->handlers; l; l = l->next)
{
Ecore_Event_Handler *h;
h = l->data;
ecore_event_handler_del(h);
}
evas_list_free(zone->handlers);
zone->handlers = NULL;
con = zone->container;
if (zone->name) free(zone->name);
con->zones = evas_list_remove(con->zones, zone);
evas_object_del(zone->bg_event_object);
evas_object_del(zone->bg_clip_object);
evas_object_del(zone->bg_object);
/* free desks */
for (x = 0; x < zone->desk_x_count; x++)
for(y = 0; y < zone->desk_y_count; y++)
e_object_del(E_OBJECT(zone->desks[x + (y * zone->desk_x_count)]));
free(zone->desks);
free(zone);
}
static void
_e_zone_cb_menu_end(void *data, E_Menu *m)
{
e_object_del(E_OBJECT(m));
}
static void
_e_zone_cb_bg_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
E_Zone *zone;
Evas_Event_Mouse_Down *ev;
ev = (Evas_Event_Mouse_Down *)event_info;
zone = data;
if (e_menu_grab_window_get()) return;
if (!zone->cur_mouse_action)
{
if (ecore_event_current_type_get() == ECORE_X_EVENT_MOUSE_BUTTON_DOWN)
{
Ecore_X_Event_Mouse_Button_Down *ev2;
ev2 = ecore_event_current_event_get();
zone->cur_mouse_action =
e_bindings_mouse_down_event_handle(E_BINDING_CONTEXT_ZONE,
E_OBJECT(zone), ev2);
}
}
}
static void
_e_zone_cb_bg_mouse_up(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
E_Zone *zone;
Evas_Event_Mouse_Up *ev;
ev = (Evas_Event_Mouse_Up *)event_info;
zone = data;
if (zone->cur_mouse_action)
{
if (ecore_event_current_type_get() == ECORE_X_EVENT_MOUSE_BUTTON_UP)
{
Ecore_X_Event_Mouse_Button_Up *ev2;
ev2 = ecore_event_current_event_get();
if (zone->cur_mouse_action->func.end_mouse)
zone->cur_mouse_action->func.end_mouse(E_OBJECT(zone), "", ev2);
else if (zone->cur_mouse_action->func.end)
zone->cur_mouse_action->func.end(E_OBJECT(zone), "");
}
zone->cur_mouse_action = NULL;
}
else
{
if (ecore_event_current_type_get() == ECORE_X_EVENT_MOUSE_BUTTON_UP)
{
Ecore_X_Event_Mouse_Button_Up *ev2;
ev2 = ecore_event_current_event_get();
e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_ZONE,
E_OBJECT(zone), ev2);
}
}
}
static void
_e_zone_cb_bg_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
E_Zone *zone;
Evas_Event_Mouse_Move *ev;
ev = (Evas_Event_Mouse_Move *)event_info;
zone = data;
}
static void
_e_zone_event_zone_desk_count_set_free(void *data, void *ev)
{

View File

@ -65,6 +65,8 @@ EAPI void e_zone_desk_flip_by(E_Zone *zone, int dx, int dy);
EAPI void e_zone_desk_flip_to(E_Zone *zone, int x, int y);
EAPI void e_zone_desk_linear_flip_by(E_Zone *zone, int dx);
EAPI void e_zone_desk_linear_flip_to(E_Zone *zone, int x);
EAPI int e_zone_app_exec(E_Zone *zone, E_App *a);
extern EAPI int E_EVENT_ZONE_DESK_COUNT_SET;

View File

@ -1193,7 +1193,7 @@ _ibar_icon_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info
edje_object_signal_emit(ic->bg_object, "start", "");
edje_object_signal_emit(ic->overlay_object, "start", "");
edje_object_signal_emit(ic->ibb->overlay_object, "start", "");
e_app_exec(ic->app);
e_zone_app_exec(ic->ibb->gmc->zone, ic->app);
#else
drag_x = ev->output.x;
drag_y = ev->output.y;
@ -1219,7 +1219,7 @@ _ibar_icon_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
edje_object_signal_emit(ic->ibb->overlay_object, "start_end", "");
#else
if (!drag)
e_app_exec(ic->app);
e_zone_app_exec(ic->ibb->gmc->zone, ic->app);
drag = 0;
drag_start = 0;
#endif