Support internal state hints.

SVN revision: 16412
This commit is contained in:
sebastid 2005-08-30 01:15:25 +00:00 committed by sebastid
parent 9af397cca9
commit af4803ee85
4 changed files with 66 additions and 6 deletions

View File

@ -401,6 +401,14 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map)
bd->client.netwm.fetch.state = 1; bd->client.netwm.fetch.state = 1;
} }
} }
/* loop to check for own atoms */
for (i = 0; i < at_num; i++)
{
if (atoms[i] == E_ATOM_WINDOW_STATE)
{
bd->client.e.fetch.state = 1;
}
}
free(atoms); free(atoms);
} }
} }
@ -3997,6 +4005,11 @@ _e_border_eval(E_Border *bd)
e_hints_window_state_get(bd); e_hints_window_state_get(bd);
bd->client.netwm.fetch.state = 0; bd->client.netwm.fetch.state = 0;
} }
if (bd->client.e.fetch.state)
{
e_hints_window_e_state_get(bd);
bd->client.e.fetch.state = 0;
}
if (bd->client.netwm.fetch.type) if (bd->client.netwm.fetch.type)
{ {
e_hints_window_type_get(bd); e_hints_window_type_get(bd);
@ -4689,11 +4702,11 @@ _e_border_eval(E_Border *bd)
} }
} }
free(pnd); free(pnd);
bd->pending_move_resize = evas_list_remove_list(bd->pending_move_resize, bd->pending_move_resize); bd->pending_move_resize = evas_list_remove_list(bd->pending_move_resize,
bd->pending_move_resize);
} }
/* Recreate state */ /* Recreate state */
/* FIXME: this should be split into property fetches and state setup */
e_hints_window_init(bd); e_hints_window_init(bd);
ecore_x_icccm_move_resize_send(bd->client.win, ecore_x_icccm_move_resize_send(bd->client.win,

View File

@ -259,6 +259,18 @@ struct _E_Border
unsigned char state : 1; unsigned char state : 1;
} update; } update;
} netwm; } netwm;
/* Extra e stuff */
struct {
struct {
unsigned char centered : 1;
} state;
struct {
unsigned char state : 1;
} fetch;
} e;
Ecore_X_Window_Attributes initial_attributes; Ecore_X_Window_Attributes initial_attributes;
} client; } client;

View File

@ -442,6 +442,14 @@ e_hints_window_init(E_Border *bd)
* show it! */ * show it! */
else if (bd->desk == e_desk_current_get(bd->zone)) else if (bd->desk == e_desk_current_get(bd->zone))
e_border_show(bd); e_border_show(bd);
/* e hints */
if (bd->client.e.state.centered)
{
e_border_move(bd,
bd->zone->x + (bd->zone->w - bd->w) / 2,
bd->zone->y + (bd->zone->h - bd->h) / 2);
}
/* Update stacking */ /* Update stacking */
e_hints_client_list_set(); e_hints_client_list_set();
@ -452,9 +460,7 @@ void
e_hints_window_state_set(E_Border *bd) e_hints_window_state_set(E_Border *bd)
{ {
Ecore_X_Window_State state[10]; Ecore_X_Window_State state[10];
int num; int num = 0;
num = 0;
if (bd->client.netwm.state.modal) if (bd->client.netwm.state.modal)
state[num++] = ECORE_X_WINDOW_STATE_MODAL; state[num++] = ECORE_X_WINDOW_STATE_MODAL;
@ -1074,3 +1080,29 @@ e_hints_window_desktop_set(E_Border *bd)
#endif #endif
bd->client.netwm.desktop = (bd->desk->y * bd->zone->desk_x_count) + bd->desk->x; bd->client.netwm.desktop = (bd->desk->y * bd->zone->desk_x_count) + bd->desk->x;
} }
void
e_hints_window_e_state_get(E_Border *bd)
{
/* Remember to update the count if we add more states! */
Ecore_X_Atom state[1];
int num;
memset(state, 0, sizeof(state));
num = ecore_x_window_prop_card32_get(bd->client.win, E_ATOM_WINDOW_STATE, state, 1);
if (num)
{
int i;
for (i = 0; i < num; i++)
{
if (state[i] == E_ATOM_WINDOW_STATE_CENTERED)
bd->client.e.state.centered = 1;
}
}
}
void
e_hints_window_e_state_set(E_Border *bd)
{
/* TODO */
}

View File

@ -42,5 +42,8 @@ EAPI void e_hints_window_stacking_set(E_Border *bd, E_Stacking stacking);
EAPI void e_hints_window_desktop_set(E_Border *bd); EAPI void e_hints_window_desktop_set(E_Border *bd);
EAPI void e_hints_window_e_state_set(E_Border *bd);
EAPI void e_hints_window_e_state_get(E_Border *bd);
#endif #endif
#endif #endif