Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h comms.c desktops.c emodule.h events.c ewins.c pager.c 
        setup.c 


Log Message:
Handle screen resizing (xrandr). Event handling tweaks.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.353
retrieving revision 1.354
diff -u -3 -r1.353 -r1.354
--- E.h 30 Jan 2005 11:02:38 -0000      1.353
+++ E.h 31 Jan 2005 18:52:07 -0000      1.354
@@ -1380,6 +1380,7 @@
 int                 DesksGetNumber(void);
 int                 DesksGetCurrent(void);
 void                DesksSetCurrent(int desk);
+void                DesksResize(int w, int h);
 
 void                SlideWindowTo(Window win, int fx, int fy, int tx, int ty,
                                  int speed);
@@ -2079,6 +2080,7 @@
 /* setup.c */
 void                MapUnmap(int start);
 void                SetupX(const char *dstr);
+void                RootResize(int root, int w, int h);
 
 /* size.c */
 void                MaxSize(EWin * ewin, const char *resize_type);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/comms.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -3 -r1.64 -r1.65
--- comms.c     25 Jan 2005 21:56:32 -0000      1.64
+++ comms.c     31 Jan 2005 18:52:12 -0000      1.65
@@ -252,7 +252,7 @@
 {
    char                s[1024];
 
-   comms_win = XCreateSimpleWindow(disp, VRoot.win, -100, -100, 5, 5, 0, 0, 0);
+   comms_win = ECreateEventWindow(VRoot.win, -100, -100, 5, 5);
    ERegisterWindow(comms_win);
    XSelectInput(disp, comms_win, StructureNotifyMask | SubstructureNotifyMask);
    EventCallbackRegister(comms_win, 0, ClientHandleEvents, NULL);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -3 -r1.118 -r1.119
--- desktops.c  29 Jan 2005 15:14:03 -0000      1.118
+++ desktops.c  31 Jan 2005 18:52:15 -0000      1.119
@@ -459,6 +459,26 @@
    desks.desk[desk] = NULL;
 }
 
+static void
+DeskResize(int desk, int w, int h)
+{
+   Desk               *d;
+
+   d = _DeskGet(desk);
+
+   if (desk > 0)
+     {
+       EResizeWindow(disp, EoGetWin(d), w, h);
+       if (!d->viewable)
+          EMoveWindow(disp, EoGetWin(d), VRoot.w, 0);
+     }
+   BackgroundPixmapFree(d->bg);
+   RefreshDesktop(desk);
+   DeskControlsDestroy(d);
+   DeskControlsCreate(d);
+   DeskControlsShow(d);
+}
+
 Window
 DeskGetWin(int desk)
 {
@@ -555,7 +575,7 @@
 }
 
 static void
-DesktopsInit(void)
+DesksInit(void)
 {
    int                 i;
 
@@ -564,6 +584,20 @@
 }
 
 void
