From 6b57b607335c1d249a8119e04191bf4268802f1f Mon Sep 17 00:00:00 2001 From: rbdpngn Date: Sun, 10 Jul 2005 17:12:01 +0000 Subject: [PATCH] Fix TODO bug for maximized windows across restarts. SVN revision: 15717 --- TODO | 1 - src/bin/e_atoms.c | 4 +++- src/bin/e_atoms.h | 1 + src/bin/e_border.c | 27 +++++++++++++++++++-------- src/bin/e_hints.c | 34 +++++++++++++++++++++++++++++++++- src/bin/e_hints.h | 5 +++++ 6 files changed, 61 insertions(+), 11 deletions(-) diff --git a/TODO b/TODO index 431a8fae0..55ad47620 100644 --- a/TODO +++ b/TODO @@ -27,7 +27,6 @@ Some of the things (in very short form) that need to be done to E17... * BUG: sometimes the mouse gets locked to a window with a mouse grab of some sort in x (it gets the down event and not the up?) so e thinks its down but it isn't - happens a lot in click to focus. -* BUG: maximised apps when e restarts are not recognised as maximised * BUG: client windows list somehow doesn't unref its list of borders in the free callback set on it. why? is this callback never called? or is the data pointer on the menu object null for some reason? diff --git a/src/bin/e_atoms.c b/src/bin/e_atoms.c index aeedcd92f..c533723c5 100644 --- a/src/bin/e_atoms.c +++ b/src/bin/e_atoms.c @@ -11,6 +11,7 @@ Ecore_X_Atom E_ATOM_DESK = 0; Ecore_X_Atom E_ATOM_MAPPED = 0; Ecore_X_Atom E_ATOM_SHADE_DIRECTION = 0; Ecore_X_Atom E_ATOM_HIDDEN = 0; +Ecore_X_Atom E_ATOM_SAVED_SIZE = 0; /* externally accessible functions */ int @@ -23,7 +24,8 @@ e_atoms_init(void) E_ATOM_MAPPED = ecore_x_atom_get("__E_WINDOW_MAPPED"); E_ATOM_SHADE_DIRECTION = ecore_x_atom_get("__E_WINDOW_SHADE_DIRECTION"); E_ATOM_HIDDEN = ecore_x_atom_get("__E_WINDOW_HIDDEN"); - + E_ATOM_SAVED_SIZE = ecore_x_atom_get("__E_WINDOW_SAVED_SIZE"); + return 1; } diff --git a/src/bin/e_atoms.h b/src/bin/e_atoms.h index 51017ff82..827635410 100644 --- a/src/bin/e_atoms.h +++ b/src/bin/e_atoms.h @@ -16,6 +16,7 @@ extern EAPI Ecore_X_Atom E_ATOM_DESK; extern EAPI Ecore_X_Atom E_ATOM_MAPPED; extern EAPI Ecore_X_Atom E_ATOM_SHADE_DIRECTION; extern EAPI Ecore_X_Atom E_ATOM_HIDDEN; +extern EAPI Ecore_X_Atom E_ATOM_SAVED_SIZE; EAPI int e_atoms_init(void); EAPI int e_atoms_shutdown(void); diff --git a/src/bin/e_border.c b/src/bin/e_border.c index c4c1ac48f..4d9db50eb 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -1110,10 +1110,14 @@ e_border_maximize(E_Border *bd, E_Maximize max) int w, h; // printf("MAXIMIZE!!\n"); - bd->saved.x = bd->x; - bd->saved.y = bd->y; - bd->saved.w = bd->w; - bd->saved.h = bd->h; + if (!bd->saved.x && !bd->saved.y && !bd->saved.w && !bd->saved.h) + { + bd->saved.x = bd->x; + bd->saved.y = bd->y; + bd->saved.w = bd->w; + bd->saved.h = bd->h; + e_hints_window_saved_size_set(bd, bd->x, bd->y, bd->w, bd->h); + } e_border_raise(bd); switch (max) @@ -1254,6 +1258,8 @@ e_border_unmaximize(E_Border *bd) bd->maximized = E_MAXIMIZE_NONE; e_border_move_resize(bd, bd->saved.x, bd->saved.y, bd->saved.w, bd->saved.h); + bd->saved.x = bd->saved.y = bd->saved.w = bd->saved.h = 0; + e_hints_window_saved_size_set(bd, 0, 0, 0, 0); edje_object_signal_emit(bd->bg_object, "unmaximize", ""); } @@ -1275,10 +1281,15 @@ e_border_fullscreen(E_Border *bd) { int x, y, w, h; // printf("FULLSCREEEN!\n"); - bd->saved.x = bd->x; - bd->saved.y = bd->y; - bd->saved.w = bd->w; - bd->saved.h = bd->h; + if (!bd->saved.x && !bd->saved.y && !bd->saved.w && !bd->saved.h) + { + bd->saved.x = bd->x; + bd->saved.y = bd->y; + bd->saved.w = bd->w; + bd->saved.h = bd->h; + e_hints_window_saved_size_set(bd, bd->x, bd->y, bd->w, bd->h); + } + bd->client_inset.sl = bd->client_inset.l; bd->client_inset.sr = bd->client_inset.r; bd->client_inset.st = bd->client_inset.t; diff --git a/src/bin/e_hints.c b/src/bin/e_hints.c index cec7a5e61..7e932283e 100644 --- a/src/bin/e_hints.c +++ b/src/bin/e_hints.c @@ -398,7 +398,10 @@ e_hints_window_init(E_Border *bd) if (bd->client.netwm.state.shaded) 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, e_config->maximize_policy); + { + e_hints_window_saved_size_get(bd, &bd->saved.x, &bd->saved.y, &bd->saved.w, &bd->saved.h); + e_border_maximize(bd, e_config->maximize_policy); + } if (bd->client.netwm.state.fullscreen) e_border_fullscreen(bd); if ((bd->client.icccm.state == ECORE_X_WINDOW_STATE_HINT_ICONIC) @@ -994,6 +997,35 @@ e_hints_window_shade_direction_get(E_Border *bd) return E_DIRECTION_UP; } +void +e_hints_window_saved_size_set(E_Border *bd, int x, int y, int w, int h) +{ + unsigned int sizes[4]; + + sizes[0] = x; + sizes[1] = y; + sizes[2] = w; + sizes[3] = h; + ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_SAVED_SIZE, sizes, 4); +} + +int +e_hints_window_saved_size_get(E_Border *bd, int *x, int *y, int *w, int *h) +{ + int ret; + int sizes[4]; + + memset(sizes, 0, sizeof(sizes)); + ret = ecore_x_window_prop_card32_get(bd->client.win, E_ATOM_SAVED_SIZE, + sizes, 4); + if (x) *x = sizes[0]; + if (y) *y = sizes[1]; + if (w) *w = sizes[2]; + if (h) *h = sizes[3]; + + return ret; +} + void e_hints_window_maximized_set(E_Border *bd, int on) { diff --git a/src/bin/e_hints.h b/src/bin/e_hints.h index fc4f9286c..9eb9e51ae 100644 --- a/src/bin/e_hints.h +++ b/src/bin/e_hints.h @@ -30,6 +30,11 @@ 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_saved_size_set(E_Border *bd, + int x, int y, int w, int h); +EAPI int e_hints_window_saved_size_get(E_Border *bd, + int *x, int *y, int *w, int *h); + 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_fullscreen_set(E_Border *bd, int on);