Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_x
Modified Files:
Ecore_X.h ecore_x.c ecore_x_private.h ecore_x_window_prop.c
Log Message:
Added setup for more netwm atoms, also API for working with the current desktop.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/Ecore_X.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- Ecore_X.h 13 Oct 2003 17:36:09 -0000 1.12
+++ Ecore_X.h 14 Oct 2003 19:11:35 -0000 1.13
@@ -536,6 +536,7 @@
void ecore_x_window_defaults_set(Ecore_X_Window win);
void ecore_x_window_prop_property_set(Ecore_X_Window win, Ecore_X_Atom
type, Ecore_X_Atom format, int size, void *data, int number);
+void ecore_x_window_prop_property_notify(Ecore_X_Window win, const char
*type, long *data);
void ecore_x_window_prop_string_set(Ecore_X_Window win, Ecore_X_Atom
type, char *str);
char *ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom
type);
void ecore_x_window_prop_title_set(Ecore_X_Window win, const char *t);
@@ -561,6 +562,9 @@
void ecore_x_window_prop_borderless_set(Ecore_X_Window win, int
borderless);
int ecore_x_window_prop_layer_set(Ecore_X_Window win, int layer);
void ecore_x_window_prop_withdrawn_set(Ecore_X_Window win, int withdrawn);
+void ecore_x_window_prop_desktop_request(Ecore_X_Window win, long
desktop);
+void ecore_x_window_prop_desktop_set(Ecore_X_Window win, long desktop);
+long ecore_x_window_prop_desktop_get(Ecore_X_Window win);
void ecore_x_window_shape_mask_set(Ecore_X_Window win, Ecore_X_Pixmap
mask);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- ecore_x.c 13 Oct 2003 17:36:09 -0000 1.14
+++ ecore_x.c 14 Oct 2003 19:11:35 -0000 1.15
@@ -24,6 +24,9 @@
int _ecore_x_event_last_root_x = 0;
int _ecore_x_event_last_root_y = 0;
+/*
+ * ICCCM and Motif hints.
+ */
Atom _ecore_x_atom_wm_delete_window = 0;
Atom _ecore_x_atom_wm_take_focus = 0;
Atom _ecore_x_atom_wm_protocols = 0;
@@ -33,17 +36,34 @@
Atom _ecore_x_atom_wm_client_machine = 0;
Atom _ecore_x_atom_motif_wm_hints = 0;
Atom _ecore_x_atom_win_layer = 0;
-Atom _ecore_x_atom_net_wm_desktop = 0;
+
+/*
+ * Root window NetWM hints.
+ */
+Atom _ecore_x_atom_net_supported = 0;
+Atom _ecore_x_atom_net_client_list = 0;
+Atom _ecore_x_atom_net_number_of_desktops = 0;
+Atom _ecore_x_atom_net_desktop_geometry = 0;
+Atom _ecore_x_atom_net_desktop_viewport = 0;
Atom _ecore_x_atom_net_current_desktop = 0;
+Atom _ecore_x_atom_net_desktop_names = 0;
+Atom _ecore_x_atom_net_active_window = 0;
+Atom _ecore_x_atom_net_workarea = 0;
+Atom _ecore_x_atom_net_supporting_wm_check = 0;
+Atom _ecore_x_atom_net_virtual_roots = 0;
+Atom _ecore_x_atom_net_desktop_layout = 0;
+Atom _ecore_x_atom_net_showing_desktop = 0;
+/*
+ * Application window specific NetWM hints.
+ */
+Atom _ecore_x_atom_net_wm_desktop = 0;
Atom _ecore_x_atom_net_wm_name = 0;
Atom _ecore_x_atom_net_wm_visible_name = 0;
Atom _ecore_x_atom_net_wm_icon_name = 0;
Atom _ecore_x_atom_net_wm_visible_icon_name = 0;
Atom _ecore_x_atom_net_wm_window_type = 0;
Atom _ecore_x_atom_net_wm_state = 0;
-Atom _ecore_x_atom_net_wm_state_above = 0;
-Atom _ecore_x_atom_net_wm_state_below = 0;
Atom _ecore_x_atom_net_wm_allowed_actions = 0;
Atom _ecore_x_atom_net_wm_strut = 0;
Atom _ecore_x_atom_net_wm_strut_partial = 0;
@@ -53,6 +73,27 @@
Atom _ecore_x_atom_net_wm_handle_icons = 0;
Atom _ecore_x_atom_net_wm_user_time = 0;
+Atom _ecore_x_atom_net_wm_window_type_desktop = 0;
+Atom _ecore_x_atom_net_wm_window_type_dock = 0;
+Atom _ecore_x_atom_net_wm_window_type_toolbar = 0;
+Atom _ecore_x_atom_net_wm_window_type_menu = 0;
+Atom _ecore_x_atom_net_wm_window_type_utility = 0;
+Atom _ecore_x_atom_net_wm_window_type_splash = 0;
+Atom _ecore_x_atom_net_wm_window_type_dialog = 0;
+Atom _ecore_x_atom_net_wm_window_type_normal = 0;
+
+Atom _ecore_x_atom_net_wm_state_modal = 0;
+Atom _ecore_x_atom_net_wm_state_sticky = 0;
+Atom _ecore_x_atom_net_wm_state_maximized_vert = 0;
+Atom _ecore_x_atom_net_wm_state_maximized_horz = 0;
+Atom _ecore_x_atom_net_wm_state_shaded = 0;
+Atom _ecore_x_atom_net_wm_state_skip_taskbar = 0;
+Atom _ecore_x_atom_net_wm_state_skip_pager = 0;
+Atom _ecore_x_atom_net_wm_state_hidden = 0;
+Atom _ecore_x_atom_net_wm_state_fullscreen = 0;
+Atom _ecore_x_atom_net_wm_state_above = 0;
+Atom _ecore_x_atom_net_wm_state_below = 0;
+
Atom _ecore_x_atom_utf8_string = 0;
Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM] = {0};
@@ -267,8 +308,6 @@
_ecore_x_atom_net_wm_desktop = XInternAtom(_ecore_x_disp,
"_NET_WM_DESKTOP", False);
_ecore_x_atom_net_wm_window_type = XInternAtom(_ecore_x_disp,
"_NET_WM_WINDOW_TYPE", False);
_ecore_x_atom_net_wm_state = XInternAtom(_ecore_x_disp,
"_NET_WM_STATE", False);
- _ecore_x_atom_net_wm_state_above = XInternAtom(_ecore_x_disp,
"_NET_WM_STATE_ABOVE", False);
- _ecore_x_atom_net_wm_state_below = XInternAtom(_ecore_x_disp,
"_NET_WM_STATE_BELOW", False);
_ecore_x_atom_net_wm_allowed_actions = XInternAtom(_ecore_x_disp,
"_NET_WM_ALLOWED_ACTIONS", False);
_ecore_x_atom_net_wm_strut = XInternAtom(_ecore_x_disp,
"_NET_WM_STRUT", False);
_ecore_x_atom_net_wm_strut_partial = XInternAtom(_ecore_x_disp,
"_NET_WM_STRUT_PARTIAL", False);
@@ -277,7 +316,28 @@
_ecore_x_atom_net_wm_pid = XInternAtom(_ecore_x_disp, "_NET_WM_PID",
False);
_ecore_x_atom_net_wm_user_time = XInternAtom(_ecore_x_disp,
"_NET_WM_USER_TIME", False);
- _ecore_x_atom_utf8_string = XInternAtom(_ecore_x_disp, "UTF8_STRING",
False);
+ _ecore_x_atom_net_wm_window_type_desktop = XInternAtom(_ecore_x_disp,
"_NET_WM_WINDOW_TYPE_DESKTOP", False);
+ _ecore_x_atom_net_wm_window_type_dock = XInternAtom(_ecore_x_disp,
"_NET_WM_WINDOW_TYPE_DOCK", False);
+ _ecore_x_atom_net_wm_window_type_toolbar = XInternAtom(_ecore_x_disp,
"_NET_WM_WINDOW_TYPE_TOOLBAR", False);
+ _ecore_x_atom_net_wm_window_type_menu = XInternAtom(_ecore_x_disp,
"_NET_WM_WINDOW_TYPE_MENU", False);
+ _ecore_x_atom_net_wm_window_type_utility = XInternAtom(_ecore_x_disp,
"_NET_WM_WINDOW_TYPE_UTILITY", False);
+ _ecore_x_atom_net_wm_window_type_splash = XInternAtom(_ecore_x_disp,
"_NET_WM_WINDOW_TYPE_SPLASH", False);
+ _ecore_x_atom_net_wm_window_type_dialog = XInternAtom(_ecore_x_disp,
"_NET_WM_WINDOW_TYPE_DIALOG", False);
+ _ecore_x_atom_net_wm_window_type_normal = XInternAtom(_ecore_x_disp,
"_NET_WM_WINDOW_TYPE_NORMAL", False);
+
+ _ecore_x_atom_net_wm_state_modal = XInternAtom(_ecore_x_disp,
"_NET_WM_STATE_MODAL", False);
+ _ecore_x_atom_net_wm_state_sticky = XInternAtom(_ecore_x_disp,
"_NET_WM_STATE_STICKY", False);
+ _ecore_x_atom_net_wm_state_maximized_vert = XInternAtom(_ecore_x_disp,
"_NET_WM_STATE_MAXIMIZED_VERT", False);
+ _ecore_x_atom_net_wm_state_maximized_horz = XInternAtom(_ecore_x_disp,
"_NET_WM_STATE_MAXIMIZED_HORZ", False);
+ _ecore_x_atom_net_wm_state_shaded = XInternAtom(_ecore_x_disp,
"_NET_WM_STATE_SHADED", False);
+ _ecore_x_atom_net_wm_state_skip_taskbar = XInternAtom(_ecore_x_disp,
"_NET_WM_STATE_SKIP_TASKBAR", False);
+ _ecore_x_atom_net_wm_state_skip_pager = XInternAtom(_ecore_x_disp,
"_NET_WM_STATE_SKIP_PAGER", False);
+ _ecore_x_atom_net_wm_state_hidden = XInternAtom(_ecore_x_disp,
"_NET_WM_STATE_HIDDEN", False);
+ _ecore_x_atom_net_wm_state_fullscreen = XInternAtom(_ecore_x_disp,
"_NET_WM_FULLSCREEN", False);
+ _ecore_x_atom_net_wm_state_above = XInternAtom(_ecore_x_disp,
"_NET_WM_STATE_ABOVE", False);
+ _ecore_x_atom_net_wm_state_below = XInternAtom(_ecore_x_disp,
"_NET_WM_STATE_BELOW", False);
+
+ _ecore_x_atom_utf8_string = XInternAtom(_ecore_x_disp, "UTF8_STRING", False);
_ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_DELETE_REQUEST] =
_ecore_x_atom_wm_delete_window;
_ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_TAKE_FOCUS] =
_ecore_x_atom_wm_take_focus;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_private.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ecore_x_private.h 12 Oct 2003 17:55:28 -0000 1.9
+++ ecore_x_private.h 14 Oct 2003 19:11:35 -0000 1.10
@@ -87,6 +87,27 @@
extern Atom _ecore_x_atom_net_wm_handle_icons;
extern Atom _ecore_x_atom_net_wm_user_time;
+extern Atom _ecore_x_atom_net_wm_window_type_desktop;
+extern Atom _ecore_x_atom_net_wm_window_type_dock;
+extern Atom _ecore_x_atom_net_wm_window_type_toolbar;
+extern Atom _ecore_x_atom_net_wm_window_type_menu;
+extern Atom _ecore_x_atom_net_wm_window_type_utility;
+extern Atom _ecore_x_atom_net_wm_window_type_splash;
+extern Atom _ecore_x_atom_net_wm_window_type_dialog;
+extern Atom _ecore_x_atom_net_wm_window_type_normal;
+
+extern Atom _ecore_x_atom_net_wm_state_modal;
+extern Atom _ecore_x_atom_net_wm_state_sticky;
+extern Atom _ecore_x_atom_net_wm_state_maximized_vert;
+extern Atom _ecore_x_atom_net_wm_state_maximized_horz;
+extern Atom _ecore_x_atom_net_wm_state_shaded;
+extern Atom _ecore_x_atom_net_wm_state_skip_taskbar;
+extern Atom _ecore_x_atom_net_wm_state_skip_pager;
+extern Atom _ecore_x_atom_net_wm_state_hidden;
+extern Atom _ecore_x_atom_net_wm_state_fullscreen;
+extern Atom _ecore_x_atom_net_wm_state_above;
+extern Atom _ecore_x_atom_net_wm_state_below;
+
extern Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
extern Atom _ecore_x_atom_utf8_string;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_x/ecore_x_window_prop.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- ecore_x_window_prop.c 13 Oct 2003 17:36:09 -0000 1.13
+++ ecore_x_window_prop.c 14 Oct 2003 19:11:35 -0000 1.14
@@ -85,6 +85,39 @@
}
/**
+ * Send a property notify to a window.
+ * @param win The window
+ * @param type Type of notification
+ * @param data The data
+ *
+ * Send a property notify to a window.
+ * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+ */
+void
+ecore_x_window_prop_property_notify(Ecore_X_Window win, const char *type, long *data)
+{
+ Ecore_X_Atom tmp;
+ XClientMessageEvent xev;
+
+ tmp = XInternAtom(_ecore_x_disp, type, False);
+
+ xev.type = PropertyNotify;
+ xev.display = _ecore_x_disp;
+ xev.window = win;
+ xev.message_type = tmp;
+ xev.format = 32;
+ xev.data.l[0] = data[0];
+ xev.data.l[1] = data[1];
+ xev.data.l[2] = data[2];
+ xev.data.l[3] = data[3];
+ xev.data.l[4] = data[4];
+
+ XSendEvent(_ecore_x_disp, DefaultRootWindow(_ecore_x_disp), False,
+ (SubstructureNotifyMask | SubstructureRedirectMask),
+ (XEvent *)&xev);
+}
+
+/**
* Set a window string property.
* @param win The window
* @param type The property
@@ -304,14 +337,17 @@
pid_t
ecore_x_window_prop_pid_get(Ecore_X_Window win)
{
- int num = 0;
- long *tmp;
- pid_t pid = 0;
+ int num = 0;
+ pid_t pid = 0;
+ unsigned char *tmp = NULL;
ecore_x_window_prop_property_get(win, _ecore_x_atom_net_wm_pid, XA_CARDINAL,
32, &tmp, &num);
- if (num && tmp) pid = (pid_t)(*tmp);
- free(tmp);
+ if ((num) && (tmp))
+ {
+ pid = (pid_t)(*tmp);
+ free(tmp);
+ }
return pid;
}
@@ -636,36 +672,43 @@
unsigned char *data = NULL;
int i, val = 4, num = 0; /* normal layer */
- if (layer < 0) { /* below */
+ if (layer < 0) /* below */
+ {
atom = _ecore_x_atom_net_wm_state_below;
val = 2;
- } else if (layer > 0) { /* above */
+ }
+ else if (layer > 0) /* above */
+ {
atom = _ecore_x_atom_net_wm_state_above;
val = 6;
- }
+ }
/* set the NetWM atoms
* get the atoms that are already set
*/
if (ecore_x_window_prop_property_get(win, _ecore_x_atom_net_wm_state,
- XA_ATOM, 32, &data, &num)) {
+ XA_ATOM, 32, &data, &num))
+ {
/* and set the ones we're interested in */
- for (i = 0; i < num; i++)
- if (data[i] == _ecore_x_atom_net_wm_state_below)
- data[i] = (layer < 0);
- else if (data[i] == _ecore_x_atom_net_wm_state_above)
- data[i] = (layer > 0);
-
- ecore_x_window_prop_property_set(win, _ecore_x_atom_net_wm_state,
- XA_ATOM, 32, data, num);
- free(data);
- } else
+ for (i = 0; i < num; i++)
+ {
+ if (data[i] == _ecore_x_atom_net_wm_state_below)
+ data[i] = (layer < 0);
+ else if (data[i] == _ecore_x_atom_net_wm_state_above)
+ data[i] = (layer > 0);
+ }
+
+ ecore_x_window_prop_property_set(win, _ecore_x_atom_net_wm_state,
+ XA_ATOM, 32, data, num);
+ free(data);
+ }
+ else
ecore_x_window_prop_property_set(win, _ecore_x_atom_net_wm_state,
XA_ATOM, 32, &atom, 1);
/* set the gnome atom */
- ecore_x_window_prop_property_set(win, _ecore_x_atom_win_layer,
- XA_CARDINAL, 32, &val, 1);
+ ecore_x_window_prop_property_set(win, _ecore_x_atom_win_layer,
+ XA_CARDINAL, 32, &val, 1);
return 1;
}
@@ -696,3 +739,63 @@
XSetWMNormalHints(_ecore_x_disp, win, (XSizeHints *) &hints);
}
+/**
+ * Request the window manager to change this windows desktop.
+ * @param win The Window
+ * @param desktop The desktop number.
+ *
+ * Request the window manager to change this windows desktop.
+ * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+ */
+void
+ecore_x_window_prop_desktop_request(Ecore_X_Window win, long desktop)
+{
+ long data[5];
+
+ data[0] = desktop;
+ data[1] = 0;
+ data[2] = 0;
+ data[3] = 0;
+ data[4] = 0;
+ ecore_x_window_prop_property_notify(win, "_NET_WM_DESKTOP", data);
+}
+
+/**
+ * Used by the window manager, or client prior mapping, to set window desktop.
+ * @param win The Window
+ * @param desktop The desktop number.
+ *
+ * Used by the window manager, or client prior mapping, to set window desktop.
+ * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+ */
+void
+ecore_x_window_prop_desktop_set(Ecore_X_Window win, long desktop)
+{
+ ecore_x_window_prop_property_set(win, _ecore_x_atom_net_wm_desktop,
+ XA_CARDINAL, 32, &desktop, 1);
+}
+
+/**
+ * Get the current desktop of a window
+ * @param win The Window
+ *
+ * Get the current desktop of a window
+ * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+ */
+long
+ecore_x_window_prop_desktop_get(Ecore_X_Window win)
+{
+ int num;
+ unsigned char *tmp;
+ long desktop = -1;
+
+ ecore_x_window_prop_property_get(win, _ecore_x_atom_net_wm_desktop,
+ XA_CARDINAL, 32, &tmp, &num);
+ if ((tmp) && (num))
+ {
+ desktop = *(long *)tmp;
+ free(tmp);
+ }
+
+ return desktop;
+}
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs