Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h icccm.c ipc.c 


Log Message:
Shuffle some ICCCM client message code around.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.303
retrieving revision 1.304
diff -u -3 -r1.303 -r1.304
--- E.h 4 Jul 2004 08:47:27 -0000       1.303
+++ E.h 13 Jul 2004 17:15:20 -0000      1.304
@@ -881,6 +881,8 @@
    Window              group;
    Window              client_leader;
    char                need_input;
+   char                take_focus;
+   char                delete_window;
    signed char         transient;
    Window              transient_for;
    char                is_group_leader;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -3 -r1.74 -r1.75
--- icccm.c     4 Jul 2004 08:47:28 -0000       1.74
+++ icccm.c     13 Jul 2004 17:15:20 -0000      1.75
@@ -70,6 +70,20 @@
      }
 }
 
+static void
+ICCCM_ClientMessageSend(Window win, Atom atom)
+{
+   XEvent              ev;
+
+   ev.type = ClientMessage;
+   ev.xclient.window = win;
+   ev.xclient.message_type = E_XA_WM_PROTOCOLS;
+   ev.xclient.format = 32;
+   ev.xclient.data.l[0] = atom;
+   ev.xclient.data.l[1] = CurrentTime;
+   XSendEvent(disp, win, False, 0, &ev);
+}
+
 void
 ICCCM_ProcessClientMessage(XClientMessageEvent * event)
 {
@@ -174,10 +188,6 @@
 void
 ICCCM_Delete(EWin * ewin)
 {
-   XClientMessageEvent ev;
-   Atom               *prop;
-   int                 num, i, del;
-
    EDBUG(6, "ICCCM_Delete");
 
    if (ewin->internal)
@@ -186,28 +196,10 @@
        EDBUG_RETURN_;
      }
 
-   del = 0;
-   if (XGetWMProtocols(disp, ewin->client.win, &prop, &num))
-     {
-       for (i = 0; i < num; i++)
-          if (prop[i] == E_XA_WM_DELETE_WINDOW)
-             del = 1;
-       XFree(prop);
-     }
-   if (del)
-     {
-       ev.type = ClientMessage;
-       ev.window = ewin->client.win;
-       ev.message_type = E_XA_WM_PROTOCOLS;
-       ev.format = 32;
-       ev.data.l[0] = E_XA_WM_DELETE_WINDOW;
-       ev.data.l[1] = CurrentTime;
-       XSendEvent(disp, ewin->client.win, False, 0, (XEvent *) & ev);
-     }
+   if (ewin->client.delete_window)
+      ICCCM_ClientMessageSend(ewin->client.win, E_XA_WM_DELETE_WINDOW);
    else
-     {
-       XKillClient(disp, (XID) ewin->client.win);
-     }
+      XKillClient(disp, (XID) ewin->client.win);
 
    EDBUG_RETURN_;
 }
@@ -215,20 +207,12 @@
 void
 ICCCM_Save(EWin * ewin)
 {
-   XClientMessageEvent ev;
-
    EDBUG(6, "ICCCM_Save");
 
    if (ewin->internal)
       EDBUG_RETURN_;
 
-   ev.type = ClientMessage;
-   ev.window = ewin->client.win;
-   ev.message_type = E_XA_WM_PROTOCOLS;
-   ev.format = 32;
-   ev.data.l[0] = E_XA_WM_SAVE_YOURSELF;
-   ev.data.l[1] = CurrentTime;
-   XSendEvent(disp, ewin->client.win, False, 0, (XEvent *) & ev);
+   ICCCM_ClientMessageSend(ewin->client.win, E_XA_WM_SAVE_YOURSELF);
 
    EDBUG_RETURN_;
 }
@@ -495,10 +479,6 @@
 void
 ICCCM_Focus(EWin * ewin)
 {
-   XClientMessageEvent ev;
-   Atom               *prop;
-   int                 num, i, foc;
-
    EDBUG(6, "ICCCM_Focus");
 
    if (!ewin)
@@ -508,25 +488,8 @@
        EDBUG_RETURN_;
      }
 
-   foc = 0;
-   if (XGetWMProtocols(disp, ewin->client.win, &prop, &num))
-     {
-       for (i = 0; i < num; i++)
-          if (prop[i] == E_XA_WM_TAKE_FOCUS)
-             foc = 1;
-       XFree(prop);
-     }
-   if (foc)
-     {
-       ev.type = ClientMessage;
-       ev.window = ewin->client.win;
-       ev.message_type = E_XA_WM_PROTOCOLS;
-       ev.format = 32;
-       ev.data.l[0] = E_XA_WM_TAKE_FOCUS;
-       ev.data.l[1] = CurrentTime;
-       XSendEvent(disp, ewin->client.win, False, 0, (XEvent *) & ev);
-     }
-/*   else */
+   if (ewin->client.take_focus)
+      ICCCM_ClientMessageSend(ewin->client.win, E_XA_WM_TAKE_FOCUS);
    XSetInputFocus(disp, ewin->client.win, RevertToPointerRoot, CurrentTime);
    HintsSetActiveWindow(ewin->client.win);
 
@@ -936,9 +899,15 @@
      {
        if (XGetWMProtocols(disp, ewin->client.win, &prop, &num))
          {
+            ewin->client.take_focus = 0;
+            ewin->client.delete_window = 0;
             for (i = 0; i < num; i++)
-               if (prop[i] == E_XA_WM_TAKE_FOCUS)
-                  ewin->client.need_input = 1;
+              {
+                 if (prop[i] == E_XA_WM_TAKE_FOCUS)
+                    ewin->client.take_focus = ewin->client.need_input = 1;
+                 else if (prop[i] == E_XA_WM_DELETE_WINDOW)
+                    ewin->client.delete_window = 1;
+              }
             XFree(prop);
          }
      }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -3 -r1.167 -r1.168
--- ipc.c       4 Jul 2004 08:47:28 -0000       1.167
+++ ipc.c       13 Jul 2004 17:15:20 -0000      1.168
@@ -5752,7 +5752,7 @@
             "Base, min, max, inc w/h %ix%i, %ix%i, %ix%i %ix%i\n"
             "Aspect min, max         %5.5f, %5.5f\n"
             "MWM border %i resizeh %i title %i menu %i minimize %i maximize %i\n"
-            "NeedsInput   %i   FocusNever   %i   FocusClick   %i\n"
+            "NeedsInput   %i   TakeFocus    %i   FocusNever   %i   FocusClick   %i\n"
             "NeverUseArea %i   FixedPos     %i\n"
             "Desktop      %i   Layer        %i\n"
             "Iconified    %i   Sticky       %i   Shaded       %i   Docked       %i\n"
@@ -5786,7 +5786,8 @@
             ewin->client.mwm_decor_border, ewin->client.mwm_decor_resizeh,
             ewin->client.mwm_decor_title, ewin->client.mwm_decor_menu,
             ewin->client.mwm_decor_minimize, ewin->client.mwm_decor_maximize,
-            ewin->client.need_input, ewin->neverfocus, ewin->focusclick,
+            ewin->client.need_input, ewin->client.take_focus,
+            ewin->neverfocus, ewin->focusclick,
             ewin->never_use_area, ewin->fixedpos,
             ewin->desktop, ewin->layer,
             ewin->iconified, ewin->sticky, ewin->shaded, ewin->docked,




-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to