Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h actions.c borders.c edge.c ewmh.c size.c 


Log Message:
Initial fullscreen window state handling.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.275
retrieving revision 1.276
diff -u -3 -r1.275 -r1.276
--- E.h 31 May 2004 20:03:06 -0000      1.275
+++ E.h 31 May 2004 20:30:12 -0000      1.276
@@ -506,8 +506,9 @@
 #define ACTION_NEVERFOCUS             101
 #define ACTION_SKIPLISTS              102
 #define ACTION_SWAPMOVE               103
+#define ACTION_FULLSCREEN             104
 /* false number excluding the above list */
-#define ACTION_NUMBEROF               104
+#define ACTION_NUMBEROF               105
 
 #define MODE_NONE                 0
 #define MODE_MOVE_PENDING         1
@@ -896,7 +897,7 @@
    int                 x, y, w, h;
    int                 shape_x, shape_y;
    int                 req_x, req_y;
-   int                 lx, ly, lw, lh;
+   int                 lx, ly, lw, lh, ll;
    char                type;
    char                state;
    char                internal;
@@ -936,7 +937,6 @@
    char                focusclick;
    char                neverfocus;
    char                no_actions;
-   int                 ewmh_flags;
    Menu               *menu;
    Window              shownmenu;
    Dialog             *dialog;
@@ -954,6 +954,12 @@
    int                 head;
    struct
    {
+      unsigned            maximized_horz:1;
+      unsigned            maximized_vert:1;
+      unsigned            fullscreen:1;
+   } st;
+   struct
+   {
       char               *wm_name;
       char               *wm_icon_name;
       char               *wm_res_name;
@@ -1320,6 +1326,7 @@
    int                 last_button;
    Time                last_time;
    char                queue_up;
+   char                edge_flip_inhibit;
 }
 EMode;
 
@@ -1723,6 +1730,7 @@
 void                InstantUnShadeEwin(EWin * ewin);
 void                ShadeEwin(EWin * ewin);
 void                UnShadeEwin(EWin * ewin);
+void                EwinSetFullscreen(EWin * ewin, int on);
 void                EwinSetBorder(EWin * ewin, Border * b, int apply);
 void                EwinSetBorderByName(EWin * ewin, const char *name,
                                        int apply);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/actions.c,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -3 -r1.163 -r1.164
--- actions.c   30 May 2004 16:43:28 -0000      1.163
+++ actions.c   31 May 2004 20:30:12 -0000      1.164
@@ -926,6 +926,26 @@
    return ActionMoveStart(ewin, params, 0, 0);
 }
 
+static int
+doFullscreen(EWin * ewin, const void *params)
+{
+   int                 on;
+
+   on = 0;
+   if (!params)
+      on = !ewin->st.fullscreen;
+   else if (!strcmp(params, "on"))
+      on = 1;
+   EwinSetFullscreen(ewin, on);
+
+   /* Inhibit edge flip while in fullscreen mode */
+   /* FIXME: Breaks when multiple windows enter/leave fullscreen state */
+   Mode.edge_flip_inhibit = on;
+   ShowEdgeWindows();
+
+   return 0;
+}
+
 #if 0                          /* Not used */
 static int
 doMoveConstrainedNoGroup(EWin * ewin, const void *params)
@@ -3430,5 +3450,6 @@
    {1, 0, 0, 0, doSkipWinList},        /* ACTION_SKIPWINLIST */
    {1, 0, 0, 0, doNeverFocus}, /* ACTION_NEVERFOCUS */
    {1, 0, 0, 0, doSkipLists},  /* ACTION_SKIPLISTS */
-   {1, 0, 0, 1, doSwapMove}    /* ACTION_SWAPMOVE */
+   {1, 0, 0, 1, doSwapMove},   /* ACTION_SWAPMOVE */
+   {1, 0, 0, 0, doFullscreen}  /* ACTION_FULLSCREEN */
 };
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.185
retrieving revision 1.186
diff -u -3 -r1.185 -r1.186
--- borders.c   29 May 2004 20:42:06 -0000      1.185
+++ borders.c   31 May 2004 20:30:12 -0000      1.186
@@ -3048,6 +3048,45 @@
 }
 
 void
