Hints cleanup. Send the border to hints, not the client.win. It's easier

to keep the current border state cache uptodate.


SVN revision: 14481
This commit is contained in:
sebastid 2005-04-29 08:37:09 +00:00 committed by sebastid
parent b57ff00be7
commit e9cc09bb24
3 changed files with 146 additions and 68 deletions

View File

@ -406,7 +406,7 @@ e_border_show(E_Border *bd)
if (bd->visible) return;
e_container_shape_show(bd->shape);
e_container_window_show(bd->zone->container, bd->client.win, bd->layer);
e_hints_window_visible_set(bd->client.win);
e_hints_window_visible_set(bd);
bd->visible = 1;
bd->changes.visible = 1;
@ -434,7 +434,7 @@ e_border_hide(E_Border *bd, int manage)
e_container_window_hide(bd->zone->container, bd->client.win, bd->layer);
e_container_shape_hide(bd->shape);
if (!bd->iconic)
e_hints_window_hidden_set(bd->client.win);
e_hints_window_hidden_set(bd);
bd->visible = 0;
bd->changes.visible = 1;
@ -700,21 +700,21 @@ e_border_focus_set(E_Border *bd, int focus, int set)
* now the focus is on Y where it should be on X
*/
ecore_x_icccm_take_focus_send(bd->client.win, ecore_x_current_time_get());
e_hints_active_window_set(bd->container->manager, bd->client.win);
e_hints_active_window_set(bd->container->manager, bd);
ecore_x_window_focus(bd->client.win);
}
else
{
// printf("set focus\n");
ecore_x_window_focus(bd->client.win);
e_hints_active_window_set(bd->container->manager, bd->client.win);
e_hints_active_window_set(bd->container->manager, bd);
}
}
else
{
// printf("remove focus\n");
ecore_x_window_focus(bd->container->manager->win);
e_hints_active_window_set(bd->container->manager, 0);
e_hints_active_window_set(bd->container->manager, NULL);
}
}
if ((bd->focused) && (focused != bd))
@ -741,8 +741,8 @@ e_border_shade(E_Border *bd, E_Direction dir)
bd->shade.y = bd->y;
bd->shade.dir = dir;
e_hints_window_shaded_set(bd->client.win, 1);
e_hints_window_shade_direction_set(bd->client.win, dir);
e_hints_window_shaded_set(bd, 1);
e_hints_window_shade_direction_set(bd, dir);
if (e_config->border_shade_animate)
{
@ -818,8 +818,8 @@ e_border_unshade(E_Border *bd, E_Direction dir)
bd->shade.dir = dir;
e_hints_window_shaded_set(bd->client.win, 0);
e_hints_window_shade_direction_set(bd->client.win, dir);
e_hints_window_shaded_set(bd, 0);
e_hints_window_shade_direction_set(bd, dir);
if (bd->shade.dir == E_DIRECTION_UP ||
bd->shade.dir == E_DIRECTION_LEFT)
@ -906,7 +906,7 @@ e_border_maximize(E_Border *bd)
bd->saved.w = bd->w;
bd->saved.h = bd->h;
e_hints_window_maximized_set(bd->client.win, 1);
e_hints_window_maximized_set(bd, 1);
/* FIXME maximize intelligently */
e_border_raise(bd);
@ -929,7 +929,7 @@ e_border_unmaximize(E_Border *bd)
if (bd->maximized)
{
// printf("UNMAXIMIZE!!\n");
e_hints_window_maximized_set(bd->client.win, 0);
e_hints_window_maximized_set(bd, 0);
e_border_move_resize(bd, bd->saved.x, bd->saved.y, bd->saved.w, bd->saved.h);
@ -955,7 +955,7 @@ e_border_fullscreen(E_Border *bd)
bd->saved.w = bd->w;
bd->saved.h = bd->h;
e_hints_window_fullscreen_set(bd->client.win, 1);
e_hints_window_fullscreen_set(bd, 1);
bd->layer = 200;
@ -983,7 +983,7 @@ e_border_unfullscreen(E_Border *bd)
if ((bd->shaded) || (bd->shading)) return;
if (bd->fullscreen)
{
e_hints_window_fullscreen_set(bd->client.win, 0);
e_hints_window_fullscreen_set(bd, 0);
e_border_move_resize(bd, bd->saved.x, bd->saved.y, bd->saved.w, bd->saved.h);
@ -1015,7 +1015,7 @@ e_border_iconify(E_Border *bd)
edje_object_signal_emit(bd->bg_object, "iconify", "");
}
iconic = 1;
e_hints_window_iconic_set(bd->client.win);
e_hints_window_iconic_set(bd);
ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &iconic, 1);
ev = E_NEW(E_Event_Border_Iconify, 1);
@ -1060,7 +1060,7 @@ e_border_stick(E_Border *bd)
E_OBJECT_CHECK(bd);
E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
bd->sticky = 1;
e_hints_window_sticky_set(bd->client.win, 1);
e_hints_window_sticky_set(bd, 1);
ev = E_NEW(E_Event_Border_Stick, 1);
ev->border = bd;
@ -1078,7 +1078,7 @@ e_border_unstick(E_Border *bd)
/* Set the desk before we unstick the border */
e_border_desk_set(bd, e_desk_current_get(bd->zone));
bd->sticky = 0;
e_hints_window_sticky_set(bd->client.win, 0);
e_hints_window_sticky_set(bd, 0);
ev = E_NEW(E_Event_Border_Unstick, 1);
ev->border = bd;
@ -2545,8 +2545,7 @@ _e_border_eval(E_Border *bd)
/* fetch any info queued to be fetched */
if (bd->client.icccm.fetch.title)
{
if (bd->client.icccm.title) free(bd->client.icccm.title);
bd->client.icccm.title = e_hints_window_name_get(bd->client.win);
e_hints_window_name_get(bd);
bd->client.icccm.fetch.title = 0;
if (bd->bg_object)
{

View File

@ -149,30 +149,34 @@ e_hints_client_stacking_set(void)
}
void
e_hints_active_window_set(E_Manager *man, Ecore_X_Window win)
e_hints_active_window_set(E_Manager *man, E_Border *bd)
{
E_OBJECT_CHECK(man);
ecore_x_netwm_client_active_set(man->root, win);
if (bd)
ecore_x_netwm_client_active_set(man->root, bd->client.win);
else
ecore_x_netwm_client_active_set(man->root, 0);
}
void
e_hints_window_name_set(Ecore_X_Window win, const char *name)
e_hints_window_name_set(E_Border *bd)
{
ecore_x_icccm_title_set(win, name);
ecore_x_netwm_name_set(win, name);
ecore_x_icccm_title_set(bd->client.win, bd->client.icccm.title);
ecore_x_netwm_name_set(bd->client.win, bd->client.icccm.title);
}
char *
e_hints_window_name_get(Ecore_X_Window win)
void
e_hints_window_name_get(E_Border *bd)
{
char *name;
name = ecore_x_netwm_name_get(win);
name = ecore_x_netwm_name_get(bd->client.win);
if (!name)
name = ecore_x_icccm_title_get(win);
name = ecore_x_icccm_title_get(bd->client.win);
if (!name)
name = strdup("No name!!");
return name;
if (bd->client.icccm.title) free(bd->client.icccm.title);
bd->client.icccm.title = name;
}
void
@ -267,7 +271,7 @@ e_hints_window_init(E_Border *bd)
if (bd->client.netwm.state.sticky)
e_border_stick(bd);
if (bd->client.netwm.state.shaded)
e_border_shade(bd, e_hints_window_shade_direction_get(bd->client.win));
e_border_shade(bd, e_hints_window_shade_direction_get(bd));
if (bd->client.netwm.state.maximized_v && bd->client.netwm.state.maximized_h)
e_border_maximize(bd);
if (bd->client.icccm.state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
@ -356,45 +360,78 @@ e_hints_window_state_get(E_Border *bd)
}
void
e_hints_window_visible_set(Ecore_X_Window win)
e_hints_window_visible_set(E_Border *bd)
{
ecore_x_icccm_state_set(win, ECORE_X_WINDOW_STATE_HINT_NORMAL);
ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_HIDDEN, 0);
if (bd->client.icccm.state != ECORE_X_WINDOW_STATE_HINT_NORMAL)
{
ecore_x_icccm_state_set(bd->client.win, ECORE_X_WINDOW_STATE_HINT_NORMAL);
bd->client.icccm.state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
}
if (bd->client.netwm.state.hidden)
{
ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_HIDDEN, 0);
bd->client.netwm.state.hidden = 0;
}
}
void
e_hints_window_iconic_set(Ecore_X_Window win)
e_hints_window_iconic_set(E_Border *bd)
{
ecore_x_icccm_state_set(win, ECORE_X_WINDOW_STATE_HINT_ICONIC);
ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_HIDDEN, 1);
if (bd->client.icccm.state != ECORE_X_WINDOW_STATE_HINT_ICONIC)
{
ecore_x_icccm_state_set(bd->client.win, ECORE_X_WINDOW_STATE_HINT_ICONIC);
bd->client.icccm.state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
}
if (!bd->client.netwm.state.hidden)
{
ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_HIDDEN, 1);
bd->client.netwm.state.hidden = 1;
}
}
void
e_hints_window_hidden_set(Ecore_X_Window win)
e_hints_window_hidden_set(E_Border *bd)
{
ecore_x_icccm_state_set(win, ECORE_X_WINDOW_STATE_HINT_WITHDRAWN);
ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_HIDDEN, 1);
if (bd->client.icccm.state != ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
{
ecore_x_icccm_state_set(bd->client.win, ECORE_X_WINDOW_STATE_HINT_WITHDRAWN);
bd->client.icccm.state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
}
if (!bd->client.netwm.state.hidden)
{
ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_HIDDEN, 1);
bd->client.netwm.state.hidden = 1;
}
}
void
e_hints_window_shaded_set(Ecore_X_Window win, int on)
e_hints_window_shaded_set(E_Border *bd, int on)
{
ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_SHADED, on);
if ((!bd->client.netwm.state.shaded) && (on))
{
ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_SHADED, 1);
bd->client.netwm.state.shaded = 1;
}
else if ((bd->client.netwm.state.shaded) && (!on))
{
ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_SHADED, 0);
bd->client.netwm.state.shaded = 0;
}
}
void
e_hints_window_shade_direction_set(Ecore_X_Window win, E_Direction dir)
e_hints_window_shade_direction_set(E_Border *bd, E_Direction dir)
{
ecore_x_window_prop_card32_set(win, E_ATOM_SHADE_DIRECTION, &dir, 1);
ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_SHADE_DIRECTION, &dir, 1);
}
E_Direction
e_hints_window_shade_direction_get(Ecore_X_Window win)
e_hints_window_shade_direction_get(E_Border *bd)
{
int ret;
E_Direction dir;
ret = ecore_x_window_prop_card32_get(win,
ret = ecore_x_window_prop_card32_get(bd->client.win,
E_ATOM_SHADE_DIRECTION,
&dir, 1);
if (ret == 1)
@ -404,22 +441,59 @@ e_hints_window_shade_direction_get(Ecore_X_Window win)
}
void
e_hints_window_maximized_set(Ecore_X_Window win, int on)
e_hints_window_maximized_set(E_Border *bd, int on)
{
ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_MAXIMIZED_VERT, on);
ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ, on);
if ((!bd->client.netwm.state.maximized_v) && (on))
{
ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_MAXIMIZED_VERT, 1);
bd->client.netwm.state.maximized_v = 1;
}
else if ((bd->client.netwm.state.maximized_v) && (!on))
{
ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_MAXIMIZED_VERT, 0);
bd->client.netwm.state.maximized_v = 0;
}
if ((!bd->client.netwm.state.maximized_h) && (on))
{
ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ, 1);
bd->client.netwm.state.maximized_h = 1;
}
else if ((bd->client.netwm.state.maximized_h) && (!on))
{
ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ, 0);
bd->client.netwm.state.maximized_h = 0;
}
}
void
e_hints_window_fullscreen_set(Ecore_X_Window win, int on)
e_hints_window_fullscreen_set(E_Border *bd, int on)
{
ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_FULLSCREEN, on);
if ((!bd->client.netwm.state.fullscreen) && (on))
{
ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_FULLSCREEN, 1);
bd->client.netwm.state.fullscreen = 1;
}
else if ((bd->client.netwm.state.fullscreen) && (!on))
{
ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_FULLSCREEN, 0);
bd->client.netwm.state.fullscreen = 0;
}
}
void
e_hints_window_sticky_set(Ecore_X_Window win, int on)
e_hints_window_sticky_set(E_Border *bd, int on)
{
ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_STICKY, on);
ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_STICKY, on);
if ((!bd->client.netwm.state.sticky) && (on))
{
ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_STICKY, 1);
bd->client.netwm.state.sticky = 1;
}
else if ((bd->client.netwm.state.sticky) && (!on))
{
ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_STICKY, 0);
bd->client.netwm.state.sticky = 0;
}
}
/*
@ -432,13 +506,11 @@ ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_BELOW, on);
*/
void
e_hints_window_icon_name_get(Ecore_X_Window win)
e_hints_window_icon_name_get(E_Border *bd)
{
E_Border *bd;
char *name;
name = ecore_x_netwm_icon_name_get(win);
bd = e_border_find_by_client_window(win);
name = ecore_x_netwm_icon_name_get(bd->client.win);
if (bd->client.icccm.icon_name)
free(bd->client.icccm.icon_name);
bd->client.icccm.icon_name = name;

View File

@ -9,26 +9,33 @@
EAPI void e_hints_init(void);
EAPI void e_hints_client_list_set(void);
EAPI void e_hints_client_stacking_set(void);
EAPI void e_hints_active_window_set(E_Manager *man, Ecore_X_Window win);
EAPI void e_hints_window_name_set(Ecore_X_Window win, const char *name);
EAPI char *e_hints_window_name_get(Ecore_X_Window win);
EAPI void e_hints_active_window_set(E_Manager *man, E_Border *bd);
EAPI void e_hints_window_name_set(E_Border *bd);
EAPI void e_hints_window_name_get(E_Border *bd);
EAPI void e_hints_desktop_config_set(void);
EAPI void e_hints_window_init(E_Border *bd);
EAPI void e_hints_window_state_set(E_Border *bd);
EAPI void e_hints_window_state_get(E_Border *bd);
EAPI void e_hints_window_type_set(E_Border *bd);
EAPI void e_hints_window_type_get(E_Border *bd);
EAPI void e_hints_window_visible_set(Ecore_X_Window win);
EAPI void e_hints_window_iconic_set(Ecore_X_Window win);
EAPI void e_hints_window_hidden_set(Ecore_X_Window win);
EAPI void e_hints_window_shaded_set(Ecore_X_Window win, int on);
EAPI void e_hints_window_shade_direction_set(Ecore_X_Window win, E_Direction dir);
EAPI E_Direction e_hints_window_shade_direction_get(Ecore_X_Window win);
EAPI void e_hints_window_maximized_set(Ecore_X_Window win, int on);
EAPI void e_hints_window_sticky_set(Ecore_X_Window win, int on);
EAPI void e_hints_window_fullscreen_set(Ecore_X_Window win, int on);
EAPI void e_hints_window_icon_name_get(Ecore_X_Window win);
EAPI void e_hints_window_visible_set(E_Border *bd);
EAPI void e_hints_window_iconic_set(E_Border *bd);
EAPI void e_hints_window_hidden_set(E_Border *bd);
EAPI void e_hints_window_shade_direction_set(E_Border *bd, E_Direction dir);
EAPI E_Direction e_hints_window_shade_direction_get(E_Border *bd);
EAPI void e_hints_window_shaded_set(E_Border *bd, int on);
EAPI void e_hints_window_maximized_set(E_Border *bd, int on);
EAPI void e_hints_window_sticky_set(E_Border *bd, int on);
EAPI void e_hints_window_fullscreen_set(E_Border *bd, int on);
EAPI void e_hints_window_icon_name_get(E_Border *bd);
#endif
#endif