+DesksResize(int w, int h)
+{
+   int                 i;
+
+   for (i = 0; i < Conf.desks.num; i++)
+      DeskResize(i, w, h);
+
+   /* Restack buttons - Hmmm. */
+   StackDesktops();
+
+   ModulesSignal(ESIGNAL_DESK_RESIZE, NULL);
+}
+
+void
 DesktopsEventsConfigure(int mode)
 {
    int                 i;
@@ -1592,7 +1626,7 @@
    switch (sig)
      {
      case ESIGNAL_INIT:
-       DesktopsInit();
+       DesksInit();
        break;
 
      case ESIGNAL_CONFIGURE:
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/emodule.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- emodule.h   28 Dec 2004 23:46:45 -0000      1.2
+++ emodule.h   31 Jan 2005 18:52:16 -0000      1.3
@@ -58,6 +58,7 @@
    ESIGNAL_DESK_SWITCH_START,
    ESIGNAL_DESK_SWITCH_DONE,
    ESIGNAL_DESK_CHANGE,
+   ESIGNAL_DESK_RESIZE,
    ESIGNAL_BACKGROUND_CHANGE,
    ESIGNAL_MOVE_START,
    ESIGNAL_MOVE_DONE,
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/events.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -3 -r1.74 -r1.75
--- events.c    25 Jan 2005 21:57:00 -0000      1.74
+++ events.c    31 Jan 2005 18:52:16 -0000      1.75
@@ -301,9 +301,7 @@
        break;
      case ConfigureNotify:     /* 22 */
        if (ev->xconfigure.window == VRoot.win)
-          DialogOK("Wheee! (ConfigureNotify)",
-                   "Screen size changed to\n%dx%d pixels",
-                   ev->xconfigure.width, ev->xconfigure.height);
+          RootResize(0, ev->xconfigure.width, ev->xconfigure.height);
        break;
      case ConfigureRequest:    /* 23 */
        break;
@@ -321,9 +319,7 @@
        {
           XRRScreenChangeNotifyEvent *rrev = (XRRScreenChangeNotifyEvent *) ev;
 
-          DialogOK("Wheee! (RRScreenChangeNotify)",
-                   "Screen size changed to\n%dx%d pixels (%dx%d millimeters)",
-                   rrev->width, rrev->height, rrev->mwidth, rrev->mheight);
+          RootResize(1, rrev->width, rrev->height);
        }
        break;
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- ewins.c     30 Jan 2005 11:02:42 -0000      1.13
+++ ewins.c     31 Jan 2005 18:52:17 -0000      1.14
@@ -33,11 +33,11 @@
 #define EWIN_CONTAINER_EVENT_MASK \
   (/* ButtonPressMask | ButtonReleaseMask | */ \
    /* StructureNotifyMask | ResizeRedirectMask | */ \
-   /* SubstructureNotifyMask | */ SubstructureRedirectMask)
+   SubstructureNotifyMask | SubstructureRedirectMask)
 
 #define EWIN_CLIENT_EVENT_MASK \
   (EnterWindowMask | LeaveWindowMask | FocusChangeMask | \
-   StructureNotifyMask | ResizeRedirectMask | \
+   /* StructureNotifyMask | */ ResizeRedirectMask | \
    PropertyChangeMask | ColormapChangeMask | VisibilityChangeMask)
 
 static void         EwinHandleEventsToplevel(XEvent * ev, void *prm);
@@ -1025,7 +1025,6 @@
 EwinReparent(EWin * ewin, Window parent)
 {
    EReparentWindow(disp, ewin->client.win, parent, 0, 0);
-   EDestroyWindow(disp, EoGetWin(ewin));
 }
 
 static void
@@ -1120,7 +1119,10 @@
        Mode.doingslide = 0;
      }
 
-   HideEwin(ewin);
+   ewin->shown = 0;
+   /* FIXME - This is to sync the client.win EXID mapped state */
+   EUnmapWindow(disp, ewin->client.win);
+   EUnmapWindow(disp, EoGetWin(ewin));
 
    ModulesSignal(ESIGNAL_EWIN_UNMAP, ewin);
 
@@ -1135,7 +1137,8 @@
    if (ewin->Close)
       ewin->Close(ewin);
 
-   EwinWithdraw(ewin);
+   if (WinGetParent(ewin->client.win) == ewin->win_container)
+      EwinWithdraw(ewin);
 }
 
 static void
@@ -1779,6 +1782,21 @@
      }
 }
 
+static void
+EwinsTouch(void)
+{
+   int                 i, num;
+   EWin               *const *lst, *ewin;
+
+   lst = EwinListStackGet(&num);
+   for (i = num - 1; i >= 0; i--)
+     {
+       ewin = lst[i];
+       if (EwinIsMapped(ewin))
+          MoveEwin(ewin, EoGetX(ewin), EoGetY(ewin));
+     }
+}
+
 void
 EwinsSetFree(void)
 {
@@ -1883,6 +1901,34 @@
      case CirculateRequest:
        EwinEventCirculateRequest(ewin, ev);
        break;
+
+     case DestroyNotify:
+       EwinEventDestroy(ewin);
+       break;
+     case UnmapNotify:
+#if 0
+       if (ewin->state == EWIN_STATE_NEW)
+         {
+            Eprintf("EwinEventUnmap %#lx: Ignoring bogus Unmap event\n",
+                    ewin->client.win);
+            break;
+         }
+#endif
+       EwinEventUnmap(ewin);
+       break;
+     case MapNotify:
+       EwinEventMap(ewin);
+       break;
+     case ReparentNotify:
+       /* Check if window parent hasn't changed already (compress?) */
+       if (WinGetParent(ev->xreparent.window) != ev->xreparent.parent)
+          break;
+       if (ev->xreparent.parent != ewin->win_container)
+          EwinEventDestroy(ewin);
+       break;
+     case ConfigureNotify:
+       break;
+
      default:
        Eprintf("EwinHandleEventsContainer: type=%2d win=%#lx: %s\n",
                ev->type, ewin->client.win, EwinGetName(ewin));
@@ -1910,6 +1956,8 @@
      case VisibilityNotify:
        EwinEventVisibility(ewin, ev->xvisibility.state);
        break;
+
+#if 0                          /* FIXME - Remove? */
      case DestroyNotify:
        EwinEventDestroy(ewin);
        break;
@@ -1934,6 +1982,8 @@
        if (ev->xreparent.parent == VRoot.win)
           EwinEventDestroy(ewin);
        break;
+#endif
+
 #if 0
      case ConfigureRequest:
        if (ev->xconfigurerequest.window == ewin->client.win)
@@ -2060,6 +2110,9 @@
           MapUnmap(1);
        break;
 #endif
+     case ESIGNAL_DESK_RESIZE:
+       EwinsTouch();
+       break;
      }
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -3 -r1.110 -r1.111
--- pager.c     12 Jan 2005 23:10:21 -0000      1.110
+++ pager.c     31 Jan 2005 18:52:17 -0000      1.111
@@ -494,7 +494,7 @@
 }
 
 static void