+EwinSetFullscreen(EWin * ewin, int on)
+{
+   int                 x, y, w, h;
+
+   if (ewin->st.fullscreen == on)
+      return;
+
+   if (on)
+     {
+       ewin->lx = ewin->x;
+       ewin->ly = ewin->y;
+       ewin->lw = ewin->client.w;
+       ewin->lh = ewin->client.h;
+       ewin->ll = ewin->layer;
+       ScreenGetGeometry(ewin->x, ewin->y, &x, &y, &w, &h);
+       x -= ewin->border->border.left;
+       y -= ewin->border->border.top;
+#if 0
+       ewin->layer = 10;
+#endif
+       ewin->fixedpos = 1;
+       ewin->st.fullscreen = 1;
+     }
+   else
+     {
+       x = ewin->lx;
+       y = ewin->ly;
+       w = ewin->lw;
+       h = ewin->lh;
+       ewin->layer = ewin->ll;
+       ewin->fixedpos = 0;     /* Yeah - well */
+       ewin->st.fullscreen = 0;
+     }
+   RaiseEwin(ewin);
+   MoveResizeEwin(ewin, x, y, w, h);
+   HintsSetWindowState(ewin);
+}
+
+void
 EwinSetArea(EWin * ewin, int ax, int ay)
 {
    if (ax == ewin->area_x && ay == ewin->area_y)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/edge.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- edge.c      16 May 2004 15:52:44 -0000      1.4
+++ edge.c      31 May 2004 20:30:12 -0000      1.5
@@ -31,7 +31,7 @@
 {
    int                 ax, ay, aw, ah, dx, dy, dax, day;
 
-   if (Mode.cur_menu_mode > 0)
+   if (Mode.edge_flip_inhibit || (Mode.cur_menu_mode > 0))
       return;
    if (!Conf.edge_flip_resistance)
       return;
@@ -93,11 +93,12 @@
 {
    int                 ax, ay, cx, cy;
 
-   if (Conf.edge_flip_resistance <= 0)
+   if (Mode.edge_flip_inhibit || (Conf.edge_flip_resistance <= 0))
      {
        HideEdgeWindows();
        return;
      }
+
    if (!w1)
      {
        w1 = ECreateEventWindow(VRoot.win, 0, 0, 1, VRoot.h);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewmh.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -3 -r1.49 -r1.50
--- ewmh.c      23 May 2004 16:11:36 -0000      1.49
+++ ewmh.c      31 May 2004 20:30:12 -0000      1.50
@@ -127,10 +127,6 @@
 #define _NET_WM_STATE_ADD       1
 #define _NET_WM_STATE_TOGGLE    2
 
-/* EWMH flags (somewhat messy) */
-#define NET_WM_FLAG_MAXIMIZED_VERT  0x01
-#define NET_WM_FLAG_MAXIMIZED_HORZ  0x02
-
 /*
  * Set/clear Atom in list
  */
@@ -219,9 +215,7 @@
    _ATOM_INIT(_NET_WM_STATE_SKIP_TASKBAR);
    _ATOM_INIT(_NET_WM_STATE_SKIP_PAGER);
    _ATOM_INIT(_NET_WM_STATE_HIDDEN);
-#if 0                          /* Not implemented */
    _ATOM_INIT(_NET_WM_STATE_FULLSCREEN);
-#endif
    _ATOM_INIT(_NET_WM_STATE_ABOVE);
    _ATOM_INIT(_NET_WM_STATE_BELOW);
 
@@ -489,9 +483,11 @@
    atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_HIDDEN,
                 ewin->iconified || ewin->shaded);
    atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_MAXIMIZED_VERT,
-                ewin->ewmh_flags & NET_WM_FLAG_MAXIMIZED_VERT);
+                ewin->st.maximized_vert);
    atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_MAXIMIZED_HORZ,
-                ewin->ewmh_flags & NET_WM_FLAG_MAXIMIZED_HORZ);
+                ewin->st.maximized_horz);
+   atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_FULLSCREEN,
+                ewin->st.fullscreen);
    atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_SKIP_PAGER,
                 ewin->skip_ext_pager);
    atom_list_set(atom_list, len, &atom_count, _NET_WM_STATE_ABOVE,
@@ -590,8 +586,6 @@
 
    EDBUG(6, "EWMH_GetWindowState");
 
-   ewin->ewmh_flags = 0;
-
    n_atoms = 0;
    p_atoms = AtomGet(ewin->client.win, _NET_WM_STATE, XA_ATOM, &n_atoms);
    n_atoms /= sizeof(Atom);    /* Silly */
@@ -601,7 +595,8 @@
    /* We must clear/set all according to not present/present */
    ewin->sticky = ewin->shaded = 0;
    ewin->skiptask = ewin->skip_ext_pager = 0;
-   ewin->ewmh_flags = 0;
+   ewin->st.maximized_horz = ewin->st.maximized_vert = 0;
+   ewin->st.fullscreen = 0;
 /* ewin->layer = No ... TBD */
 
    for (i = 0; i < n_atoms; i++)
@@ -618,9 +613,11 @@
        else if (atom == _NET_WM_STATE_HIDDEN)
           ;                    /* ewin->iconified = 1; No - WM_STATE does this */
        else if (atom == _NET_WM_STATE_MAXIMIZED_VERT)
-          ewin->ewmh_flags |= NET_WM_FLAG_MAXIMIZED_VERT;
+          ewin->st.maximized_vert = 1;
        else if (atom == _NET_WM_STATE_MAXIMIZED_HORZ)
-          ewin->ewmh_flags |= NET_WM_FLAG_MAXIMIZED_HORZ;
+          ewin->st.maximized_horz = 1;
+       else if (atom == _NET_WM_STATE_FULLSCREEN)
+          ewin->st.fullscreen = 1;
        else if (atom == _NET_WM_STATE_ABOVE)
           ewin->layer = 6;
        else if (atom == _NET_WM_STATE_BELOW)
@@ -852,51 +849,49 @@
                 atom == _NET_WM_STATE_MAXIMIZED_HORZ)
          {
             void                (*func) (EWin *, const char *);
-            int                 maskbits;
+            int                 maxh, maxv;
 
+            maxh = ewin->st.maximized_horz;
+            maxv = ewin->st.maximized_vert;
             if (atom2 == _NET_WM_STATE_MAXIMIZED_VERT || atom2 == 
_NET_WM_STATE_MAXIMIZED_HORZ)        /* (ok - ok) */
               {
                  func = MaxSize;
-                 maskbits = NET_WM_FLAG_MAXIMIZED_VERT |
-                    NET_WM_FLAG_MAXIMIZED_HORZ;
+                 maxh = do_set(maxh, action);
+                 maxv = do_set(maxv, action);
               }
             else if (atom == _NET_WM_STATE_MAXIMIZED_VERT)
               {
                  func = MaxHeight;
-                 maskbits = NET_WM_FLAG_MAXIMIZED_VERT;
+                 maxv = do_set(maxv, action);
               }
             else
               {
                  func = MaxWidth;
-                 maskbits = NET_WM_FLAG_MAXIMIZED_HORZ;
+                 maxh = do_set(maxh, action);
               }
 
-            if (ewin->ewmh_flags & maskbits)
-              {
-                 if (action != _NET_WM_STATE_ADD)
-                   {
-                      ewin->ewmh_flags &= ~maskbits;
-                      ewin->toggle = 1;
-                   }
-              }
+            if ((ewin->st.maximized_horz == maxh) &&
+                (ewin->st.maximized_vert == maxv))
+               goto done;
+
+            if ((ewin->st.maximized_horz && !maxh) ||
+                (ewin->st.maximized_vert && !maxv))
+               ewin->toggle = 1;
             else
-              {
-                 if (action != _NET_WM_STATE_REMOVE)
-                   {
-                      ewin->ewmh_flags |= maskbits;
-                      ewin->toggle = 0;
-                   }
-              }
+               ewin->toggle = 0;
+
             func(ewin, "available");
             RememberImportantInfoForEwin(ewin);
             EWMH_SetWindowState(ewin);
-            ewin->toggle = 0;
          }
