get client leader prop - special spot for placement if special window.

SVN revision: 15381
This commit is contained in:
Carsten Haitzler 2005-06-17 09:05:38 +00:00
parent e5e4ea1459
commit 75a39d0d93
3 changed files with 58 additions and 20 deletions

1
TODO
View File

@ -65,7 +65,6 @@ These are in no particular order:
them back by saying "get me that lost window"
* netwm window types and states need addressing (do special/appropriate things)
for each of them.
* set _NET_WM_ALLOWED_ACTIONS
* use ecore_x_netwm_ping_send() to windowsthat suport it regularly to see if
they are dead or not (do this all the time - like every few seconds) to be
able to inform users of dead applications about the time they die, not some

View File

@ -347,6 +347,8 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map)
bd->client.mwm.fetch.hints = 1;
else if (atoms[i] == ECORE_X_ATOM_WM_TRANSIENT_FOR)
bd->client.icccm.fetch.transient_for = 1;
else if (atoms[i] == ECORE_X_ATOM_WM_CLIENT_LEADER)
bd->client.icccm.fetch.client_leader = 1;
else if (atoms[i] == ECORE_X_ATOM_WM_WINDOW_ROLE)
bd->client.icccm.fetch.window_role = 1;
else if (atoms[i] == ECORE_X_ATOM_WM_STATE)
@ -2099,6 +2101,11 @@ _e_border_cb_window_property(void *data, int ev_type, void *ev)
bd->client.icccm.fetch.transient_for = 1;
bd->changed = 1;
}
else if (e->atom == ECORE_X_ATOM_WM_CLIENT_LEADER)
{
bd->client.icccm.fetch.client_leader = 1;
bd->changed = 1;
}
else if (e->atom == ECORE_X_ATOM_WM_WINDOW_ROLE)
{
bd->client.icccm.fetch.window_role = 1;
@ -3458,6 +3465,11 @@ _e_border_eval(E_Border *bd)
bd->client.icccm.transient_for = ecore_x_icccm_transient_for_get(bd->client.win);
bd->client.icccm.fetch.transient_for = 0;
}
if (bd->client.icccm.fetch.client_leader)
{
bd->client.icccm.client_leader = ecore_x_icccm_client_leader_get(bd->client.win);
bd->client.icccm.fetch.client_leader = 0;
}
if (bd->client.icccm.fetch.window_role)
{
bd->client.icccm.window_role = ecore_x_icccm_window_role_get(bd->client.win);
@ -3468,6 +3480,7 @@ _e_border_eval(E_Border *bd)
e_hints_window_state_set(bd);
bd->client.netwm.update.state = 0;
}
if (bd->changes.icon)
{
if (bd->icon_object)
@ -3747,27 +3760,51 @@ _e_border_eval(E_Border *bd)
}
else
{
Evas_List *skiplist = NULL;
int new_x, new_y;
int placed = 0;
/* FIXME: special placement for dialogs etc. etc. etc goes
* here */
if ((bd->client.netwm.type == ECORE_X_WINDOW_TYPE_DIALOG) &&
((bd->client.icccm.transient_for != 0)))
{
E_Border *bd_parent;
bd_parent = e_border_find_by_client_window(bd->client.icccm.transient_for);
// if (!bd_parent)
// bd_parent = e_border_find_by_client_window(bd->client.icccm.client_leader);
/* FIXME: what if parent is not on this desktop - or zone? */
if ((bd_parent) && (bd_parent->visible))
{
bd->x = bd_parent->x + ((bd_parent->w - bd->w) / 2);
bd->y = bd_parent->y + ((bd_parent->h - bd->h) / 2);
bd->changes.pos = 1;
placed = 1;
}
}
if (!placed)
{
Evas_List *skiplist = NULL;
int new_x, new_y;
// printf("##- AUTO POS 0x%x\n", bd->client.win);
if (bd->zone->w > bd->w)
new_x = bd->zone->x + (rand() % (bd->zone->w - bd->w));
else
new_x = bd->zone->x;
if (bd->zone->h > bd->h)
new_y = bd->zone->y + (rand() % (bd->zone->h - bd->h));
else
new_y = bd->zone->y;
skiplist = evas_list_append(skiplist, bd);
e_place_zone_region_smart(bd->zone, skiplist,
bd->x, bd->y, bd->w, bd->h,
&new_x, &new_y);
evas_list_free(skiplist);
bd->x = new_x;
bd->y = new_y;
bd->changes.pos = 1;
if (bd->zone->w > bd->w)
new_x = bd->zone->x + (rand() % (bd->zone->w - bd->w));
else
new_x = bd->zone->x;
if (bd->zone->h > bd->h)
new_y = bd->zone->y + (rand() % (bd->zone->h - bd->h));
else
new_y = bd->zone->y;
skiplist = evas_list_append(skiplist, bd);
e_place_zone_region_smart(bd->zone, skiplist,
bd->x, bd->y, bd->w, bd->h,
&new_x, &new_y);
evas_list_free(skiplist);
bd->x = new_x;
bd->y = new_y;
bd->changes.pos = 1;
}
}
}
while (bd->pending_move_resize)

View File

@ -128,6 +128,7 @@ struct _E_Border
Ecore_X_Window icon_window;
Ecore_X_Window window_group;
Ecore_X_Window transient_for;
Ecore_X_Window client_leader;
Ecore_X_Gravity gravity;
char *window_role;
unsigned char take_focus : 1;
@ -144,6 +145,7 @@ struct _E_Border
unsigned char size_pos_hints : 1;
unsigned char protocol : 1;
unsigned char transient_for : 1;
unsigned char client_leader : 1;
unsigned char window_role : 1;
unsigned char state : 1;
} fetch;