-PagerEwinMoveResize(EWin * ewin, int resize)
+PagerEwinMoveResize(EWin * ewin, int resize __UNUSED__)
 {
    Pager              *p = ewin->data;
    int                 w, h;
@@ -553,9 +553,6 @@
    lst = EwinListGetForDesk(&num, p->desktop);
    for (i = 0; i < num; i++)
       PagerEwinUpdateMini(p, lst[i]);
-
-   return;
-   resize = 0;
 }
 
 static void
@@ -2251,6 +2248,9 @@
      case ESIGNAL_DESK_CHANGE:
        ForceUpdatePagersForDesktop((int)prm);
        break;
+     case ESIGNAL_DESK_RESIZE:
+       PagersReArea();
+       break;
      case ESIGNAL_EWIN_UNMAP:
        PagerEwinOutsideAreaUpdate((EWin *) prm);
        break;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/setup.c,v
retrieving revision 1.147
retrieving revision 1.148
diff -u -3 -r1.147 -r1.148
--- setup.c     25 Jan 2005 21:58:03 -0000      1.147
+++ setup.c     31 Jan 2005 18:52:18 -0000      1.148
@@ -117,6 +117,7 @@
 SetupX(const char *dstr)
 {
    char                buf[128];
+   long                mask;
 
    /* In case we are going to fork, set up the master pid */
    Mode.wm.master = 1;
@@ -287,12 +288,15 @@
 
    /* select all the root window events to start managing */
    Mode.wm.xselect = 1;
-   XSelectInput(disp, VRoot.win,
-               ButtonPressMask | ButtonReleaseMask | EnterWindowMask |
-               LeaveWindowMask | ButtonMotionMask | PropertyChangeMask |
-               SubstructureRedirectMask | KeyPressMask | KeyReleaseMask |
-               PointerMotionMask | ResizeRedirectMask |
-               SubstructureNotifyMask);
+   mask =
+      ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
+      ButtonMotionMask | PropertyChangeMask | SubstructureRedirectMask |
+      KeyPressMask | KeyReleaseMask | PointerMotionMask |
+      SubstructureNotifyMask;
+   if (Mode.wm.window)
+      mask |= StructureNotifyMask;
+   XSelectInput(disp, VRoot.win, mask);
+
    ecore_x_sync();
    Mode.wm.xselect = 0;
 
@@ -355,3 +359,34 @@
    ScreenInit();
    ZoomInit();
 }
+
+void
+RootResize(int root, int w, int h)
+{
+   if (EventDebug(EDBUG_TYPE_DESKS))
+      Eprintf("RootResize %d %dx%d\n", root, w, h);
+
+   if (root)
+     {
+#if 0
+       RRoot.w = DisplayWidth(disp, RRoot.scr);
+       RRoot.h = DisplayHeight(disp, RRoot.scr);
+
+       if (w != RRoot.w || h != RRoot.h)
+          Eprintf
+             ("RootResize (root): Screen size mismatch: root=%dx%d 
event=%dx%d\n",
+              RRoot.w, RRoot.h, w, h);
+#endif
+       RRoot.w = w;
+       RRoot.h = h;
+     }
+
+   if (w == VRoot.w && h == VRoot.h)
+      return;
+
+   EWindowSync(VRoot.win);
+   VRoot.w = w;
+   VRoot.h = h;
+
+   DesksResize(w, h);
+}




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to