-#if 0                          /* Not yet implemented */
        else if (atom == _NET_WM_STATE_FULLSCREEN)
          {
+            action = do_set(ewin->st.fullscreen, action);
+            if (ewin->st.fullscreen == action)
+               goto done;
+
+            ActionsCall(ACTION_FULLSCREEN, ewin, (action) ? "on" : "off");
          }
-#endif
        else if (atom == _NET_WM_STATE_ABOVE)
          {
             action = do_set(ewin->layer >= 6, action);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/size.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- size.c      4 May 2004 19:04:41 -0000       1.36
+++ size.c      31 May 2004 20:30:12 -0000      1.37
@@ -48,6 +48,8 @@
        ewin->ly = ewin->y;
        ewin->lw = ewin->client.w;
        ewin->lh = ewin->client.h;
+       ewin->st.maximized_horz = 0;
+       ewin->st.maximized_vert = 0;
        ewin->toggle = 0;
        goto done;
      }
@@ -128,6 +130,8 @@
             y = y1;
             h = y2 - y1 - (ewin->border->border.top +
                            ewin->border->border.bottom);
+
+            ewin->st.maximized_vert = 1;
          }
 
        if (direction & MAX_HOR)
@@ -153,6 +157,8 @@
             x = x1;
             w = x2 - x1 - (ewin->border->border.left +
                            ewin->border->border.right);
+
+            ewin->st.maximized_horz = 1;
          }
 
        break;




-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to