Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
Tag: branch-exp
Makefile.am ecore-e16.h icccm.c
Log Message:
Stuff to become ecore_x_icccm.c(?).
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Makefile.am,v
retrieving revision 1.43.2.10
retrieving revision 1.43.2.11
diff -u -3 -r1.43.2.10 -r1.43.2.11
--- Makefile.am 25 Aug 2004 21:56:57 -0000 1.43.2.10
+++ Makefile.am 26 Aug 2004 22:06:38 -0000 1.43.2.11
@@ -16,6 +16,7 @@
enlightenment_SOURCES = \
E.h \
econfig.h \
+ ecore-e16.h \
emodule.h \
timestamp.h \
actions.c \
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Attic/ecore-e16.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -3 -r1.1.2.1 -r1.1.2.2
--- ecore-e16.h 25 Aug 2004 21:56:57 -0000 1.1.2.1
+++ ecore-e16.h 26 Aug 2004 22:06:38 -0000 1.1.2.2
@@ -7,6 +7,10 @@
#define Ecore_X_Drawable Drawable
#define Ecore_X_Window Window
#define Ecore_X_Pixmap Pixmap
+#define Ecore_X_Atom Atom
+#define Ecore_X_Time Time
+
+#define _ecore_x_disp disp
#define ecore_x_window_move(win, x, y) \
XMoveWindow(disp, win, x, y)
@@ -26,3 +30,20 @@
XFreeGC(disp, gc)
#endif
+
+extern Atom _ecore_x_atom_wm_state;
+extern Atom _ecore_x_atom_wm_protocols;
+extern Atom _ecore_x_atom_wm_delete_window;
+extern Atom _ecore_x_atom_wm_take_focus;
+
+#if 0
+extern Atom _ecore_x_atom_wm_save_yourself;
+#endif
+
+void ecore_x_icccm_window_state_set_iconic(Ecore_X_Window win);
+void ecore_x_icccm_window_state_set_normal(Ecore_X_Window win);
+void ecore_x_icccm_window_state_set_withdrawn(Ecore_X_Window
+ win);
+
+void ecore_x_icccm_send_delete_window(Ecore_X_Window win);
+void ecore_x_icccm_send_take_focus(Ecore_X_Window win);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v
retrieving revision 1.76.2.2
retrieving revision 1.76.2.3
diff -u -3 -r1.76.2.2 -r1.76.2.3
--- icccm.c 8 Aug 2004 00:02:18 -0000 1.76.2.2
+++ icccm.c 26 Aug 2004 22:06:38 -0000 1.76.2.3
@@ -24,14 +24,9 @@
#define FREE_AND_CLEAR(ptr) if (ptr) { Efree(ptr); ptr = NULL; }
-static Atom E_XA_WM_STATE = 0;
static Atom E_XA_WM_CHANGE_STATE = 0;
static Atom E_XA_WM_NAME = 0;
static Atom E_XA_WM_COLORMAP_WINDOWS = 0;
-static Atom E_XA_WM_DELETE_WINDOW = 0;
-static Atom E_XA_WM_PROTOCOLS = 0;
-static Atom E_XA_WM_SAVE_YOURSELF = 0;
-static Atom E_XA_WM_TAKE_FOCUS = 0;
static Atom E_XA_WM_NORMAL_HINTS = 0;
static Atom E_XA_WM_CLASS = 0;
static Atom E_XA_WM_COMMAND = 0;
@@ -42,17 +37,24 @@
static Atom E_XA_WM_CLIENT_LEADER = 0;
static Atom E_XA_WM_TRANSIENT_FOR = 0;
+Atom _ecore_x_atom_wm_state = 0;
+
+#ifndef USE_ECORE_X
+Atom _ecore_x_atom_wm_protocols = 0;
+Atom _ecore_x_atom_wm_delete_window = 0;
+Atom _ecore_x_atom_wm_take_focus = 0;
+
+#if 0
+Atom _ecore_x_atom_wm_save_yourself = 0;
+#endif
+#endif
+
void
ICCCM_Init(void)
{
- E_XA_WM_STATE = XInternAtom(disp, "WM_STATE", False);
E_XA_WM_CHANGE_STATE = XInternAtom(disp, "WM_CHANGE_STATE", False);
E_XA_WM_NAME = XInternAtom(disp, "WM_NAME", False);
E_XA_WM_COLORMAP_WINDOWS = XInternAtom(disp, "WM_COLORMAP_WINDOWS", False);
- E_XA_WM_DELETE_WINDOW = XInternAtom(disp, "WM_DELETE_WINDOW", False);
- E_XA_WM_PROTOCOLS = XInternAtom(disp, "WM_PROTOCOLS", False);
- E_XA_WM_SAVE_YOURSELF = XInternAtom(disp, "WM_SAVE_YOURSELF", False);
- E_XA_WM_TAKE_FOCUS = XInternAtom(disp, "WM_TAKE_FOCUS", False);
E_XA_WM_NORMAL_HINTS = XInternAtom(disp, "WM_NORMAL_HINTS", False);
E_XA_WM_CLASS = XInternAtom(disp, "WM_CLASS", False);
E_XA_WM_COMMAND = XInternAtom(disp, "WM_COMMAND", False);
@@ -62,28 +64,26 @@
E_XA_WM_HINTS = XInternAtom(disp, "WM_HINTS", False);
E_XA_WM_CLIENT_LEADER = XInternAtom(disp, "WM_CLIENT_LEADER", False);
E_XA_WM_TRANSIENT_FOR = XInternAtom(disp, "WM_TRANSIENT_FOR", False);
+#ifndef USE_ECORE_X
+ _ecore_x_atom_wm_state = XInternAtom(disp, "WM_STATE", False);
+
+ _ecore_x_atom_wm_protocols = XInternAtom(disp, "WM_PROTOCOLS", False);
+ _ecore_x_atom_wm_delete_window =
+ XInternAtom(disp, "WM_DELETE_WINDOW", False);
+ _ecore_x_atom_wm_take_focus = XInternAtom(disp, "WM_TAKE_FOCUS", False);
+#if 0
+ _ecore_x_atom_wm_save_yourself =
+ XInternAtom(disp, "WM_SAVE_YOURSELF", False);
+#endif
+#endif
if (Mode.wm.window)
{
- Atom wm_props[1] = { E_XA_WM_DELETE_WINDOW };
+ Atom wm_props[1] = { _ecore_x_atom_wm_delete_window };
XSetWMProtocols(disp, VRoot.win, wm_props, 1);
}
}
-static void
-ICCCM_ClientMessageSend(Window win, Atom atom, Time ts)
-{
- 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] = ts;
- XSendEvent(disp, win, False, 0, &ev);
-}
-
void
ICCCM_ProcessClientMessage(XClientMessageEvent * event)
{
@@ -102,10 +102,10 @@
EwinIconify(ewin);
}
}
- else if (event->message_type == E_XA_WM_PROTOCOLS)
+ else if (event->message_type == _ecore_x_atom_wm_protocols)
{
a = event->data.l[0];
- if (a == E_XA_WM_DELETE_WINDOW)
+ if (a == _ecore_x_atom_wm_delete_window)
SessionExit(NULL);
}
}
@@ -188,65 +188,55 @@
void
ICCCM_Delete(EWin * ewin)
{
- EDBUG(6, "ICCCM_Delete");
-
if (ewin->internal)
{
EUnmapWindow(disp, ewin->client.win);
- EDBUG_RETURN_;
+ return;
}
if (ewin->client.delete_window)
- ICCCM_ClientMessageSend(ewin->client.win, E_XA_WM_DELETE_WINDOW,
- CurrentTime);
+ ecore_x_icccm_send_delete_window(ewin->client.win);
else
- XKillClient(disp, (XID) ewin->client.win);
-
- EDBUG_RETURN_;
+ XKillClient(disp, ewin->client.win);
}
+#if 0 /* Deprecated */
void
ICCCM_Save(EWin * ewin)
{
- EDBUG(6, "ICCCM_Save");
-
if (ewin->internal)
- EDBUG_RETURN_;
-
- ICCCM_ClientMessageSend(ewin->client.win, E_XA_WM_SAVE_YOURSELF,
- CurrentTime);
+ return;
- EDBUG_RETURN_;
+ ecore_x_icccm_send_save_yourself(ewin->client.win);
}
+#endif
void
ICCCM_Iconify(EWin * ewin)
{
- unsigned long c[2] = { IconicState, 0 };
-
- EDBUG(6, "ICCCM_Iconify");
-
EUnmapWindow(disp, ewin->client.win);
- XChangeProperty(disp, ewin->client.win, E_XA_WM_STATE, E_XA_WM_STATE,
- 32, PropModeReplace, (unsigned char *)c, 2);
+ ecore_x_icccm_window_state_set_iconic(ewin->client.win);
AddItem(ewin, "ICON", ewin->client.win, LIST_TYPE_ICONIFIEDS);
-
- EDBUG_RETURN_;
}
void
ICCCM_DeIconify(EWin * ewin)
{
- unsigned long c[2] = { NormalState, 0 };
-
- EDBUG(6, "ICCCM_DeIconify");
-
EMapWindow(disp, ewin->client.win);
- XChangeProperty(disp, ewin->client.win, E_XA_WM_STATE, E_XA_WM_STATE,
- 32, PropModeReplace, (unsigned char *)c, 2);
+ ecore_x_icccm_window_state_set_normal(ewin->client.win);
RemoveItem("ICON", ewin->client.win, LIST_FINDBY_BOTH, LIST_TYPE_ICONIFIEDS);
+}
- EDBUG_RETURN_;
+void
+ICCCM_Withdraw(EWin * ewin)
+{
+ /* We have a choice of deleting the WM_STATE property
+ * or changing the value to Withdrawn. Since twm/fvwm does
+ * it that way, we change it to Withdrawn.
+ */
+ ecore_x_icccm_window_state_set_withdrawn(ewin->client.win);
+
+ XRemoveFromSaveSet(disp, ewin->client.win);
}
void
@@ -377,51 +367,27 @@
{
Window win = ewin->client.win;
- EDBUG(6, "ICCCM_AdoptStart");
-
if (!ewin->internal)
XAddToSaveSet(disp, win);
-
- EDBUG_RETURN_;
}
void
ICCCM_Adopt(EWin * ewin)
{
Window win = ewin->client.win;
- unsigned long c[2] = { 0, 0 };
-
- EDBUG(6, "ICCCM_Adopt");
if (!ewin->internal)
{
XSetWindowBorderWidth(disp, win, 0);
ewin->client.bw = 0;
}
- EReparentWindow(disp, win, ewin->win_container, 0, 0);
- c[0] = (ewin->client.start_iconified) ? IconicState : NormalState;
- XChangeProperty(disp, win, E_XA_WM_STATE, E_XA_WM_STATE, 32, PropModeReplace,
- (unsigned char *)c, 2);
-
- EDBUG_RETURN_;
-}
-
-void
-ICCCM_Withdraw(EWin * ewin)
-{
- unsigned long c[2] = { WithdrawnState, 0 };
-
- EDBUG(6, "ICCCM_Withdraw");
- /* We have a choice of deleting the WM_STATE property
- * or changing the value to Withdrawn. Since twm/fvwm does
- * it that way, we change it to Withdrawn.
- */
- XChangeProperty(disp, ewin->client.win, E_XA_WM_STATE, E_XA_WM_STATE,
- 32, PropModeReplace, (unsigned char *)c, 2);
- XRemoveFromSaveSet(disp, ewin->client.win);
+ EReparentWindow(disp, win, ewin->win_container, 0, 0);
- EDBUG_RETURN_;
+ if (ewin->client.start_iconified)
+ ecore_x_icccm_window_state_set_iconic(win);
+ else
+ ecore_x_icccm_window_state_set_normal(win);
}
void
@@ -501,8 +467,7 @@
if (ewin->client.take_focus)
{
- ICCCM_ClientMessageSend(ewin->client.win, E_XA_WM_TAKE_FOCUS,
- CurrentTime);
+ ecore_x_icccm_send_take_focus(ewin->client.win);
}
XSetInputFocus(disp, ewin->client.win, RevertToPointerRoot, CurrentTime);
@@ -916,7 +881,7 @@
XFree(hint);
}
- if (atom_change == 0 || atom_change == E_XA_WM_PROTOCOLS)
+ if (atom_change == 0 || atom_change == _ecore_x_atom_wm_protocols)
{
if (XGetWMProtocols(disp, ewin->client.win, &prop, &num))
{
@@ -924,9 +889,9 @@
ewin->client.delete_window = 0;
for (i = 0; i < num; i++)
{
- if (prop[i] == E_XA_WM_TAKE_FOCUS)
+ if (prop[i] == _ecore_x_atom_wm_take_focus)
ewin->client.take_focus = ewin->client.need_input = 1;
- else if (prop[i] == E_XA_WM_DELETE_WINDOW)
+ else if (prop[i] == _ecore_x_atom_wm_delete_window)
ewin->client.delete_window = 1;
}
XFree(prop);
@@ -1237,3 +1202,78 @@
EDBUG_RETURN_;
}
+
+/*
+ * To become ecore_x_icccm.c ?
+ */
+#ifdef USE_ECORE_X
+extern Display *_ecore_x_disp;
+#endif
+
+static void
+ecore_x_icccm_window_state_set(Ecore_X_Window win, unsigned int state)
+{
+ unsigned long c[2];
+
+ c[0] = state;
+ c[1] = 0;
+ XChangeProperty(_ecore_x_disp, win, _ecore_x_atom_wm_state,
+ _ecore_x_atom_wm_state, 32, PropModeReplace,
+ (unsigned char *)c, 2);
+}
+
+void
+ecore_x_icccm_window_state_set_iconic(Ecore_X_Window win)
+{
+ ecore_x_icccm_window_state_set(win, IconicState);
+}
+
+void
+ecore_x_icccm_window_state_set_normal(Ecore_X_Window win)
+{
+ ecore_x_icccm_window_state_set(win, NormalState);
+}
+
+void
+ecore_x_icccm_window_state_set_withdrawn(Ecore_X_Window win)
+{
+ ecore_x_icccm_window_state_set(win, WithdrawnState);
+}
+
+static void
+ecore_x_icccm_client_message_send(Ecore_X_Window win,
+ Ecore_X_Atom atom, Ecore_X_Time ts)
+{
+ XEvent ev;
+
+ ev.type = ClientMessage;
+ ev.xclient.window = win;
+ ev.xclient.message_type = _ecore_x_atom_wm_protocols;
+ ev.xclient.format = 32;
+ ev.xclient.data.l[0] = atom;
+ ev.xclient.data.l[1] = ts;
+ XSendEvent(_ecore_x_disp, win, False, 0, &ev);
+}
+
+void
+ecore_x_icccm_send_delete_window(Ecore_X_Window win)
+{
+ ecore_x_icccm_client_message_send(win, _ecore_x_atom_wm_delete_window,
+ CurrentTime);
+}
+
+void
+ecore_x_icccm_send_take_focus(Ecore_X_Window win)
+{
+ ecore_x_icccm_client_message_send(win, _ecore_x_atom_wm_take_focus,
+ CurrentTime);
+}
+
+#if 0
+void
+ecore_x_icccm_send_save_yourself(Ecore_X_Window win)
+{
+ ecore_x_icccm_client_message_send(win, _ecore_x_atom_wm_save_yourself,
+ CurrentTime);
+}
+#endif
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs