From af4803ee85eee37302dd17018fc3d1c504fa6775 Mon Sep 17 00:00:00 2001 From: sebastid Date: Tue, 30 Aug 2005 01:15:25 +0000 Subject: [PATCH] Support internal state hints. SVN revision: 16412 --- src/bin/e_border.c | 17 +++++++++++++++-- src/bin/e_border.h | 12 ++++++++++++ src/bin/e_hints.c | 38 +++++++++++++++++++++++++++++++++++--- src/bin/e_hints.h | 5 ++++- 4 files changed, 66 insertions(+), 6 deletions(-) diff --git a/src/bin/e_border.c b/src/bin/e_border.c index d21e309db..8fabc61ed 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -401,6 +401,14 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map) 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); } } @@ -3997,6 +4005,11 @@ _e_border_eval(E_Border *bd) e_hints_window_state_get(bd); 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) { e_hints_window_type_get(bd); @@ -4689,11 +4702,11 @@ _e_border_eval(E_Border *bd) } } 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 */ - /* FIXME: this should be split into property fetches and state setup */ e_hints_window_init(bd); ecore_x_icccm_move_resize_send(bd->client.win, diff --git a/src/bin/e_border.h b/src/bin/e_border.h index bbe374337..da0bb0c2c 100644 --- a/src/bin/e_border.h +++ b/src/bin/e_border.h @@ -259,6 +259,18 @@ struct _E_Border unsigned char state : 1; } update; } netwm; + + /* Extra e stuff */ + struct { + struct { + unsigned char centered : 1; + } state; + + struct { + unsigned char state : 1; + } fetch; + } e; + Ecore_X_Window_Attributes initial_attributes; } client; diff --git a/src/bin/e_hints.c b/src/bin/e_hints.c index d77fd3fb3..21c8995ff 100644 --- a/src/bin/e_hints.c +++ b/src/bin/e_hints.c @@ -442,6 +442,14 @@ e_hints_window_init(E_Border *bd) * show it! */ else if (bd->desk == e_desk_current_get(bd->zone)) 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 */ e_hints_client_list_set(); @@ -452,9 +460,7 @@ void e_hints_window_state_set(E_Border *bd) { Ecore_X_Window_State state[10]; - int num; - - num = 0; + int num = 0; if (bd->client.netwm.state.modal) state[num++] = ECORE_X_WINDOW_STATE_MODAL; @@ -1074,3 +1080,29 @@ e_hints_window_desktop_set(E_Border *bd) #endif 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 */ +} diff --git a/src/bin/e_hints.h b/src/bin/e_hints.h index 1fa1e8012..79a281037 100644 --- a/src/bin/e_hints.h +++ b/src/bin/e_hints.h @@ -41,6 +41,9 @@ EAPI void e_hints_window_sticky_set(E_Border *bd, int on); 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_e_state_set(E_Border *bd); +EAPI void e_hints_window_e_state_get(E_Border *bd); + #endif #endif