Fix TODO bug for maximized windows across restarts.
authorrbdpngn <rbdpngn>
Sun, 10 Jul 2005 17:12:01 +0000 (17:12 +0000)
committerrbdpngn <rbdpngn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 10 Jul 2005 17:12:01 +0000 (17:12 +0000)
SVN revision: 15717

TODO
src/bin/e_atoms.c
src/bin/e_atoms.h
src/bin/e_border.c
src/bin/e_hints.c
src/bin/e_hints.h

diff --git a/TODO b/TODO
index 431a8fa..55ad476 100644 (file)
--- 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?
index aeedcd9..c533723 100644 (file)
@@ -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;
 }
 
index 51017ff..8276354 100644 (file)
@@ -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);
index c4c1ac4..4d9db50 100644 (file)
@@ -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;
index cec7a5e..7e93228 100644 (file)
@@ -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)
@@ -995,6 +998,35 @@ e_hints_window_shade_direction_get(E_Border *bd)
 }
 
 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)
 {
    if ((!bd->client.netwm.state.maximized_v) && (on))
index fc4f928..9eb9e51 100644 (file)
@@ -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);