diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 762daea83..28294f43d 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -49,6 +49,8 @@ e_module.h \ e_module.c \ e_apps.h \ e_apps.c \ +e_atoms.h \ +e_atoms.c \ e_utils.h \ e_utils.c \ e_canvas.h \ diff --git a/src/bin/e.h b/src/bin/e.h index 196f9070f..6c9dbbdcd 100644 --- a/src/bin/e.h +++ b/src/bin/e.h @@ -61,6 +61,7 @@ #include "e_int_menus.h" #include "e_module.h" #include "e_apps.h" +#include "e_atoms.h" #include "e_utils.h" #include "e_canvas.h" #include "e_focus.h" diff --git a/src/bin/e_atoms.c b/src/bin/e_atoms.c new file mode 100644 index 000000000..fbdcf6490 --- /dev/null +++ b/src/bin/e_atoms.c @@ -0,0 +1,37 @@ +#include "e.h" + +/* atom globals */ +int _e_atom_wm_name = 0; +int _e_atom_wm_class = 0; +int _e_atom_wm_hints = 0; +int _e_atom_wm_size_hints = 0; +int _e_atom_wm_protocols = 0; +int _e_atom_wm_icon_name = 0; +int _e_atom_wm_client_machine = 0; +int _e_atom_motif_wm_hints = 0; +int _e_atom_netwm_pid = 0; +int _e_atom_netwm_desktop = 0; + +/* externally accessible functions */ +int +e_atoms_init(void) +{ + _e_atom_wm_name = ecore_x_atom_get("WM_NAME"); + _e_atom_wm_class = ecore_x_atom_get("WM_CLASS"); + _e_atom_wm_hints = ecore_x_atom_get("WM_HINTS"); + _e_atom_wm_size_hints = ecore_x_atom_get("WM_SIZE_HINTS"); + _e_atom_wm_protocols = ecore_x_atom_get("WM_PROTOCOLS"); + _e_atom_wm_icon_name = ecore_x_atom_get("WM_ICON_NAME"); + _e_atom_wm_client_machine = ecore_x_atom_get("WM_CLIENT_MACHINE"); + _e_atom_motif_wm_hints = ecore_x_atom_get("_MOTIF_WM_HINTS"); + _e_atom_netwm_pid = ecore_x_atom_get("_NET_WM_PID"); + _e_atom_netwm_desktop = ecore_x_atom_get("_NET_WM_DESKTOP"); + return 1; +} + +int +e_atoms_shutdown(void) +{ + /* Nothing really to do here yet, just present for consistency right now */ + return 1; +} diff --git a/src/bin/e_atoms.h b/src/bin/e_atoms.h new file mode 100644 index 000000000..d4b3bb79e --- /dev/null +++ b/src/bin/e_atoms.h @@ -0,0 +1,19 @@ +#ifndef E_ATOMS_H +#define E_ATOMS_H + +/* atom globals */ +extern int _e_atom_wm_name; +extern int _e_atom_wm_class; +extern int _e_atom_wm_hints; +extern int _e_atom_wm_size_hints; +extern int _e_atom_wm_protocols; +extern int _e_atom_wm_icon_name; +extern int _e_atom_wm_client_machine; +extern int _e_atom_motif_wm_hints; +extern int _e_atom_netwm_pid; +extern int _e_atom_netwm_desktop; + +EAPI int e_atoms_init(void); +EAPI int e_atoms_shutdown(void); + +#endif diff --git a/src/bin/e_border.c b/src/bin/e_border.c index 98916e0e1..f8f905041 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -640,24 +640,62 @@ _e_border_cb_window_property(void *data, int ev_type, void *ev) if (!bd) return 1; { char *name; - + name = XGetAtomName(ecore_x_display_get(), e->atom); printf("property for %0x [%s]\n", e->win, name); XFree(name); } - /* FIXME: only flag the property to fetch based on the atom of the change */ - bd->client.icccm.fetch.title = 1; - bd->client.icccm.fetch.name_class = 1; - bd->client.icccm.fetch.icon_name = 1; - bd->client.icccm.fetch.machine = 1; - bd->client.icccm.fetch.hints = 1; - bd->client.icccm.fetch.size_pos_hints = 1; - bd->client.icccm.fetch.protocol = 1; - bd->client.mwm.fetch.hints = 1; - bd->client.netwm.fetch.pid = 1; - bd->client.netwm.fetch.desktop = 1; + if (e->atom == _e_atom_wm_name) + { + bd->client.icccm.fetch.title = 1; + bd->changed = 1; + } + else if (e->atom == _e_atom_wm_class) + { + bd->client.icccm.fetch.name_class = 1; + bd->changed = 1; + } + else if (e->atom == _e_atom_wm_icon_name) + { + bd->client.icccm.fetch.icon_name = 1; + bd->changed = 1; + } + else if (e->atom == _e_atom_wm_client_machine) + { + bd->client.icccm.fetch.machine = 1; + bd->changed = 1; + } + else if (e->atom == _e_atom_wm_protocols) + { + bd->client.icccm.fetch.protocol = 1; + bd->changed = 1; + } + else if (e->atom == _e_atom_wm_hints) + { + bd->client.icccm.fetch.hints = 1; + bd->changed = 1; + } + else if (e->atom == _e_atom_wm_size_hints) + { + bd->client.icccm.fetch.size_pos_hints = 1; + bd->changed = 1; + } + else if (e->atom == _e_atom_wm_hints) + { + bd->client.mwm.fetch.hints = 1; + bd->changed = 1; + } + else if (e->atom == _e_atom_netwm_pid) + { + bd->client.netwm.fetch.pid = 1; + bd->changed = 1; + } + else if (e->atom == _e_atom_netwm_desktop) + { + bd->client.netwm.fetch.desktop = 1; + bd->changed = 1; + } // bd->client.border.changed = 1; - bd->changed = 1; return 1; } diff --git a/src/bin/e_main.c b/src/bin/e_main.c index 3eac9bddc..d6f39bfa1 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -181,6 +181,13 @@ main(int argc, char **argv) _e_main_shutdown(-1); } _e_main_shutdown_push(_e_main_screens_shutdown); + /* init global atoms */ + if (!e_atoms_init()) + { + e_error_message_show("Enlightenment cannot set up atoms system."); + _e_main_shutdown(-1); + } + _e_main_shutdown_push(e_atoms_shutdown); /* init border system */ if (!e_focus_init()) {