Make ecore_x atoms public.

SVN revision: 12352
This commit is contained in:
Kim Woelders 2004-12-04 10:10:29 +00:00
parent 23f1dc55f4
commit 1611c78704
14 changed files with 883 additions and 837 deletions

View File

@ -10,3 +10,4 @@ Nicholas Curran <quasar@bigblue.net.au>
Howell Tam <pigeon@pigeond.net> Howell Tam <pigeon@pigeond.net>
Nathan Ingersoll <rbdpngn@users.sourceforge.net> Nathan Ingersoll <rbdpngn@users.sourceforge.net>
Andrew Elcock <andy@elcock.org> Andrew Elcock <andy@elcock.org>
Kim Woelders <kim@woelders.dk>

View File

@ -639,7 +639,6 @@ extern EAPI int ECORE_X_LOCK_SCROLL;
extern EAPI int ECORE_X_LOCK_NUM; extern EAPI int ECORE_X_LOCK_NUM;
extern EAPI int ECORE_X_LOCK_CAPS; extern EAPI int ECORE_X_LOCK_CAPS;
#ifndef _ECORE_X_PRIVATE_H
typedef enum _Ecore_X_WM_Protocol { typedef enum _Ecore_X_WM_Protocol {
/** /**
* If enabled the window manager will be asked to send a * If enabled the window manager will be asked to send a
@ -651,9 +650,11 @@ typedef enum _Ecore_X_WM_Protocol {
* If enabled the window manager will be told that the window * If enabled the window manager will be told that the window
* explicitly sets input focus. * explicitly sets input focus.
*/ */
ECORE_X_WM_PROTOCOL_TAKE_FOCUS ECORE_X_WM_PROTOCOL_TAKE_FOCUS,
/* Number of defined items */
ECORE_X_WM_PROTOCOL_NUM
} Ecore_X_WM_Protocol; } Ecore_X_WM_Protocol;
#endif
typedef enum _Ecore_X_Window_Input_Mode { typedef enum _Ecore_X_Window_Input_Mode {
/** The window can never be focused */ /** The window can never be focused */

View File

@ -0,0 +1,129 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifndef _ECORE_X_ATOMS_H
#define _ECORE_X_ATOMS_H
#include "Ecore_X.h"
/**
* @file
* @brief Ecore X atoms
*/
/* General */
extern Ecore_X_Atom ECORE_X_ATOM_UTF8_STRING;
extern Ecore_X_Atom ECORE_X_ATOM_FILE_NAME;
extern Ecore_X_Atom ECORE_X_ATOM_STRING;
extern Ecore_X_Atom ECORE_X_ATOM_TEXT;
extern Ecore_X_Atom ECORE_X_ATOM_COMPOUND_TEXT;
/* ICCCM */
extern Ecore_X_Atom ECORE_X_ATOM_WM_STATE;
extern Ecore_X_Atom ECORE_X_ATOM_WM_DELETE_WINDOW;
extern Ecore_X_Atom ECORE_X_ATOM_WM_TAKE_FOCUS;
extern Ecore_X_Atom ECORE_X_ATOM_WM_PROTOCOLS;
extern Ecore_X_Atom ECORE_X_ATOM_WM_CLASS;
extern Ecore_X_Atom ECORE_X_ATOM_WM_NAME;
extern Ecore_X_Atom ECORE_X_ATOM_WM_COMMAND;
extern Ecore_X_Atom ECORE_X_ATOM_WM_ICON_NAME;
extern Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_MACHINE;
extern Ecore_X_Atom ECORE_X_ATOM_WM_CHANGE_STATE;
extern Ecore_X_Atom ECORE_X_ATOM_WM_COLORMAP_WINDOWS;
extern Ecore_X_Atom ECORE_X_ATOM_WM_WINDOW_ROLE;
extern Ecore_X_Atom ECORE_X_ATOM_WM_HINTS;
extern Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_LEADER;
extern Ecore_X_Atom ECORE_X_ATOM_WM_TRANSIENT_FOR;
extern Ecore_X_Atom ECORE_X_ATOM_WM_SAVE_YOURSELF;
/* MWM */
extern Ecore_X_Atom ECORE_X_ATOM_MOTIF_WM_HINTS;
/* GNOME */
extern Ecore_X_Atom ECORE_X_ATOM_WIN_LAYER;
/* EWMH */
extern Ecore_X_Atom ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS;
extern Ecore_X_Atom ECORE_X_ATOM_NET_VIRTUAL_ROOTS;
extern Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_NAMES;
extern Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_GEOMETRY;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WORKAREA;
extern Ecore_X_Atom ECORE_X_ATOM_NET_CURRENT_DESKTOP;
extern Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_VIEWPORT;
extern Ecore_X_Atom ECORE_X_ATOM_NET_SHOWING_DESKTOP;
extern Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST;
extern Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST_STACKING;
extern Ecore_X_Atom ECORE_X_ATOM_NET_ACTIVE_WINDOW;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_DESKTOP;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_ABOVE;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_BELOW;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_NAME;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_NAME;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_NAME;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_DESKTOP;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT_PARTIAL;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_GEOMETRY;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_PID;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_HANDLE_ICONS;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_USER_TIME;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_OPACITY;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MODAL;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_STICKY;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SHADED;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_HIDDEN;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_ABOVE;
extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_BELOW;
/* Selections */
extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_PRIMARY;
extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_SECONDARY;
extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_CLIPBOARD;
extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_PRIMARY;
extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_SECONDARY;
extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD;
/* DND */
extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_XDND;
extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_XDND;
extern Ecore_X_Atom ECORE_X_ATOM_XDND_AWARE;
extern Ecore_X_Atom ECORE_X_ATOM_XDND_ENTER;
extern Ecore_X_Atom ECORE_X_ATOM_XDND_TYPE_LIST;
extern Ecore_X_Atom ECORE_X_ATOM_XDND_POSITION;
extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_COPY;
extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_PRIVATE;
extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_ASK;
extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LIST;
extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_DESCRIPTION;
extern Ecore_X_Atom ECORE_X_ATOM_XDND_STATUS;
extern Ecore_X_Atom ECORE_X_ATOM_XDND_LEAVE;
extern Ecore_X_Atom ECORE_X_ATOM_XDND_DROP;
extern Ecore_X_Atom ECORE_X_ATOM_XDND_FINISHED;
#endif /* _ECORE_X_ATOMS_H */

View File

@ -19,6 +19,7 @@ if BUILD_ECORE_X
lib_LTLIBRARIES = libecore_x.la lib_LTLIBRARIES = libecore_x.la
include_HEADERS = \ include_HEADERS = \
Ecore_X.h \ Ecore_X.h \
Ecore_X_Atoms.h \
Ecore_X_Cursor.h Ecore_X_Cursor.h
libecore_x_la_SOURCES = \ libecore_x_la_SOURCES = \
@ -53,6 +54,7 @@ endif
EXTRA_DIST = \ EXTRA_DIST = \
Ecore_X.h \ Ecore_X.h \
Ecore_X_Atoms.h \
Ecore_X_Cursor.h \ Ecore_X_Cursor.h \
ecore_x.c \ ecore_x.c \
ecore_x_dnd.c \ ecore_x_dnd.c \

View File

@ -1,6 +1,7 @@
#include "Ecore.h" #include "Ecore.h"
#include "ecore_x_private.h" #include "ecore_x_private.h"
#include "Ecore_X.h" #include "Ecore_X.h"
#include "Ecore_X_Atoms.h"
static int _ecore_x_fd_handler(void *data, Ecore_Fd_Handler *fd_handler); static int _ecore_x_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
static int _ecore_x_fd_handler_buf(void *data, Ecore_Fd_Handler *fd_handler); static int _ecore_x_fd_handler_buf(void *data, Ecore_Fd_Handler *fd_handler);
@ -25,72 +26,48 @@ Window _ecore_x_event_last_win = 0;
int _ecore_x_event_last_root_x = 0; int _ecore_x_event_last_root_x = 0;
int _ecore_x_event_last_root_y = 0; int _ecore_x_event_last_root_y = 0;
/* /* FIXME - These are duplicates after making ecore atoms public */
* ICCCM hints. Ecore_X_Atom ECORE_X_ATOM_FILE_NAME = 0;
*/ Ecore_X_Atom ECORE_X_ATOM_STRING = 0;
Atom _ecore_x_atom_wm_state = 0; Ecore_X_Atom ECORE_X_ATOM_TEXT = 0;
Atom _ecore_x_atom_wm_delete_window = 0; Ecore_X_Atom ECORE_X_ATOM_UTF8_STRING = 0;
Atom _ecore_x_atom_wm_take_focus = 0; Ecore_X_Atom ECORE_X_ATOM_COMPOUND_TEXT = 0;
Atom _ecore_x_atom_wm_protocols = 0;
Atom _ecore_x_atom_wm_class = 0;
Atom _ecore_x_atom_wm_name = 0;
Atom _ecore_x_atom_wm_command = 0;
Atom _ecore_x_atom_wm_icon_name = 0;
Atom _ecore_x_atom_wm_client_machine = 0;
Atom _ecore_x_atom_wm_change_state = 0;
Atom _ecore_x_atom_wm_colormap_windows = 0;
Atom _ecore_x_atom_wm_window_role = 0;
Atom _ecore_x_atom_wm_hints = 0;
Atom _ecore_x_atom_wm_client_leader = 0;
Atom _ecore_x_atom_wm_transient_for = 0;
Atom _ecore_x_atom_wm_save_yourself = 0;
Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM]; Ecore_X_Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
/*
* Motif hints.
*/
Atom _ecore_x_atom_motif_wm_hints = 0;
/* /*
* GNOME hints. * GNOME hints.
*/ */
Atom _ecore_x_atom_win_layer = 0; Ecore_X_Atom ECORE_X_ATOM_WIN_LAYER = 0;
/* /*
* Other hints. * Other hints.
*/ */
Atom _ecore_x_atom_selection_primary = 0; Ecore_X_Atom ECORE_X_ATOM_SELECTION_PRIMARY = 0;
Atom _ecore_x_atom_selection_secondary = 0; Ecore_X_Atom ECORE_X_ATOM_SELECTION_SECONDARY = 0;
Atom _ecore_x_atom_selection_clipboard = 0; Ecore_X_Atom ECORE_X_ATOM_SELECTION_CLIPBOARD = 0;
Atom _ecore_x_atom_selection_prop_primary = 0; Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_PRIMARY = 0;
Atom _ecore_x_atom_selection_prop_secondary = 0; Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_SECONDARY = 0;
Atom _ecore_x_atom_selection_prop_clipboard = 0; Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD = 0;
Atom _ecore_x_atom_selection_xdnd = 0; Ecore_X_Atom ECORE_X_ATOM_SELECTION_XDND = 0;
Atom _ecore_x_atom_selection_prop_xdnd = 0; Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_XDND = 0;
Atom _ecore_x_atom_xdnd_aware = 0; Ecore_X_Atom ECORE_X_ATOM_XDND_AWARE = 0;
Atom _ecore_x_atom_xdnd_enter = 0; Ecore_X_Atom ECORE_X_ATOM_XDND_ENTER = 0;
Atom _ecore_x_atom_xdnd_type_list = 0; Ecore_X_Atom ECORE_X_ATOM_XDND_TYPE_LIST = 0;
Atom _ecore_x_atom_xdnd_position = 0; Ecore_X_Atom ECORE_X_ATOM_XDND_POSITION = 0;
Atom _ecore_x_atom_xdnd_action_copy = 0; Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_COPY = 0;
Atom _ecore_x_atom_xdnd_action_move = 0; Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_MOVE = 0;
Atom _ecore_x_atom_xdnd_action_link = 0; Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LINK = 0;
Atom _ecore_x_atom_xdnd_action_private = 0; Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_PRIVATE = 0;
Atom _ecore_x_atom_xdnd_action_ask = 0; Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_ASK = 0;
Atom _ecore_x_atom_xdnd_action_list = 0; Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LIST = 0;
Atom _ecore_x_atom_xdnd_action_description = 0; Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_DESCRIPTION = 0;
Atom _ecore_x_atom_xdnd_proxy = 0; Ecore_X_Atom ECORE_X_ATOM_XDND_PROXY = 0;
Atom _ecore_x_atom_xdnd_status = 0; Ecore_X_Atom ECORE_X_ATOM_XDND_STATUS = 0;
Atom _ecore_x_atom_xdnd_drop = 0; Ecore_X_Atom ECORE_X_ATOM_XDND_DROP = 0;
Atom _ecore_x_atom_xdnd_finished = 0; Ecore_X_Atom ECORE_X_ATOM_XDND_FINISHED = 0;
Atom _ecore_x_atom_xdnd_leave = 0; Ecore_X_Atom ECORE_X_ATOM_XDND_LEAVE = 0;
Atom _ecore_x_atom_file_name = 0;
Atom _ecore_x_atom_string = 0;
Atom _ecore_x_atom_text = 0;
Atom _ecore_x_atom_utf8_string = 0;
Atom _ecore_x_atom_compound_text = 0;
/* Xdnd atoms that need to be exposed to the application interface */ /* Xdnd atoms that need to be exposed to the application interface */
Ecore_X_Atom ECORE_X_DND_ACTION_COPY = 0; Ecore_X_Atom ECORE_X_DND_ACTION_COPY = 0;
@ -316,71 +293,71 @@ ecore_x_init(const char *name)
} }
_ecore_x_filter_handler = ecore_event_filter_add(_ecore_x_event_filter_start, _ecore_x_event_filter_filter, _ecore_x_event_filter_end, NULL); _ecore_x_filter_handler = ecore_event_filter_add(_ecore_x_event_filter_start, _ecore_x_event_filter_filter, _ecore_x_event_filter_end, NULL);
_ecore_x_atom_compound_text = XInternAtom(_ecore_x_disp, "COMPOUND_TEXT", False); ECORE_X_ATOM_COMPOUND_TEXT = XInternAtom(_ecore_x_disp, "COMPOUND_TEXT", False);
_ecore_x_atom_utf8_string = XInternAtom(_ecore_x_disp, "UTF8_STRING", False); ECORE_X_ATOM_UTF8_STRING = XInternAtom(_ecore_x_disp, "UTF8_STRING", False);
_ecore_x_atom_file_name = XInternAtom(_ecore_x_disp, "FILE_NAME", False); ECORE_X_ATOM_FILE_NAME = XInternAtom(_ecore_x_disp, "FILE_NAME", False);
_ecore_x_atom_string = XInternAtom(_ecore_x_disp, "STRING", False); ECORE_X_ATOM_STRING = XInternAtom(_ecore_x_disp, "STRING", False);
_ecore_x_atom_text = XInternAtom(_ecore_x_disp, "TEXT", False); ECORE_X_ATOM_TEXT = XInternAtom(_ecore_x_disp, "TEXT", False);
_ecore_x_atom_wm_state = XInternAtom(_ecore_x_disp, "WM_STATE", False); ECORE_X_ATOM_WM_STATE = XInternAtom(_ecore_x_disp, "WM_STATE", False);
_ecore_x_atom_wm_delete_window = XInternAtom(_ecore_x_disp, "WM_DELETE_WINDOW", False); ECORE_X_ATOM_WM_DELETE_WINDOW = XInternAtom(_ecore_x_disp, "WM_DELETE_WINDOW", False);
_ecore_x_atom_wm_take_focus = XInternAtom(_ecore_x_disp, "WM_TAKE_FOCUS", False); ECORE_X_ATOM_WM_TAKE_FOCUS = XInternAtom(_ecore_x_disp, "WM_TAKE_FOCUS", False);
_ecore_x_atom_wm_protocols = XInternAtom(_ecore_x_disp, "WM_PROTOCOLS", False); ECORE_X_ATOM_WM_PROTOCOLS = XInternAtom(_ecore_x_disp, "WM_PROTOCOLS", False);
_ecore_x_atom_wm_class = XInternAtom(_ecore_x_disp, "WM_CLASS", False); ECORE_X_ATOM_WM_CLASS = XInternAtom(_ecore_x_disp, "WM_CLASS", False);
_ecore_x_atom_wm_name = XInternAtom(_ecore_x_disp, "WM_NAME", False); ECORE_X_ATOM_WM_NAME = XInternAtom(_ecore_x_disp, "WM_NAME", False);
_ecore_x_atom_wm_command = XInternAtom(_ecore_x_disp, "WM_COMMAND", False); ECORE_X_ATOM_WM_COMMAND = XInternAtom(_ecore_x_disp, "WM_COMMAND", False);
_ecore_x_atom_wm_icon_name = XInternAtom(_ecore_x_disp, "WM_ICON_NAME", False); ECORE_X_ATOM_WM_ICON_NAME = XInternAtom(_ecore_x_disp, "WM_ICON_NAME", False);
_ecore_x_atom_wm_client_machine = XInternAtom(_ecore_x_disp, "WM_CLIENT_MACHINE", False); ECORE_X_ATOM_WM_CLIENT_MACHINE = XInternAtom(_ecore_x_disp, "WM_CLIENT_MACHINE", False);
_ecore_x_atom_wm_change_state = XInternAtom(_ecore_x_disp, "WM_CHANGE_STATE", False); ECORE_X_ATOM_WM_CHANGE_STATE = XInternAtom(_ecore_x_disp, "WM_CHANGE_STATE", False);
_ecore_x_atom_wm_colormap_windows = XInternAtom(_ecore_x_disp, "WM_COLORMAP_WINDOWS", False); ECORE_X_ATOM_WM_COLORMAP_WINDOWS = XInternAtom(_ecore_x_disp, "WM_COLORMAP_WINDOWS", False);
_ecore_x_atom_wm_window_role = XInternAtom(_ecore_x_disp, "WM_WINDOW_ROLE", False); ECORE_X_ATOM_WM_WINDOW_ROLE = XInternAtom(_ecore_x_disp, "WM_WINDOW_ROLE", False);
_ecore_x_atom_wm_hints = XInternAtom(_ecore_x_disp, "WM_HINTS", False); ECORE_X_ATOM_WM_HINTS = XInternAtom(_ecore_x_disp, "WM_HINTS", False);
_ecore_x_atom_wm_client_leader = XInternAtom(_ecore_x_disp, "WM_CLIENT_LEADER", False); ECORE_X_ATOM_WM_CLIENT_LEADER = XInternAtom(_ecore_x_disp, "WM_CLIENT_LEADER", False);
_ecore_x_atom_wm_transient_for = XInternAtom(_ecore_x_disp, "WM_TRANSIENT_FOR", False); ECORE_X_ATOM_WM_TRANSIENT_FOR = XInternAtom(_ecore_x_disp, "WM_TRANSIENT_FOR", False);
_ecore_x_atom_wm_save_yourself = XInternAtom(_ecore_x_disp, "WM_SAVE_YOURSELF", False); ECORE_X_ATOM_WM_SAVE_YOURSELF = XInternAtom(_ecore_x_disp, "WM_SAVE_YOURSELF", False);
_ecore_x_atom_motif_wm_hints = XInternAtom(_ecore_x_disp, "_MOTIF_WM_HINTS", False); ECORE_X_ATOM_MOTIF_WM_HINTS = XInternAtom(_ecore_x_disp, "_MOTIF_WM_HINTS", False);
_ecore_x_atom_win_layer = XInternAtom(_ecore_x_disp, "_WIN_LAYER", False); ECORE_X_ATOM_WIN_LAYER = XInternAtom(_ecore_x_disp, "_WIN_LAYER", False);
/* Set up the _NET_... hints */ /* Set up the _NET_... hints */
ecore_x_netwm_init(); ecore_x_netwm_init();
/* This is just to be anal about naming conventions */ /* This is just to be anal about naming conventions */
_ecore_x_atom_selection_primary = XA_PRIMARY; ECORE_X_ATOM_SELECTION_PRIMARY = XA_PRIMARY;
_ecore_x_atom_selection_secondary = XA_SECONDARY; ECORE_X_ATOM_SELECTION_SECONDARY = XA_SECONDARY;
_ecore_x_atom_selection_clipboard = XInternAtom(_ecore_x_disp, "CLIPBOARD", False); ECORE_X_ATOM_SELECTION_CLIPBOARD = XInternAtom(_ecore_x_disp, "CLIPBOARD", False);
_ecore_x_atom_selection_prop_primary = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_PRIMARY", False); ECORE_X_ATOM_SELECTION_PROP_PRIMARY = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_PRIMARY", False);
_ecore_x_atom_selection_prop_secondary = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_SECONDARY", False); ECORE_X_ATOM_SELECTION_PROP_SECONDARY = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_SECONDARY", False);
_ecore_x_atom_selection_prop_clipboard = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_CLIPBOARD", False); ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_CLIPBOARD", False);
_ecore_x_atom_selection_prop_xdnd = XInternAtom(_ecore_x_disp, "JXSelectionWindowProperty", False); ECORE_X_ATOM_SELECTION_PROP_XDND = XInternAtom(_ecore_x_disp, "JXSelectionWindowProperty", False);
_ecore_x_atom_selection_xdnd = XInternAtom(_ecore_x_disp, "XdndSelection", False); ECORE_X_ATOM_SELECTION_XDND = XInternAtom(_ecore_x_disp, "XdndSelection", False);
_ecore_x_atom_xdnd_aware = XInternAtom(_ecore_x_disp, "XdndAware", False); ECORE_X_ATOM_XDND_AWARE = XInternAtom(_ecore_x_disp, "XdndAware", False);
_ecore_x_atom_xdnd_type_list = XInternAtom(_ecore_x_disp, "XdndTypeList", False); ECORE_X_ATOM_XDND_TYPE_LIST = XInternAtom(_ecore_x_disp, "XdndTypeList", False);
_ecore_x_atom_xdnd_enter = XInternAtom(_ecore_x_disp, "XdndEnter", False); ECORE_X_ATOM_XDND_ENTER = XInternAtom(_ecore_x_disp, "XdndEnter", False);
_ecore_x_atom_xdnd_position = XInternAtom(_ecore_x_disp, "XdndPosition", False); ECORE_X_ATOM_XDND_POSITION = XInternAtom(_ecore_x_disp, "XdndPosition", False);
_ecore_x_atom_xdnd_action_copy = XInternAtom(_ecore_x_disp, "XdndActionCopy", False); ECORE_X_ATOM_XDND_ACTION_COPY = XInternAtom(_ecore_x_disp, "XdndActionCopy", False);
_ecore_x_atom_xdnd_action_move = XInternAtom(_ecore_x_disp, "XdndActionMove", False); ECORE_X_ATOM_XDND_ACTION_MOVE = XInternAtom(_ecore_x_disp, "XdndActionMove", False);
_ecore_x_atom_xdnd_action_private = XInternAtom(_ecore_x_disp, "XdndActionPrivate", False); ECORE_X_ATOM_XDND_ACTION_PRIVATE = XInternAtom(_ecore_x_disp, "XdndActionPrivate", False);
_ecore_x_atom_xdnd_action_ask = XInternAtom(_ecore_x_disp, "XdndActionAsk", False); ECORE_X_ATOM_XDND_ACTION_ASK = XInternAtom(_ecore_x_disp, "XdndActionAsk", False);
_ecore_x_atom_xdnd_action_list = XInternAtom(_ecore_x_disp, "XdndActionList", False); ECORE_X_ATOM_XDND_ACTION_LIST = XInternAtom(_ecore_x_disp, "XdndActionList", False);
_ecore_x_atom_xdnd_action_link = XInternAtom(_ecore_x_disp, "XdndActionLink", False); ECORE_X_ATOM_XDND_ACTION_LINK = XInternAtom(_ecore_x_disp, "XdndActionLink", False);
_ecore_x_atom_xdnd_action_description = XInternAtom(_ecore_x_disp, "XdndActionDescription", False); ECORE_X_ATOM_XDND_ACTION_DESCRIPTION = XInternAtom(_ecore_x_disp, "XdndActionDescription", False);
_ecore_x_atom_xdnd_proxy = XInternAtom(_ecore_x_disp, "XdndProxy", False); ECORE_X_ATOM_XDND_PROXY = XInternAtom(_ecore_x_disp, "XdndProxy", False);
_ecore_x_atom_xdnd_status = XInternAtom(_ecore_x_disp, "XdndStatus", False); ECORE_X_ATOM_XDND_STATUS = XInternAtom(_ecore_x_disp, "XdndStatus", False);
_ecore_x_atom_xdnd_leave = XInternAtom(_ecore_x_disp, "XdndLeave", False); ECORE_X_ATOM_XDND_LEAVE = XInternAtom(_ecore_x_disp, "XdndLeave", False);
_ecore_x_atom_xdnd_drop = XInternAtom(_ecore_x_disp, "XdndDrop", False); ECORE_X_ATOM_XDND_DROP = XInternAtom(_ecore_x_disp, "XdndDrop", False);
_ecore_x_atom_xdnd_finished = XInternAtom(_ecore_x_disp, "XdndFinished", False); ECORE_X_ATOM_XDND_FINISHED = XInternAtom(_ecore_x_disp, "XdndFinished", False);
/* Initialize the globally defined xdnd atoms */ /* Initialize the globally defined xdnd atoms */
ECORE_X_DND_ACTION_COPY = _ecore_x_atom_xdnd_action_copy; ECORE_X_DND_ACTION_COPY = ECORE_X_ATOM_XDND_ACTION_COPY;
ECORE_X_DND_ACTION_MOVE = _ecore_x_atom_xdnd_action_move; ECORE_X_DND_ACTION_MOVE = ECORE_X_ATOM_XDND_ACTION_MOVE;
ECORE_X_DND_ACTION_LINK = _ecore_x_atom_xdnd_action_link; ECORE_X_DND_ACTION_LINK = ECORE_X_ATOM_XDND_ACTION_LINK;
ECORE_X_DND_ACTION_ASK = _ecore_x_atom_xdnd_action_ask; ECORE_X_DND_ACTION_ASK = ECORE_X_ATOM_XDND_ACTION_ASK;
ECORE_X_DND_ACTION_PRIVATE = _ecore_x_atom_xdnd_action_private; ECORE_X_DND_ACTION_PRIVATE = ECORE_X_ATOM_XDND_ACTION_PRIVATE;
_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_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; _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_TAKE_FOCUS] = ECORE_X_ATOM_WM_TAKE_FOCUS;
_ecore_x_selection_data_init(); _ecore_x_selection_data_init();
_ecore_x_dnd_init(); _ecore_x_dnd_init();
@ -1231,7 +1208,7 @@ ecore_x_window_button_ungrab(Ecore_X_Window win, int button,
unsigned int b; unsigned int b;
unsigned int m; unsigned int m;
unsigned int locks[8]; unsigned int locks[8];
int i, ev, shuffle = 0; int i, shuffle = 0;
b = button; b = button;
if (b == 0) b = AnyButton; if (b == 0) b = AnyButton;

View File

@ -1,6 +1,7 @@
#include "Ecore.h" #include "Ecore.h"
#include "ecore_x_private.h" #include "ecore_x_private.h"
#include "Ecore_X.h" #include "Ecore_X.h"
#include "Ecore_X_Atoms.h"
static Ecore_X_Selection_Data _xdnd_selection; static Ecore_X_Selection_Data _xdnd_selection;
static Ecore_X_DND_Protocol *_xdnd; static Ecore_X_DND_Protocol *_xdnd;
@ -22,10 +23,10 @@ ecore_x_dnd_aware_set (Ecore_X_Window win, int on)
Atom prop_data = ECORE_X_DND_VERSION; Atom prop_data = ECORE_X_DND_VERSION;
if (on) if (on)
ecore_x_window_prop_property_set(win, _ecore_x_atom_xdnd_aware, ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_AWARE,
XA_ATOM, 32, &prop_data, 1); XA_ATOM, 32, &prop_data, 1);
else else
ecore_x_window_prop_property_del(win, _ecore_x_atom_xdnd_aware); ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_AWARE);
/* TODO: Add dnd typelist to window properties */ /* TODO: Add dnd typelist to window properties */
} }
@ -35,7 +36,7 @@ ecore_x_dnd_version_get (Ecore_X_Window win)
unsigned char *prop_data; unsigned char *prop_data;
int num; int num;
if (ecore_x_window_prop_property_get(win, _ecore_x_atom_xdnd_aware, if (ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_AWARE,
XA_ATOM, 32, &prop_data, &num)) XA_ATOM, 32, &prop_data, &num))
{ {
int version = (int) *prop_data; int version = (int) *prop_data;
@ -62,14 +63,14 @@ ecore_x_dnd_begin (Ecore_X_Window source, unsigned char *data, int size)
return 0; return 0;
/* Take ownership of XdndSelection */ /* Take ownership of XdndSelection */
XSetSelectionOwner(_ecore_x_disp, _ecore_x_atom_selection_xdnd, source, XSetSelectionOwner(_ecore_x_disp, ECORE_X_ATOM_SELECTION_XDND, source,
_ecore_x_event_last_time); _ecore_x_event_last_time);
if (XGetSelectionOwner(_ecore_x_disp, _ecore_x_atom_selection_xdnd) != source) if (XGetSelectionOwner(_ecore_x_disp, ECORE_X_ATOM_SELECTION_XDND) != source)
return 0; return 0;
/* Initialize Selection Data Struct */ /* Initialize Selection Data Struct */
_xdnd_selection.win = source; _xdnd_selection.win = source;
_xdnd_selection.selection = _ecore_x_atom_selection_xdnd; _xdnd_selection.selection = ECORE_X_ATOM_SELECTION_XDND;
_xdnd_selection.length = size; _xdnd_selection.length = size;
_xdnd_selection.time = _ecore_x_event_last_time; _xdnd_selection.time = _ecore_x_event_last_time;
@ -82,7 +83,7 @@ ecore_x_dnd_begin (Ecore_X_Window source, unsigned char *data, int size)
_xdnd->time = _ecore_x_event_last_time; _xdnd->time = _ecore_x_event_last_time;
/* Default Accepted Action: ask */ /* Default Accepted Action: ask */
_xdnd->action = _ecore_x_atom_xdnd_action_ask; _xdnd->action = ECORE_X_ATOM_XDND_ACTION_ASK;
_xdnd->accepted_action = None; _xdnd->accepted_action = None;
/* TODO: Set supported data types in API */ /* TODO: Set supported data types in API */
@ -113,7 +114,7 @@ ecore_x_dnd_send_status(int will_accept, int suppress, Ecore_X_Rectangle rectang
xev.xclient.type = ClientMessage; xev.xclient.type = ClientMessage;
xev.xclient.display = _ecore_x_disp; xev.xclient.display = _ecore_x_disp;
xev.xclient.message_type = _ecore_x_atom_xdnd_status; xev.xclient.message_type = ECORE_X_ATOM_XDND_STATUS;
xev.xclient.format = 32; xev.xclient.format = 32;
xev.xclient.window = _xdnd->source; xev.xclient.window = _xdnd->source;
@ -166,7 +167,7 @@ _ecore_x_dnd_drag(int x, int y)
if ((win != _xdnd->dest) && (_xdnd->dest)) if ((win != _xdnd->dest) && (_xdnd->dest))
{ {
xev.xclient.window = _xdnd->dest; xev.xclient.window = _xdnd->dest;
xev.xclient.message_type = _ecore_x_atom_xdnd_leave; xev.xclient.message_type = ECORE_X_ATOM_XDND_LEAVE;
xev.xclient.data.l[0] = _xdnd->source; xev.xclient.data.l[0] = _xdnd->source;
XSendEvent(_ecore_x_disp, _xdnd->dest, False, 0, &xev); XSendEvent(_ecore_x_disp, _xdnd->dest, False, 0, &xev);
@ -182,7 +183,7 @@ _ecore_x_dnd_drag(int x, int y)
/* Entered new window, send XdndEnter */ /* Entered new window, send XdndEnter */
xev.xclient.window = win; xev.xclient.window = win;
xev.xclient.message_type = _ecore_x_atom_xdnd_enter; xev.xclient.message_type = ECORE_X_ATOM_XDND_ENTER;
xev.xclient.data.l[0] = _xdnd->source; xev.xclient.data.l[0] = _xdnd->source;
if(_xdnd->num_types > 3) if(_xdnd->num_types > 3)
xev.xclient.data.l[1] |= 0x1UL; xev.xclient.data.l[1] |= 0x1UL;
@ -200,7 +201,7 @@ _ecore_x_dnd_drag(int x, int y)
/*if (!_xdnd->await_status) /*if (!_xdnd->await_status)
{*/ {*/
xev.xclient.window = win; xev.xclient.window = win;
xev.xclient.message_type = _ecore_x_atom_xdnd_position; xev.xclient.message_type = ECORE_X_ATOM_XDND_POSITION;
xev.xclient.data.l[0] = _xdnd->source; xev.xclient.data.l[0] = _xdnd->source;
xev.xclient.data.l[1] = 0; /* Reserved */ xev.xclient.data.l[1] = 0; /* Reserved */
xev.xclient.data.l[2] = ((x << 16) & 0xffff0000) | (y & 0xffff); xev.xclient.data.l[2] = ((x << 16) & 0xffff0000) | (y & 0xffff);
@ -218,7 +219,7 @@ _ecore_x_dnd_drag(int x, int y)
if (_xdnd->will_accept) if (_xdnd->will_accept)
{ {
xev.xclient.window = win; xev.xclient.window = win;
xev.xclient.message_type = _ecore_x_atom_xdnd_drop; xev.xclient.message_type = ECORE_X_ATOM_XDND_DROP;
xev.xclient.data.l[0] = _xdnd->source; xev.xclient.data.l[0] = _xdnd->source;
xev.xclient.data.l[1] = 0; xev.xclient.data.l[1] = 0;
xev.xclient.data.l[2] = CurrentTime; xev.xclient.data.l[2] = CurrentTime;
@ -229,7 +230,7 @@ _ecore_x_dnd_drag(int x, int y)
else else
{ {
xev.xclient.window = win; xev.xclient.window = win;
xev.xclient.message_type = _ecore_x_atom_xdnd_leave; xev.xclient.message_type = ECORE_X_ATOM_XDND_LEAVE;
xev.xclient.data.l[0] = _xdnd->source; xev.xclient.data.l[0] = _xdnd->source;
memset(xev.xclient.data.l + 1, 0, sizeof(long) * 3); /* Evil */ memset(xev.xclient.data.l + 1, 0, sizeof(long) * 3); /* Evil */
XSendEvent(_ecore_x_disp, win, False, 0, &xev); XSendEvent(_ecore_x_disp, win, False, 0, &xev);
@ -250,7 +251,7 @@ _ecore_x_dnd_send_finished(void)
xev.xany.type = ClientMessage; xev.xany.type = ClientMessage;
xev.xany.display = _ecore_x_disp; xev.xany.display = _ecore_x_disp;
xev.xclient.window = _xdnd->source; xev.xclient.window = _xdnd->source;
xev.xclient.message_type = _ecore_x_atom_xdnd_finished; xev.xclient.message_type = ECORE_X_ATOM_XDND_FINISHED;
xev.xclient.format = 32; xev.xclient.format = 32;
xev.xclient.data.l[0] = _xdnd->dest; xev.xclient.data.l[0] = _xdnd->dest;
@ -261,7 +262,7 @@ _ecore_x_dnd_send_finished(void)
int int
_ecore_x_dnd_own_selection(void) _ecore_x_dnd_own_selection(void)
{ {
return (!XSetSelectionOwner(_ecore_x_disp, _ecore_x_atom_selection_xdnd, return (!XSetSelectionOwner(_ecore_x_disp, ECORE_X_ATOM_SELECTION_XDND,
_xdnd->source, CurrentTime)); _xdnd->source, CurrentTime));
} }
#endif #endif

View File

@ -5,6 +5,7 @@
#include "Ecore.h" #include "Ecore.h"
#include "ecore_x_private.h" #include "ecore_x_private.h"
#include "Ecore_X.h" #include "Ecore_X.h"
#include "Ecore_X_Atoms.h"
#if 0 #if 0
static void _ecore_x_event_free_window_prop_name_class_change(void *data, void *ev); static void _ecore_x_event_free_window_prop_name_class_change(void *data, void *ev);
@ -871,7 +872,7 @@ _ecore_x_event_handle_property_notify(XEvent *xevent)
#if 0 /* for now i disabled this. nice idea though this is - it leaves a lot #if 0 /* for now i disabled this. nice idea though this is - it leaves a lot
* to be desired for efficiency that is better left to the app layer * to be desired for efficiency that is better left to the app layer
*/ */
if (xevent->xproperty.atom == _ecore_x_atom_wm_class) if (xevent->xproperty.atom == ECORE_X_ATOM_WM_CLASS)
{ {
Ecore_X_Event_Window_Prop_Name_Class_Change *e; Ecore_X_Event_Window_Prop_Name_Class_Change *e;
@ -883,7 +884,7 @@ _ecore_x_event_handle_property_notify(XEvent *xevent)
_ecore_x_event_last_time = e->time; _ecore_x_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE, e, _ecore_x_event_free_window_prop_name_class_change, NULL); ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_NAME_CLASS_CHANGE, e, _ecore_x_event_free_window_prop_name_class_change, NULL);
} }
else if ((xevent->xproperty.atom == _ecore_x_atom_wm_name) || (xevent->xproperty.atom == _ecore_x_atom_net_wm_name)) else if ((xevent->xproperty.atom == ECORE_X_ATOM_WM_NAME) || (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_NAME))
{ {
Ecore_X_Event_Window_Prop_Title_Change *e; Ecore_X_Event_Window_Prop_Title_Change *e;
@ -894,7 +895,7 @@ _ecore_x_event_handle_property_notify(XEvent *xevent)
_ecore_x_event_last_time = e->time; _ecore_x_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE, e, _ecore_x_event_free_window_prop_title_change, NULL); ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_TITLE_CHANGE, e, _ecore_x_event_free_window_prop_title_change, NULL);
} }
else if (xevent->xproperty.atom == _ecore_x_atom_net_wm_visible_name) else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_VISIBLE_NAME)
{ {
Ecore_X_Event_Window_Prop_Visible_Title_Change *e; Ecore_X_Event_Window_Prop_Visible_Title_Change *e;
@ -905,7 +906,7 @@ _ecore_x_event_handle_property_notify(XEvent *xevent)
_ecore_x_event_last_time = e->time; _ecore_x_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE, e, _ecore_x_event_free_window_prop_visible_title_change, NULL); ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_TITLE_CHANGE, e, _ecore_x_event_free_window_prop_visible_title_change, NULL);
} }
else if ((xevent->xproperty.atom == _ecore_x_atom_wm_icon_name) || (xevent->xproperty.atom == _ecore_x_atom_net_wm_icon_name)) else if ((xevent->xproperty.atom == ECORE_X_ATOM_WM_ICON_NAME) || (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_ICON_NAME))
{ {
Ecore_X_Event_Window_Prop_Icon_Name_Change *e; Ecore_X_Event_Window_Prop_Icon_Name_Change *e;
@ -916,7 +917,7 @@ _ecore_x_event_handle_property_notify(XEvent *xevent)
_ecore_x_event_last_time = e->time; _ecore_x_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE, e, _ecore_x_event_free_window_prop_icon_name_change, NULL); ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_ICON_NAME_CHANGE, e, _ecore_x_event_free_window_prop_icon_name_change, NULL);
} }
else if (xevent->xproperty.atom == _ecore_x_atom_net_wm_visible_icon_name) else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME)
{ {
Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e; Ecore_X_Event_Window_Prop_Visible_Icon_Name_Change *e;
@ -927,7 +928,7 @@ _ecore_x_event_handle_property_notify(XEvent *xevent)
_ecore_x_event_last_time = e->time; _ecore_x_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE, e, _ecore_x_event_free_window_prop_visible_icon_name_change, NULL); ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_VISIBLE_ICON_NAME_CHANGE, e, _ecore_x_event_free_window_prop_visible_icon_name_change, NULL);
} }
else if (xevent->xproperty.atom == _ecore_x_atom_wm_client_machine) else if (xevent->xproperty.atom == ECORE_X_ATOM_WM_CLIENT_MACHINE)
{ {
Ecore_X_Event_Window_Prop_Client_Machine_Change *e; Ecore_X_Event_Window_Prop_Client_Machine_Change *e;
@ -938,7 +939,7 @@ _ecore_x_event_handle_property_notify(XEvent *xevent)
_ecore_x_event_last_time = e->time; _ecore_x_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE, e, _ecore_x_event_free_window_prop_client_machine_change, NULL); ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_CLIENT_MACHINE_CHANGE, e, _ecore_x_event_free_window_prop_client_machine_change, NULL);
} }
else if (xevent->xproperty.atom == _ecore_x_atom_net_wm_pid) else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_PID)
{ {
Ecore_X_Event_Window_Prop_Pid_Change *e; Ecore_X_Event_Window_Prop_Pid_Change *e;
@ -949,7 +950,7 @@ _ecore_x_event_handle_property_notify(XEvent *xevent)
_ecore_x_event_last_time = e->time; _ecore_x_event_last_time = e->time;
ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, NULL); ecore_event_add(ECORE_X_EVENT_WINDOW_PROP_PID_CHANGE, e, NULL, NULL);
} }
else if (xevent->xproperty.atom == _ecore_x_atom_net_wm_desktop) else if (xevent->xproperty.atom == ECORE_X_ATOM_NET_WM_DESKTOP)
{ {
Ecore_X_Event_Window_Prop_Desktop_Change *e; Ecore_X_Event_Window_Prop_Desktop_Change *e;
@ -993,9 +994,9 @@ _ecore_x_event_handle_selection_clear(XEvent *xevent)
e->win = xevent->xselectionclear.window; e->win = xevent->xselectionclear.window;
e->time = xevent->xselectionclear.time; e->time = xevent->xselectionclear.time;
sel = xevent->xselectionclear.selection; sel = xevent->xselectionclear.selection;
if (sel == _ecore_x_atom_selection_primary) if (sel == ECORE_X_ATOM_SELECTION_PRIMARY)
e->selection = ECORE_X_SELECTION_PRIMARY; e->selection = ECORE_X_SELECTION_PRIMARY;
else if (sel == _ecore_x_atom_selection_secondary) else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY)
e->selection = ECORE_X_SELECTION_SECONDARY; e->selection = ECORE_X_SELECTION_SECONDARY;
else else
e->selection = ECORE_X_SELECTION_CLIPBOARD; e->selection = ECORE_X_SELECTION_CLIPBOARD;
@ -1067,11 +1068,11 @@ _ecore_x_event_handle_selection_notify(XEvent *xevent)
e->time = xevent->xselection.time; e->time = xevent->xselection.time;
e->target = _ecore_x_selection_target_get(xevent->xselection.target); e->target = _ecore_x_selection_target_get(xevent->xselection.target);
selection = xevent->xselection.selection; selection = xevent->xselection.selection;
if (selection == _ecore_x_atom_selection_primary) if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
e->selection = ECORE_X_SELECTION_PRIMARY; e->selection = ECORE_X_SELECTION_PRIMARY;
else if (selection == _ecore_x_atom_selection_secondary) else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
e->selection = ECORE_X_SELECTION_SECONDARY; e->selection = ECORE_X_SELECTION_SECONDARY;
else if (selection == _ecore_x_atom_selection_clipboard) else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
e->selection = ECORE_X_SELECTION_CLIPBOARD; e->selection = ECORE_X_SELECTION_CLIPBOARD;
else else
{ {
@ -1118,9 +1119,9 @@ _ecore_x_event_handle_client_message(XEvent *xevent)
/* checks here and generate synthetic events per special message known */ /* checks here and generate synthetic events per special message known */
/* otherwise generate generic client message event. this would handle*/ /* otherwise generate generic client message event. this would handle*/
/* netwm, ICCCM, gnomewm, old kde and mwm hint client message protocols */ /* netwm, ICCCM, gnomewm, old kde and mwm hint client message protocols */
if ((xevent->xclient.message_type == _ecore_x_atom_wm_protocols) && if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_PROTOCOLS) &&
(xevent->xclient.format == 32) && (xevent->xclient.format == 32) &&
(xevent->xclient.data.l[0] == (long)_ecore_x_atom_wm_delete_window)) (xevent->xclient.data.l[0] == (long)ECORE_X_ATOM_WM_DELETE_WINDOW))
{ {
Ecore_X_Event_Window_Delete_Request *e; Ecore_X_Event_Window_Delete_Request *e;
@ -1133,7 +1134,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent)
/* Xdnd Client Message Handling Begin */ /* Xdnd Client Message Handling Begin */
/* Message Type: XdndEnter */ /* Message Type: XdndEnter */
else if (xevent->xclient.message_type == _ecore_x_atom_xdnd_enter) else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_ENTER)
{ {
Ecore_X_Event_Xdnd_Enter *e; Ecore_X_Event_Xdnd_Enter *e;
Ecore_X_DND_Protocol *_xdnd; Ecore_X_DND_Protocol *_xdnd;
@ -1157,7 +1158,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent)
Atom *types; Atom *types;
int i, num_ret; int i, num_ret;
if (!(ecore_x_window_prop_property_get(_xdnd->source, if (!(ecore_x_window_prop_property_get(_xdnd->source,
_ecore_x_atom_xdnd_type_list, ECORE_X_ATOM_XDND_TYPE_LIST,
XA_ATOM, XA_ATOM,
32, 32,
&data, &data,
@ -1194,7 +1195,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent)
} }
/* Message Type: XdndPosition */ /* Message Type: XdndPosition */
else if (xevent->xclient.message_type == _ecore_x_atom_xdnd_position) else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_POSITION)
{ {
Ecore_X_Event_Xdnd_Position *e; Ecore_X_Event_Xdnd_Position *e;
Ecore_X_DND_Protocol *_xdnd; Ecore_X_DND_Protocol *_xdnd;
@ -1222,7 +1223,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent)
} }
/* Message Type: XdndStatus */ /* Message Type: XdndStatus */
else if (xevent->xclient.message_type == _ecore_x_atom_xdnd_status) else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_STATUS)
{ {
Ecore_X_Event_Xdnd_Status *e; Ecore_X_Event_Xdnd_Status *e;
Ecore_X_DND_Protocol *_xdnd; Ecore_X_DND_Protocol *_xdnd;
@ -1258,7 +1259,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent)
/* Message Type: XdndLeave */ /* Message Type: XdndLeave */
/* Pretend the whole thing never happened, sort of */ /* Pretend the whole thing never happened, sort of */
else if (xevent->xclient.message_type == _ecore_x_atom_xdnd_leave) else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_LEAVE)
{ {
Ecore_X_Event_Xdnd_Leave *e; Ecore_X_Event_Xdnd_Leave *e;
Ecore_X_DND_Protocol *_xdnd; Ecore_X_DND_Protocol *_xdnd;
@ -1280,7 +1281,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent)
e->source = _xdnd->source; e->source = _xdnd->source;
ecore_event_add(ECORE_X_EVENT_XDND_LEAVE, e, NULL, NULL); ecore_event_add(ECORE_X_EVENT_XDND_LEAVE, e, NULL, NULL);
} }
else if (xevent->xclient.message_type == _ecore_x_atom_xdnd_drop) else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_DROP)
{ {
Ecore_X_Event_Xdnd_Drop *e; Ecore_X_Event_Xdnd_Drop *e;
Ecore_X_DND_Protocol *_xdnd; Ecore_X_DND_Protocol *_xdnd;
@ -1295,8 +1296,8 @@ _ecore_x_event_handle_client_message(XEvent *xevent)
timestamp = (_xdnd->version >= 1) ? timestamp = (_xdnd->version >= 1) ?
xevent->xclient.data.l[2] : _ecore_x_event_last_time; xevent->xclient.data.l[2] : _ecore_x_event_last_time;
XConvertSelection(_ecore_x_disp, _ecore_x_atom_selection_xdnd, XConvertSelection(_ecore_x_disp, ECORE_X_ATOM_SELECTION_XDND,
_xdnd->dest, _ecore_x_atom_selection_prop_xdnd, _xdnd->dest, _xdnd->dest, ECORE_X_ATOM_SELECTION_PROP_XDND, _xdnd->dest,
timestamp); timestamp);
/* FIXME: Have to wait for SelectionNotify before we can send /* FIXME: Have to wait for SelectionNotify before we can send
@ -1314,7 +1315,7 @@ _ecore_x_event_handle_client_message(XEvent *xevent)
} }
/* Message Type: XdndFinished */ /* Message Type: XdndFinished */
else if (xevent->xclient.message_type == _ecore_x_atom_xdnd_finished) else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_FINISHED)
{ {
Ecore_X_Event_Xdnd_Finished *e; Ecore_X_Event_Xdnd_Finished *e;
Ecore_X_DND_Protocol *_xdnd; Ecore_X_DND_Protocol *_xdnd;

View File

@ -7,6 +7,25 @@
#include "Ecore.h" #include "Ecore.h"
#include "ecore_x_private.h" #include "ecore_x_private.h"
#include "Ecore_X.h" #include "Ecore_X.h"
#include "Ecore_X_Atoms.h"
/* Atoms */
Ecore_X_Atom ECORE_X_ATOM_WM_STATE = 0;
Ecore_X_Atom ECORE_X_ATOM_WM_DELETE_WINDOW = 0;
Ecore_X_Atom ECORE_X_ATOM_WM_TAKE_FOCUS = 0;
Ecore_X_Atom ECORE_X_ATOM_WM_PROTOCOLS = 0;
Ecore_X_Atom ECORE_X_ATOM_WM_CLASS = 0;
Ecore_X_Atom ECORE_X_ATOM_WM_NAME = 0;
Ecore_X_Atom ECORE_X_ATOM_WM_COMMAND = 0;
Ecore_X_Atom ECORE_X_ATOM_WM_ICON_NAME = 0;
Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_MACHINE = 0;
Ecore_X_Atom ECORE_X_ATOM_WM_CHANGE_STATE = 0;
Ecore_X_Atom ECORE_X_ATOM_WM_COLORMAP_WINDOWS = 0;
Ecore_X_Atom ECORE_X_ATOM_WM_WINDOW_ROLE = 0;
Ecore_X_Atom ECORE_X_ATOM_WM_HINTS = 0;
Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_LEADER = 0;
Ecore_X_Atom ECORE_X_ATOM_WM_TRANSIENT_FOR = 0;
Ecore_X_Atom ECORE_X_ATOM_WM_SAVE_YOURSELF = 0;
void void
ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state) ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state)
@ -14,47 +33,46 @@ ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state)
unsigned long c[2]; unsigned long c[2];
if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN) if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
c[0] = WithdrawnState; c[0] = WithdrawnState;
else if (state == ECORE_X_WINDOW_STATE_HINT_NORMAL) else if (state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
c[0] = NormalState; c[0] = NormalState;
else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC) else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
c[0] = IconicState; c[0] = IconicState;
c[1] = 0; c[1] = 0;
XChangeProperty(_ecore_x_disp, win, _ecore_x_atom_wm_state, XChangeProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_STATE,
_ecore_x_atom_wm_state, 32, PropModeReplace, ECORE_X_ATOM_WM_STATE, 32, PropModeReplace,
(unsigned char *)c, 2); (unsigned char *)c, 2);
} }
void void
ecore_x_icccm_delete_window_send(Ecore_X_Window win, Ecore_X_Time t) ecore_x_icccm_delete_window_send(Ecore_X_Window win, Ecore_X_Time t)
{ {
ecore_x_client_message32_send(win, _ecore_x_atom_wm_protocols, ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
_ecore_x_atom_wm_delete_window, ECORE_X_ATOM_WM_DELETE_WINDOW,
CurrentTime, 0, 0, 0); CurrentTime, 0, 0, 0);
} }
void void
ecore_x_icccm_take_focus_send(Ecore_X_Window win, Ecore_X_Time t) ecore_x_icccm_take_focus_send(Ecore_X_Window win, Ecore_X_Time t)
{ {
ecore_x_client_message32_send(win, _ecore_x_atom_wm_protocols, ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
_ecore_x_atom_wm_take_focus, ECORE_X_ATOM_WM_TAKE_FOCUS,
CurrentTime, 0, 0, 0); CurrentTime, 0, 0, 0);
} }
void void
ecore_x_icccm_save_yourself_send(Ecore_X_Window win, Ecore_X_Time t) ecore_x_icccm_save_yourself_send(Ecore_X_Window win, Ecore_X_Time t)
{ {
ecore_x_client_message32_send(win, _ecore_x_atom_wm_protocols, ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
_ecore_x_atom_wm_save_yourself, ECORE_X_ATOM_WM_SAVE_YOURSELF,
CurrentTime, 0, 0, 0); CurrentTime, 0, 0, 0);
} }
void void
ecore_x_icccm_move_resize_send(Ecore_X_Window win, ecore_x_icccm_move_resize_send(Ecore_X_Window win, int x, int y, int w, int h)
int x, int y, int w, int h)
{ {
XEvent ev; XEvent ev;
ev.type = ConfigureNotify; ev.type = ConfigureNotify;
ev.xconfigure.display = _ecore_x_disp; ev.xconfigure.display = _ecore_x_disp;
ev.xconfigure.event = win; ev.xconfigure.event = win;
@ -67,7 +85,7 @@ ecore_x_icccm_move_resize_send(Ecore_X_Window win,
ev.xconfigure.above = win; ev.xconfigure.above = win;
ev.xconfigure.override_redirect = False; ev.xconfigure.override_redirect = False;
XSendEvent(_ecore_x_disp, win, False, StructureNotifyMask, &ev); XSendEvent(_ecore_x_disp, win, False, StructureNotifyMask, &ev);
} }
void void
ecore_x_icccm_hints_set(Ecore_X_Window win, ecore_x_icccm_hints_set(Ecore_X_Window win,
@ -76,22 +94,22 @@ ecore_x_icccm_hints_set(Ecore_X_Window win,
Ecore_X_Pixmap icon_pixmap, Ecore_X_Pixmap icon_pixmap,
Ecore_X_Pixmap icon_mask, Ecore_X_Pixmap icon_mask,
Ecore_X_Window icon_window, Ecore_X_Window icon_window,
Ecore_X_Window window_group, Ecore_X_Window window_group, int is_urgent)
int is_urgent)
{ {
XWMHints *hints; XWMHints *hints;
hints = XAllocWMHints(); hints = XAllocWMHints();
if (!hints) return; if (!hints)
return;
hints->flags = InputHint | StateHint; hints->flags = InputHint | StateHint;
hints->input = accepts_focus; hints->input = accepts_focus;
if (initial_state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN) if (initial_state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
hints->initial_state = WithdrawnState; hints->initial_state = WithdrawnState;
else if (initial_state == ECORE_X_WINDOW_STATE_HINT_NORMAL) else if (initial_state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
hints->initial_state = NormalState; hints->initial_state = NormalState;
else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC) else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
hints->initial_state = IconicState; hints->initial_state = IconicState;
if (icon_pixmap != 0) if (icon_pixmap != 0)
{ {
hints->icon_pixmap = icon_pixmap; hints->icon_pixmap = icon_pixmap;
@ -113,7 +131,7 @@ ecore_x_icccm_hints_set(Ecore_X_Window win,
hints->flags |= WindowGroupHint; hints->flags |= WindowGroupHint;
} }
if (is_urgent) if (is_urgent)
hints->flags |= XUrgencyHint; hints->flags |= XUrgencyHint;
XSetWMHints(_ecore_x_disp, win, hints); XSetWMHints(_ecore_x_disp, win, hints);
XFree(hints); XFree(hints);
} }
@ -121,40 +139,46 @@ ecore_x_icccm_hints_set(Ecore_X_Window win,
int int
ecore_x_icccm_hints_get(Ecore_X_Window win, ecore_x_icccm_hints_get(Ecore_X_Window win,
int *accepts_focus, int *accepts_focus,
Ecore_X_Window_State_Hint *initial_state, Ecore_X_Window_State_Hint * initial_state,
Ecore_X_Pixmap *icon_pixmap, Ecore_X_Pixmap * icon_pixmap,
Ecore_X_Pixmap *icon_mask, Ecore_X_Pixmap * icon_mask,
Ecore_X_Window *icon_window, Ecore_X_Window * icon_window,
Ecore_X_Window *window_group, Ecore_X_Window * window_group, int *is_urgent)
int *is_urgent)
{ {
XWMHints *hints; XWMHints *hints;
if (accepts_focus) *accepts_focus = 0; if (accepts_focus)
if (initial_state) *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL; *accepts_focus = 0;
if (icon_pixmap) *icon_pixmap = 0; if (initial_state)
if (icon_mask) *icon_mask = 0; *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
if (icon_window) *icon_window = 0; if (icon_pixmap)
if (window_group) *window_group = 0; *icon_pixmap = 0;
if (is_urgent) *is_urgent = 0; if (icon_mask)
*icon_mask = 0;
if (icon_window)
*icon_window = 0;
if (window_group)
*window_group = 0;
if (is_urgent)
*is_urgent = 0;
hints = XGetWMHints(_ecore_x_disp, win); hints = XGetWMHints(_ecore_x_disp, win);
if (hints) if (hints)
{ {
if ((hints->flags & InputHint) && (accepts_focus)) if ((hints->flags & InputHint) && (accepts_focus))
{ {
if (hints->input) if (hints->input)
*accepts_focus = 1; *accepts_focus = 1;
else else
*accepts_focus = 0; *accepts_focus = 0;
} }
if ((hints->flags & StateHint) && (initial_state)) if ((hints->flags & StateHint) && (initial_state))
{ {
if (hints->initial_state == WithdrawnState) if (hints->initial_state == WithdrawnState)
*initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN; *initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
else if (hints->initial_state == NormalState) else if (hints->initial_state == NormalState)
*initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL; *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
else if (hints->initial_state == IconicState) else if (hints->initial_state == IconicState)
*initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC; *initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
} }
if ((hints->flags & IconPixmapHint) && (icon_pixmap)) if ((hints->flags & IconPixmapHint) && (icon_pixmap))
{ {
@ -184,18 +208,17 @@ ecore_x_icccm_hints_get(Ecore_X_Window win,
void void
ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win, ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
int request_pos, int request_pos,
Ecore_X_Gravity gravity, Ecore_X_Gravity gravity,
int min_w, int min_h, int min_w, int min_h,
int max_w, int max_h, int max_w, int max_h,
int base_w, int base_h, int base_w, int base_h,
int step_x, int step_y, int step_x, int step_y,
double min_aspect, double min_aspect, double max_aspect)
double max_aspect)
{ {
/* FIXME: working here */ /* FIXME: working here */
XSizeHints hint; XSizeHints hint;
hint.flags = 0; hint.flags = 0;
if (request_pos) if (request_pos)
{ {
@ -244,39 +267,43 @@ ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
int int
ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
int *request_pos, int *request_pos,
Ecore_X_Gravity *gravity, Ecore_X_Gravity * gravity,
int *min_w, int *min_h, int *min_w, int *min_h,
int *max_w, int *max_h, int *max_w, int *max_h,
int *base_w, int *base_h, int *base_w, int *base_h,
int *step_x, int *step_y, int *step_x, int *step_y,
double *min_aspect, double *min_aspect, double *max_aspect)
double *max_aspect)
{ {
XSizeHints hint; XSizeHints hint;
long mask; long mask;
int minw = 0, minh = 0; int minw = 0, minh = 0;
int maxw = 32767, maxh = 32767; int maxw = 32767, maxh = 32767;
int basew = 0, baseh = 0; int basew = 0, baseh = 0;
int stepx = 1, stepy = 1; int stepx = 1, stepy = 1;
double mina = 0.0, maxa = 0.0; double mina = 0.0, maxa = 0.0;
if (XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask) < Success) return 0; if (XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask) < Success)
return 0;
if ((hint.flags & USPosition) || ((hint.flags & PPosition))) if ((hint.flags & USPosition) || ((hint.flags & PPosition)))
{ {
if (request_pos) *request_pos = 1; if (request_pos)
*request_pos = 1;
} }
else else
{ {
if (request_pos) *request_pos = 0; if (request_pos)
*request_pos = 0;
} }
if (hint.flags & PWinGravity) if (hint.flags & PWinGravity)
{ {
if (gravity) *gravity = hint.win_gravity; if (gravity)
*gravity = hint.win_gravity;
} }
else else
{ {
if (gravity) *gravity = ECORE_X_GRAVITY_NW; if (gravity)
*gravity = ECORE_X_GRAVITY_NW;
} }
if (hint.flags & PMinSize) if (hint.flags & PMinSize)
{ {
@ -287,56 +314,76 @@ ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
{ {
maxw = hint.max_width; maxw = hint.max_width;
maxh = hint.max_height; maxh = hint.max_height;
if (maxw < minw) maxw = minw; if (maxw < minw)
if (maxh < minh) maxh = minh; maxw = minw;
if (maxh < minh)
maxh = minh;
} }
if (hint.flags & PBaseSize) if (hint.flags & PBaseSize)
{ {
basew = hint.base_width; basew = hint.base_width;
baseh = hint.base_height; baseh = hint.base_height;
if (basew > minw) minw = basew; if (basew > minw)
if (baseh > minh) minh = baseh; minw = basew;
if (baseh > minh)
minh = baseh;
} }
if (hint.flags & PResizeInc) if (hint.flags & PResizeInc)
{ {
stepx = hint.width_inc; stepx = hint.width_inc;
stepy = hint.height_inc; stepy = hint.height_inc;
if (stepx < 1) stepx = 1; if (stepx < 1)
if (stepy < 1) stepy = 1; stepx = 1;
if (stepy < 1)
stepy = 1;
} }
if (hint.flags & PAspect) if (hint.flags & PAspect)
{ {
if (hint.min_aspect.y > 0) if (hint.min_aspect.y > 0)
mina = ((double)hint.min_aspect.x) / ((double)hint.min_aspect.y); mina = ((double)hint.min_aspect.x) / ((double)hint.min_aspect.y);
if (hint.max_aspect.y > 0) if (hint.max_aspect.y > 0)
maxa = ((double)hint.max_aspect.x) / ((double)hint.max_aspect.y); maxa = ((double)hint.max_aspect.x) / ((double)hint.max_aspect.y);
} }
if (min_w) *min_w = minw; if (min_w)
if (min_h) *min_h = minh; *min_w = minw;
if (max_w) *max_w = maxw; if (min_h)
if (max_h) *max_h = maxh; *min_h = minh;
if (base_w) *base_w = basew; if (max_w)
if (base_h) *base_h = baseh; *max_w = maxw;
if (step_x) *step_x = stepx; if (max_h)
if (step_y) *step_y = stepy; *max_h = maxh;
if (min_aspect) *min_aspect = mina; if (base_w)
if (max_aspect) *max_aspect = maxa; *base_w = basew;
if (base_h)
*base_h = baseh;
if (step_x)
*step_x = stepx;
if (step_y)
*step_y = stepy;
if (min_aspect)
*min_aspect = mina;
if (max_aspect)
*max_aspect = maxa;
return 1; return 1;
} }
void void
ecore_x_icccm_title_set(Ecore_X_Window win, const char *t) ecore_x_icccm_title_set(Ecore_X_Window win, const char *t)
{ {
char *list[1]; char *list[1];
XTextProperty xprop; XTextProperty xprop;
int ret; int ret;
#ifdef X_HAVE_UTF8_STRING #ifdef X_HAVE_UTF8_STRING
list[0] = strdup(t); list[0] = strdup(t);
ret = Xutf8TextListToTextProperty(_ecore_x_disp, list, 1, XUTF8StringStyle, &xprop); ret =
Xutf8TextListToTextProperty(_ecore_x_disp, list, 1, XUTF8StringStyle,
&xprop);
#else #else
list[0] = strdup(t); list[0] = strdup(t);
ret = XmbTextListToTextProperty(_ecore_x_disp, list, 1, XStdICCTextStyle, &xprop); ret =
XmbTextListToTextProperty(_ecore_x_disp, list, 1, XStdICCTextStyle,
&xprop);
#endif #endif
if (ret >= Success) if (ret >= Success)
{ {
@ -354,41 +401,40 @@ ecore_x_icccm_title_set(Ecore_X_Window win, const char *t)
free(list[0]); free(list[0]);
} }
char * char *
ecore_x_icccm_title_get(Ecore_X_Window win) ecore_x_icccm_title_get(Ecore_X_Window win)
{ {
XTextProperty xprop; XTextProperty xprop;
if (XGetWMName(_ecore_x_disp, win, &xprop) >= Success) if (XGetWMName(_ecore_x_disp, win, &xprop) >= Success)
{ {
if (xprop.value) if (xprop.value)
{ {
char **list = NULL; char **list = NULL;
char *t = NULL; char *t = NULL;
int num = 0; int num = 0;
if (xprop.encoding == _ecore_x_atom_string) if (xprop.encoding == ECORE_X_ATOM_STRING)
{ {
t = strdup(xprop.value); t = strdup(xprop.value);
} }
else if (xprop.encoding == _ecore_x_atom_utf8_string) else if (xprop.encoding == ECORE_X_ATOM_UTF8_STRING)
{ {
t = strdup(xprop.value); t = strdup(xprop.value);
} }
else else
{ {
int ret; int ret;
#ifdef X_HAVE_UTF8_STRING #ifdef X_HAVE_UTF8_STRING
ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop, ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
&list, &num); &list, &num);
#else #else
ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop, ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
&list, &num); &list, &num);
#endif #endif
if ((ret == XLocaleNotSupported) || if ((ret == XLocaleNotSupported) ||
(ret == XNoMemory) || (ret == XNoMemory) || (ret == XConverterNotFound))
(ret == XConverterNotFound))
{ {
t = strdup(xprop.value); t = strdup(xprop.value);
} }
@ -399,7 +445,8 @@ ecore_x_icccm_title_get(Ecore_X_Window win)
/* FIXME: convert to utf8 */ /* FIXME: convert to utf8 */
t = strdup(list[0]); t = strdup(list[0]);
} }
if (list) XFreeStringList(list); if (list)
XFreeStringList(list);
} }
} }
XFree(xprop.value); XFree(xprop.value);
@ -417,14 +464,13 @@ ecore_x_icccm_title_get(Ecore_X_Window win)
*/ */
void void
ecore_x_icccm_protocol_set(Ecore_X_Window win, ecore_x_icccm_protocol_set(Ecore_X_Window win,
Ecore_X_WM_Protocol protocol, Ecore_X_WM_Protocol protocol, int on)
int on)
{ {
Atom *protos = NULL; Atom *protos = NULL;
Atom proto; Atom proto;
int protos_count = 0; int protos_count = 0;
int already_set = 0; int already_set = 0;
int i; int i;
/* Check for invalid values */ /* Check for invalid values */
if (protocol < 0 || protocol >= ECORE_X_WM_PROTOCOL_NUM) if (protocol < 0 || protocol >= ECORE_X_WM_PROTOCOL_NUM)
@ -433,62 +479,64 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win,
proto = _ecore_x_atoms_wm_protocols[protocol]; proto = _ecore_x_atoms_wm_protocols[protocol];
if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count)) if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
{ {
protos = NULL; protos = NULL;
protos_count = 0; protos_count = 0;
} }
for (i = 0; i < protos_count; i++) for (i = 0; i < protos_count; i++)
{ {
if (protos[i] == proto) if (protos[i] == proto)
{ {
already_set = 1; already_set = 1;
break; break;
} }
} }
if (on) if (on)
{ {
Atom *new_protos = NULL; Atom *new_protos = NULL;
if (already_set) goto leave; if (already_set)
new_protos = malloc((protos_count + 1) * sizeof(Atom)); goto leave;
if (!new_protos) goto leave; new_protos = malloc((protos_count + 1) * sizeof(Atom));
for (i = 0; i < protos_count; i++) if (!new_protos)
new_protos[i] = protos[i]; goto leave;
new_protos[protos_count] = proto; for (i = 0; i < protos_count; i++)
XSetWMProtocols(_ecore_x_disp, win, new_protos, protos_count + 1); new_protos[i] = protos[i];
free(new_protos); new_protos[protos_count] = proto;
} XSetWMProtocols(_ecore_x_disp, win, new_protos, protos_count + 1);
free(new_protos);
}
else else
{ {
if (!already_set) goto leave; if (!already_set)
for (i = 0; i < protos_count; i++) goto leave;
{ for (i = 0; i < protos_count; i++)
if (protos[i] == proto) {
{ if (protos[i] == proto)
int j; {
int j;
for (j = i + 1; j < protos_count; j++) for (j = i + 1; j < protos_count; j++)
protos[j-1] = protos[j]; protos[j - 1] = protos[j];
if (protos_count > 1) if (protos_count > 1)
XSetWMProtocols(_ecore_x_disp, win, protos, XSetWMProtocols(_ecore_x_disp, win, protos,
protos_count - 1); protos_count - 1);
else else
XDeleteProperty(_ecore_x_disp, win, XDeleteProperty(_ecore_x_disp, win,
_ecore_x_atom_wm_protocols); ECORE_X_ATOM_WM_PROTOCOLS);
goto leave; goto leave;
} }
} }
} }
leave: leave:
if (protos) if (protos)
XFree(protos); XFree(protos);
} }
/** /**
* Determines whether a protocol is set for a window. * Determines whether a protocol is set for a window.
* @param win The Window * @param win The Window
@ -496,11 +544,10 @@ ecore_x_icccm_protocol_set(Ecore_X_Window win,
* @return 1 if the protocol is set, else 0. * @return 1 if the protocol is set, else 0.
*/ */
int int
ecore_x_icccm_protocol_isset(Ecore_X_Window win, ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol)
Ecore_X_WM_Protocol protocol)
{ {
Atom proto, *protos = NULL; Atom proto, *protos = NULL;
int i, ret = 0, protos_count = 0; int i, ret = 0, protos_count = 0;
/* check for invalid values */ /* check for invalid values */
if (protocol < 0 || protocol >= ECORE_X_WM_PROTOCOL_NUM) if (protocol < 0 || protocol >= ECORE_X_WM_PROTOCOL_NUM)
@ -510,13 +557,13 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win,
if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count)) if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
return 0; return 0;
for (i = 0; i < protos_count; i++) for (i = 0; i < protos_count; i++)
if (protos[i] == proto) if (protos[i] == proto)
{ {
ret = 1; ret = 1;
break; break;
} }
XFree(protos); XFree(protos);
return ret; return ret;
@ -532,11 +579,9 @@ ecore_x_icccm_protocol_isset(Ecore_X_Window win,
* Set a window name * class * Set a window name * class
*/ */
void void
ecore_x_icccm_name_class_set(Ecore_X_Window win, ecore_x_icccm_name_class_set(Ecore_X_Window win, const char *n, const char *c)
const char *n,
const char *c)
{ {
XClassHint *xch; XClassHint *xch;
xch = XAllocClassHint(); xch = XAllocClassHint();
if (!xch) if (!xch)
@ -554,12 +599,12 @@ ecore_x_icccm_name_class_set(Ecore_X_Window win,
* *
* Return the client machine of a window. String must be free'd when done with. * Return the client machine of a window. String must be free'd when done with.
*/ */
char * char *
ecore_x_icccm_client_machine_get(Ecore_X_Window win) ecore_x_icccm_client_machine_get(Ecore_X_Window win)
{ {
char *name; char *name;
name = ecore_x_window_prop_string_get(win, _ecore_x_atom_wm_client_machine); name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_CLIENT_MACHINE);
return name; return name;
} }
@ -601,8 +646,8 @@ ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv)
void void
ecore_x_icccm_icon_name_set(Ecore_X_Window win, const char *t) ecore_x_icccm_icon_name_set(Ecore_X_Window win, const char *t)
{ {
ecore_x_window_prop_string_set(win, _ecore_x_atom_wm_icon_name, (char *)t); ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_ICON_NAME, (char *)t);
ecore_x_window_prop_string_set(win, _ecore_x_atom_net_wm_icon_name, ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME,
(char *)t); (char *)t);
} }
@ -613,13 +658,14 @@ ecore_x_icccm_icon_name_set(Ecore_X_Window win, const char *t)
* *
* Return the icon name of a window. String must be free'd when done with. * Return the icon name of a window. String must be free'd when done with.
*/ */
char * char *
ecore_x_icccm_icon_name_get(Ecore_X_Window win) ecore_x_icccm_icon_name_get(Ecore_X_Window win)
{ {
char *name; char *name;
name = ecore_x_window_prop_string_get(win, _ecore_x_atom_net_wm_icon_name); name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_NET_WM_ICON_NAME);
if (!name) name = ecore_x_window_prop_string_get(win, _ecore_x_atom_wm_icon_name); if (!name)
name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_ICON_NAME);
return name; return name;
} }
@ -631,53 +677,49 @@ ecore_x_icccm_icon_name_get(Ecore_X_Window win)
void void
ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin) ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin)
{ {
int num = 0, i; int num = 0, i;
unsigned char *old_data = NULL; unsigned char *old_data = NULL;
unsigned char *data = NULL; unsigned char *data = NULL;
Window *oldset = NULL; Window *oldset = NULL;
Window *newset = NULL; Window *newset = NULL;
if(!ecore_x_window_prop_property_get(win,
_ecore_x_atom_wm_colormap_windows,
XA_WINDOW,
32,
&old_data,
&num))
{
newset = calloc(1, sizeof(Window));
if (!newset) return;
newset[0] = subwin;
num = 1;
data = (unsigned char *)newset;
}
else
{
newset = calloc(num + 1, sizeof(Window));
oldset = (Window *) old_data;
if (!newset) return;
for (i = 0; i < num; ++i)
{
if (oldset[i] == subwin)
{
XFree(old_data);
free(newset);
return;
}
newset[i] = oldset[i];
}
newset[num++] = subwin; if (!ecore_x_window_prop_property_get(win,
XFree(old_data); ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
data = (unsigned char *)newset; XA_WINDOW, 32, &old_data, &num))
} {
newset = calloc(1, sizeof(Window));
ecore_x_window_prop_property_set(win, if (!newset)
_ecore_x_atom_wm_colormap_windows, return;
XA_WINDOW, newset[0] = subwin;
32, num = 1;
data, data = (unsigned char *)newset;
num); }
else
{
newset = calloc(num + 1, sizeof(Window));
oldset = (Window *) old_data;
if (!newset)
return;
for (i = 0; i < num; ++i)
{
if (oldset[i] == subwin)
{
XFree(old_data);
free(newset);
return;
}
newset[i] = oldset[i];
}
newset[num++] = subwin;
XFree(old_data);
data = (unsigned char *)newset;
}
ecore_x_window_prop_property_set(win,
ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
XA_WINDOW, 32, data, num);
free(newset); free(newset);
} }
@ -689,53 +731,46 @@ ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin)
void void
ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin) ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin)
{ {
int num = 0, i, j, k = 0; int num = 0, i, j, k = 0;
unsigned char *old_data = NULL; unsigned char *old_data = NULL;
unsigned char *data = NULL; unsigned char *data = NULL;
Window *oldset = NULL; Window *oldset = NULL;
Window *newset = NULL; Window *newset = NULL;
if (!ecore_x_window_prop_property_get(win, if (!ecore_x_window_prop_property_get(win,
_ecore_x_atom_wm_colormap_windows, ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
XA_WINDOW, XA_WINDOW, 32, &old_data, &num))
32,
&old_data,
&num))
return; return;
oldset = (Window *) old_data; oldset = (Window *) old_data;
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {
if (oldset[i] == subwin) if (oldset[i] == subwin)
{ {
if (num == 1) if (num == 1)
{ {
XDeleteProperty(_ecore_x_disp, XDeleteProperty(_ecore_x_disp,
win, win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS);
_ecore_x_atom_wm_colormap_windows); XFree(old_data);
XFree(old_data); return;
return; }
} else
else {
{ newset = calloc(num - 1, sizeof(Window));
newset = calloc(num - 1, sizeof(Window)); data = (unsigned char *)newset;
data = (unsigned char *)newset; for (j = 0; j < num; ++j)
for (j = 0; j < num; ++j) if (oldset[j] != subwin)
if (oldset[j] != subwin) newset[k++] = oldset[j];
newset[k++] = oldset[j]; ecore_x_window_prop_property_set(win,
ecore_x_window_prop_property_set(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
_ecore_x_atom_wm_colormap_windows, XA_WINDOW, 32, data, k);
XA_WINDOW, XFree(old_data);
32, free(newset);
data, return;
k); }
XFree(old_data); }
free(newset); }
return;
}
}
}
XFree(old_data); XFree(old_data);
} }
@ -757,7 +792,7 @@ ecore_x_icccm_transient_for_set(Ecore_X_Window win, Ecore_X_Window forwin)
void void
ecore_x_icccm_transient_for_unset(Ecore_X_Window win) ecore_x_icccm_transient_for_unset(Ecore_X_Window win)
{ {
XDeleteProperty(_ecore_x_disp, win, _ecore_x_atom_wm_transient_for); XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_TRANSIENT_FOR);
} }
/** /**
@ -768,13 +803,13 @@ ecore_x_icccm_transient_for_unset(Ecore_X_Window win)
Ecore_X_Window Ecore_X_Window
ecore_x_icccm_transient_for_get(Ecore_X_Window win) ecore_x_icccm_transient_for_get(Ecore_X_Window win)
{ {
Window forwin; Window forwin;
if(XGetTransientForHint(_ecore_x_disp, win, &forwin)) if (XGetTransientForHint(_ecore_x_disp, win, &forwin))
return (Ecore_X_Window) forwin; return (Ecore_X_Window) forwin;
else else
return 0; return 0;
} }
/** /**
@ -785,8 +820,8 @@ ecore_x_icccm_transient_for_get(Ecore_X_Window win)
void void
ecore_x_icccm_window_role_set(Ecore_X_Window win, const char *role) ecore_x_icccm_window_role_set(Ecore_X_Window win, const char *role)
{ {
ecore_x_window_prop_string_set(win, _ecore_x_atom_wm_window_role, ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_WINDOW_ROLE,
(char *)role); (char *)role);
} }
/** /**
@ -794,11 +829,10 @@ ecore_x_icccm_window_role_set(Ecore_X_Window win, const char *role)
* @param win The window * @param win The window
* @return The window's role string. * @return The window's role string.
*/ */
char * char *
ecore_x_icccm_window_role_get(Ecore_X_Window win) ecore_x_icccm_window_role_get(Ecore_X_Window win)
{ {
return ecore_x_window_prop_string_get(win, return ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_WINDOW_ROLE);
_ecore_x_atom_wm_window_role);
} }
/** /**
@ -813,8 +847,8 @@ void
ecore_x_icccm_client_leader_set(Ecore_X_Window win, Ecore_X_Window l) ecore_x_icccm_client_leader_set(Ecore_X_Window win, Ecore_X_Window l)
{ {
ecore_x_window_prop_property_set(win, ecore_x_window_prop_property_set(win,
_ecore_x_atom_wm_client_leader, ECORE_X_ATOM_WM_CLIENT_LEADER,
XA_WINDOW, 32, &l, 1); XA_WINDOW, 32, &l, 1);
} }
/** /**
@ -824,19 +858,17 @@ ecore_x_icccm_client_leader_set(Ecore_X_Window win, Ecore_X_Window l)
Ecore_X_Window Ecore_X_Window
ecore_x_icccm_client_leader_get(Ecore_X_Window win) ecore_x_icccm_client_leader_get(Ecore_X_Window win)
{ {
unsigned char *data; unsigned char *data;
int num; int num;
if(ecore_x_window_prop_property_get(win, if (ecore_x_window_prop_property_get(win,
_ecore_x_atom_wm_client_leader, ECORE_X_ATOM_WM_CLIENT_LEADER,
XA_WINDOW, 32, &data, &num)) XA_WINDOW, 32, &data, &num))
return (Ecore_X_Window)*data; return (Ecore_X_Window) * data;
else else
return 0; return 0;
} }
/* FIXME: move these things in here as they are icccm related */ /* FIXME: move these things in here as they are icccm related */
/* send iconify request */ /* send iconify request */

View File

@ -7,6 +7,7 @@
#include "Ecore.h" #include "Ecore.h"
#include "ecore_x_private.h" #include "ecore_x_private.h"
#include "Ecore_X.h" #include "Ecore_X.h"
#include "Ecore_X_Atoms.h"
#define ECORE_X_MWM_HINTS_FUNCTIONS (1 << 0) #define ECORE_X_MWM_HINTS_FUNCTIONS (1 << 0)
#define ECORE_X_MWM_HINTS_DECORATIONS (1 << 1) #define ECORE_X_MWM_HINTS_DECORATIONS (1 << 1)
@ -23,48 +24,51 @@ typedef struct _mwmhints
} }
MWMHints; MWMHints;
/* Atoms */
Ecore_X_Atom ECORE_X_ATOM_MOTIF_WM_HINTS = 0;
int int
ecore_x_mwm_hints_get(Ecore_X_Window win, ecore_x_mwm_hints_get(Ecore_X_Window win,
Ecore_X_MWM_Hint_Func *fhint, Ecore_X_MWM_Hint_Func * fhint,
Ecore_X_MWM_Hint_Decor *dhint, Ecore_X_MWM_Hint_Decor * dhint,
Ecore_X_MWM_Hint_Input *ihint) Ecore_X_MWM_Hint_Input * ihint)
{ {
unsigned char *p = NULL; unsigned char *p = NULL;
MWMHints *mwmhints = NULL; MWMHints *mwmhints = NULL;
int num; int num;
int ret; int ret;
ret = 0; ret = 0;
if (!ecore_x_window_prop_property_get(win, if (!ecore_x_window_prop_property_get(win,
_ecore_x_atom_motif_wm_hints, ECORE_X_ATOM_MOTIF_WM_HINTS,
_ecore_x_atom_motif_wm_hints, ECORE_X_ATOM_MOTIF_WM_HINTS,
32, &p, &num)) 32, &p, &num))
return 0; return 0;
mwmhints = (MWMHints *)p; mwmhints = (MWMHints *) p;
if (mwmhints) if (mwmhints)
{ {
if (num >= 4) if (num >= 4)
{ {
if (dhint) if (dhint)
{ {
if (mwmhints->flags & ECORE_X_MWM_HINTS_DECORATIONS) if (mwmhints->flags & ECORE_X_MWM_HINTS_DECORATIONS)
*dhint = mwmhints->decorations; *dhint = mwmhints->decorations;
else else
*dhint = ECORE_X_MWM_HINT_DECOR_ALL; *dhint = ECORE_X_MWM_HINT_DECOR_ALL;
} }
if (fhint) if (fhint)
{ {
if (mwmhints->flags & ECORE_X_MWM_HINTS_FUNCTIONS) if (mwmhints->flags & ECORE_X_MWM_HINTS_FUNCTIONS)
*fhint = mwmhints->functions; *fhint = mwmhints->functions;
else else
*fhint = ECORE_X_MWM_HINT_FUNC_ALL; *fhint = ECORE_X_MWM_HINT_FUNC_ALL;
} }
if (ihint) if (ihint)
{ {
if (mwmhints->flags & ECORE_X_MWM_HINTS_INPUT_MODE) if (mwmhints->flags & ECORE_X_MWM_HINTS_INPUT_MODE)
*ihint = mwmhints->inputmode; *ihint = mwmhints->inputmode;
else else
*ihint = ECORE_X_MWM_HINT_INPUT_MODELESS; *ihint = ECORE_X_MWM_HINT_INPUT_MODELESS;
} }
ret = 1; ret = 1;
} }

View File

@ -4,6 +4,7 @@
#include "Ecore.h" #include "Ecore.h"
#include "ecore_x_private.h" #include "ecore_x_private.h"
#include "Ecore_X.h" #include "Ecore_X.h"
#include "Ecore_X_Atoms.h"
/* /*
* Convenience macros * Convenience macros
@ -12,10 +13,10 @@
XInternAtom(_ecore_x_disp, name, False) XInternAtom(_ecore_x_disp, name, False)
#define _ATOM_SET_UTF8_STRING(atom, win, string) \ #define _ATOM_SET_UTF8_STRING(atom, win, string) \
XChangeProperty(_ecore_x_disp, win, atom, _ecore_x_atom_utf8_string, 8, PropModeReplace, \ XChangeProperty(_ecore_x_disp, win, atom, ECORE_X_ATOM_UTF8_STRING, 8, PropModeReplace, \
(unsigned char *)string, strlen(string)) (unsigned char *)string, strlen(string))
#define _ATOM_SET_UTF8_STRING_LIST(atom, win, string, cnt) \ #define _ATOM_SET_UTF8_STRING_LIST(atom, win, string, cnt) \
XChangeProperty(_ecore_x_disp, win, atom, _ecore_x_atom_utf8_string, 8, PropModeReplace, \ XChangeProperty(_ecore_x_disp, win, atom, ECORE_X_ATOM_UTF8_STRING, 8, PropModeReplace, \
(unsigned char *)string, cnt) (unsigned char *)string, cnt)
#define _ATOM_SET_WINDOW(atom, win, p_wins, cnt) \ #define _ATOM_SET_WINDOW(atom, win, p_wins, cnt) \
XChangeProperty(_ecore_x_disp, win, atom, XA_WINDOW, 32, PropModeReplace, \ XChangeProperty(_ecore_x_disp, win, atom, XA_WINDOW, 32, PropModeReplace, \
@ -27,7 +28,6 @@
XChangeProperty(_ecore_x_disp, win, atom, XA_CARDINAL, 32, PropModeReplace, \ XChangeProperty(_ecore_x_disp, win, atom, XA_CARDINAL, 32, PropModeReplace, \
(unsigned char *)p_val, cnt) (unsigned char *)p_val, cnt)
/* /*
* Convenience functions. Should probably go elsewhere. * Convenience functions. Should probably go elsewhere.
*/ */
@ -36,7 +36,8 @@
* Set UTF-8 string property * Set UTF-8 string property
*/ */
static void static void
_ecore_x_window_prop_string_utf8_set(Ecore_X_Window win, Ecore_X_Atom atom, const char *str) _ecore_x_window_prop_string_utf8_set(Ecore_X_Window win, Ecore_X_Atom atom,
const char *str)
{ {
_ATOM_SET_UTF8_STRING(win, atom, str); _ATOM_SET_UTF8_STRING(win, atom, str);
} }
@ -44,7 +45,7 @@ _ecore_x_window_prop_string_utf8_set(Ecore_X_Window win, Ecore_X_Atom atom, cons
/* /*
* Get UTF-8 string property * Get UTF-8 string property
*/ */
static char * static char *
_ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, Ecore_X_Atom atom) _ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, Ecore_X_Atom atom)
{ {
char *str; char *str;
@ -56,7 +57,7 @@ _ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, Ecore_X_Atom atom)
str = NULL; str = NULL;
prop_return = NULL; prop_return = NULL;
XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False, XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False,
_ecore_x_atom_utf8_string, &type_ret, ECORE_X_ATOM_UTF8_STRING, &type_ret,
&format_ret, &num_ret, &bytes_after, &prop_return); &format_ret, &num_ret, &bytes_after, &prop_return);
if (prop_return && num_ret > 0 && format_ret == 8) if (prop_return && num_ret > 0 && format_ret == 8)
{ {
@ -73,134 +74,144 @@ _ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, Ecore_X_Atom atom)
return str; return str;
} }
/* /*
* Root window NetWM hints. * Root window NetWM hints.
*/ */
Atom _ecore_x_atom_net_supported = 0; Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTED = 0;
Atom _ecore_x_atom_net_supporting_wm_check = 0; Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK = 0;
Atom _ecore_x_atom_net_number_of_desktops = 0; Ecore_X_Atom ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS = 0;
Atom _ecore_x_atom_net_virtual_roots = 0; Ecore_X_Atom ECORE_X_ATOM_NET_VIRTUAL_ROOTS = 0;
Atom _ecore_x_atom_net_desktop_names = 0; Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_NAMES = 0;
Atom _ecore_x_atom_net_desktop_geometry = 0; Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_GEOMETRY = 0;
Atom _ecore_x_atom_net_desktop_viewport = 0; Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_VIEWPORT = 0;
Atom _ecore_x_atom_net_workarea = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WORKAREA = 0;
Atom _ecore_x_atom_net_desktop_layout = 0; Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_LAYOUT = 0;
Atom _ecore_x_atom_net_current_desktop = 0; Ecore_X_Atom ECORE_X_ATOM_NET_CURRENT_DESKTOP = 0;
Atom _ecore_x_atom_net_showing_desktop = 0; Ecore_X_Atom ECORE_X_ATOM_NET_SHOWING_DESKTOP = 0;
Atom _ecore_x_atom_net_client_list = 0; Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST = 0;
Atom _ecore_x_atom_net_client_list_stacking = 0; Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST_STACKING = 0;
Atom _ecore_x_atom_net_active_window = 0; Ecore_X_Atom ECORE_X_ATOM_NET_ACTIVE_WINDOW = 0;
/* /*
* Client message types. * Client message types.
*/ */
Atom _ecore_x_atom_net_close_window = 0; Ecore_X_Atom ECORE_X_ATOM_NET_CLOSE_WINDOW = 0;
Atom _ecore_x_atom_net_wm_moveresize = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_MOVERESIZE = 0;
/* /*
* Application window specific NetWM hints. * Application window specific NetWM hints.
*/ */
Atom _ecore_x_atom_net_wm_desktop = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_DESKTOP = 0;
Atom _ecore_x_atom_net_wm_name = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_NAME = 0;
Atom _ecore_x_atom_net_wm_visible_name = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_NAME = 0;
Atom _ecore_x_atom_net_wm_icon_name = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_NAME = 0;
Atom _ecore_x_atom_net_wm_visible_icon_name = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME = 0;
Atom _ecore_x_atom_net_wm_window_type = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE = 0;
Atom _ecore_x_atom_net_wm_state = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE = 0;
Atom _ecore_x_atom_net_wm_allowed_actions = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS = 0;
Atom _ecore_x_atom_net_wm_strut = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT = 0;
Atom _ecore_x_atom_net_wm_strut_partial = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT_PARTIAL = 0;
Atom _ecore_x_atom_net_wm_icon_geometry = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_GEOMETRY = 0;
Atom _ecore_x_atom_net_wm_icon = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON = 0;
Atom _ecore_x_atom_net_wm_pid = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_PID = 0;
Atom _ecore_x_atom_net_wm_handle_icons = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_HANDLE_ICONS = 0;
Atom _ecore_x_atom_net_wm_user_time = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_USER_TIME = 0;
Atom _ecore_x_atom_net_wm_window_type_desktop = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP = 0;
Atom _ecore_x_atom_net_wm_window_type_dock = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK = 0;
Atom _ecore_x_atom_net_wm_window_type_toolbar = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR = 0;
Atom _ecore_x_atom_net_wm_window_type_menu = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU = 0;
Atom _ecore_x_atom_net_wm_window_type_utility = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY = 0;
Atom _ecore_x_atom_net_wm_window_type_splash = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH = 0;
Atom _ecore_x_atom_net_wm_window_type_dialog = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG = 0;
Atom _ecore_x_atom_net_wm_window_type_normal = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL = 0;
Atom _ecore_x_atom_net_wm_state_modal = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MODAL = 0;
Atom _ecore_x_atom_net_wm_state_sticky = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_STICKY = 0;
Atom _ecore_x_atom_net_wm_state_maximized_vert = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT = 0;
Atom _ecore_x_atom_net_wm_state_maximized_horz = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ = 0;
Atom _ecore_x_atom_net_wm_state_shaded = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SHADED = 0;
Atom _ecore_x_atom_net_wm_state_skip_taskbar = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR = 0;
Atom _ecore_x_atom_net_wm_state_skip_pager = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER = 0;
Atom _ecore_x_atom_net_wm_state_hidden = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_HIDDEN = 0;
Atom _ecore_x_atom_net_wm_state_fullscreen = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN = 0;
Atom _ecore_x_atom_net_wm_state_above = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_ABOVE = 0;
Atom _ecore_x_atom_net_wm_state_below = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_BELOW = 0;
Atom _ecore_x_atom_net_wm_window_opacity = 0; Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_OPACITY = 0;
void void
ecore_x_netwm_init(void) ecore_x_netwm_init(void)
{ {
_ecore_x_atom_net_supported = _ATOM_GET("_NET_SUPPORTED"); ECORE_X_ATOM_NET_SUPPORTED = _ATOM_GET("_NET_SUPPORTED");
_ecore_x_atom_net_supporting_wm_check = _ATOM_GET("_NET_SUPPORTING_WM_CHECK"); ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK = _ATOM_GET("_NET_SUPPORTING_WM_CHECK");
_ecore_x_atom_net_number_of_desktops = _ATOM_GET("_NET_NUMBER_OF_DESKTOPS"); ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS = _ATOM_GET("_NET_NUMBER_OF_DESKTOPS");
_ecore_x_atom_net_virtual_roots = _ATOM_GET("_NET_VIRTUAL_ROOTS"); ECORE_X_ATOM_NET_VIRTUAL_ROOTS = _ATOM_GET("_NET_VIRTUAL_ROOTS");
_ecore_x_atom_net_desktop_geometry = _ATOM_GET("_NET_DESKTOP_GEOMETRY"); ECORE_X_ATOM_NET_DESKTOP_GEOMETRY = _ATOM_GET("_NET_DESKTOP_GEOMETRY");
_ecore_x_atom_net_desktop_names = _ATOM_GET("_NET_DESKTOP_NAMES"); ECORE_X_ATOM_NET_DESKTOP_NAMES = _ATOM_GET("_NET_DESKTOP_NAMES");
_ecore_x_atom_net_current_desktop = _ATOM_GET("_NET_CURRENT_DESKTOP"); ECORE_X_ATOM_NET_CURRENT_DESKTOP = _ATOM_GET("_NET_CURRENT_DESKTOP");
_ecore_x_atom_net_desktop_viewport = _ATOM_GET("_NET_DESKTOP_VIEWPORT"); ECORE_X_ATOM_NET_DESKTOP_VIEWPORT = _ATOM_GET("_NET_DESKTOP_VIEWPORT");
_ecore_x_atom_net_workarea = _ATOM_GET("_NET_WORKAREA"); ECORE_X_ATOM_NET_WORKAREA = _ATOM_GET("_NET_WORKAREA");
_ecore_x_atom_net_client_list = _ATOM_GET("_NET_CLIENT_LIST"); ECORE_X_ATOM_NET_CLIENT_LIST = _ATOM_GET("_NET_CLIENT_LIST");
_ecore_x_atom_net_client_list_stacking = _ATOM_GET("_NET_CLIENT_LIST_STACKING"); ECORE_X_ATOM_NET_CLIENT_LIST_STACKING =
_ecore_x_atom_net_active_window = _ATOM_GET("_NET_ACTIVE_WINDOW"); _ATOM_GET("_NET_CLIENT_LIST_STACKING");
ECORE_X_ATOM_NET_ACTIVE_WINDOW = _ATOM_GET("_NET_ACTIVE_WINDOW");
_ecore_x_atom_net_close_window = _ATOM_GET("_NET_CLOSE_WINDOW"); ECORE_X_ATOM_NET_CLOSE_WINDOW = _ATOM_GET("_NET_CLOSE_WINDOW");
_ecore_x_atom_net_wm_moveresize = _ATOM_GET("_NET_WM_MOVERESIZE"); ECORE_X_ATOM_NET_WM_MOVERESIZE = _ATOM_GET("_NET_WM_MOVERESIZE");
_ecore_x_atom_net_wm_name = _ATOM_GET("_NET_WM_NAME"); ECORE_X_ATOM_NET_WM_NAME = _ATOM_GET("_NET_WM_NAME");
_ecore_x_atom_net_wm_visible_name = _ATOM_GET("_NET_WM_VISIBLE_NAME"); ECORE_X_ATOM_NET_WM_VISIBLE_NAME = _ATOM_GET("_NET_WM_VISIBLE_NAME");
_ecore_x_atom_net_wm_icon_name = _ATOM_GET("_NET_WM_ICON_NAME"); ECORE_X_ATOM_NET_WM_ICON_NAME = _ATOM_GET("_NET_WM_ICON_NAME");
_ecore_x_atom_net_wm_visible_icon_name = _ATOM_GET("_NET_WM_VISIBLE_ICON_NAME"); ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME =
_ecore_x_atom_net_wm_desktop = _ATOM_GET("_NET_WM_DESKTOP"); _ATOM_GET("_NET_WM_VISIBLE_ICON_NAME");
_ecore_x_atom_net_wm_window_type = _ATOM_GET("_NET_WM_WINDOW_TYPE"); ECORE_X_ATOM_NET_WM_DESKTOP = _ATOM_GET("_NET_WM_DESKTOP");
_ecore_x_atom_net_wm_state = _ATOM_GET("_NET_WM_STATE"); ECORE_X_ATOM_NET_WM_WINDOW_TYPE = _ATOM_GET("_NET_WM_WINDOW_TYPE");
_ecore_x_atom_net_wm_allowed_actions = _ATOM_GET("_NET_WM_ALLOWED_ACTIONS"); ECORE_X_ATOM_NET_WM_STATE = _ATOM_GET("_NET_WM_STATE");
_ecore_x_atom_net_wm_strut = _ATOM_GET("_NET_WM_STRUT"); ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS = _ATOM_GET("_NET_WM_ALLOWED_ACTIONS");
_ecore_x_atom_net_wm_strut_partial = _ATOM_GET("_NET_WM_STRUT_PARTIAL"); ECORE_X_ATOM_NET_WM_STRUT = _ATOM_GET("_NET_WM_STRUT");
_ecore_x_atom_net_wm_icon_geometry = _ATOM_GET("_NET_WM_ICON_GEOMETRY"); ECORE_X_ATOM_NET_WM_STRUT_PARTIAL = _ATOM_GET("_NET_WM_STRUT_PARTIAL");
_ecore_x_atom_net_wm_icon = _ATOM_GET("_NET_WM_ICON"); ECORE_X_ATOM_NET_WM_ICON_GEOMETRY = _ATOM_GET("_NET_WM_ICON_GEOMETRY");
_ecore_x_atom_net_wm_pid = _ATOM_GET("_NET_WM_PID"); ECORE_X_ATOM_NET_WM_ICON = _ATOM_GET("_NET_WM_ICON");
_ecore_x_atom_net_wm_user_time = _ATOM_GET("_NET_WM_USER_TIME"); ECORE_X_ATOM_NET_WM_PID = _ATOM_GET("_NET_WM_PID");
ECORE_X_ATOM_NET_WM_USER_TIME = _ATOM_GET("_NET_WM_USER_TIME");
_ecore_x_atom_net_wm_window_type_desktop = _ATOM_GET("_NET_WM_WINDOW_TYPE_DESKTOP"); ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP =
_ecore_x_atom_net_wm_window_type_dock = _ATOM_GET("_NET_WM_WINDOW_TYPE_DOCK"); _ATOM_GET("_NET_WM_WINDOW_TYPE_DESKTOP");
_ecore_x_atom_net_wm_window_type_toolbar = _ATOM_GET("_NET_WM_WINDOW_TYPE_TOOLBAR"); ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK = _ATOM_GET("_NET_WM_WINDOW_TYPE_DOCK");
_ecore_x_atom_net_wm_window_type_menu = _ATOM_GET("_NET_WM_WINDOW_TYPE_MENU"); ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR =
_ecore_x_atom_net_wm_window_type_utility = _ATOM_GET("_NET_WM_WINDOW_TYPE_UTILITY"); _ATOM_GET("_NET_WM_WINDOW_TYPE_TOOLBAR");
_ecore_x_atom_net_wm_window_type_splash = _ATOM_GET("_NET_WM_WINDOW_TYPE_SPLASH"); ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU = _ATOM_GET("_NET_WM_WINDOW_TYPE_MENU");
_ecore_x_atom_net_wm_window_type_dialog = _ATOM_GET("_NET_WM_WINDOW_TYPE_DIALOG"); ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY =
_ecore_x_atom_net_wm_window_type_normal = _ATOM_GET("_NET_WM_WINDOW_TYPE_NORMAL"); _ATOM_GET("_NET_WM_WINDOW_TYPE_UTILITY");
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH =
_ATOM_GET("_NET_WM_WINDOW_TYPE_SPLASH");
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG =
_ATOM_GET("_NET_WM_WINDOW_TYPE_DIALOG");
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL =
_ATOM_GET("_NET_WM_WINDOW_TYPE_NORMAL");
_ecore_x_atom_net_wm_state_modal = _ATOM_GET("_NET_WM_STATE_MODAL"); ECORE_X_ATOM_NET_WM_STATE_MODAL = _ATOM_GET("_NET_WM_STATE_MODAL");
_ecore_x_atom_net_wm_state_sticky = _ATOM_GET("_NET_WM_STATE_STICKY"); ECORE_X_ATOM_NET_WM_STATE_STICKY = _ATOM_GET("_NET_WM_STATE_STICKY");
_ecore_x_atom_net_wm_state_maximized_vert = _ATOM_GET("_NET_WM_STATE_MAXIMIZED_VERT"); ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT =
_ecore_x_atom_net_wm_state_maximized_horz = _ATOM_GET("_NET_WM_STATE_MAXIMIZED_HORZ"); _ATOM_GET("_NET_WM_STATE_MAXIMIZED_VERT");
_ecore_x_atom_net_wm_state_shaded = _ATOM_GET("_NET_WM_STATE_SHADED"); ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ =
_ecore_x_atom_net_wm_state_skip_taskbar = _ATOM_GET("_NET_WM_STATE_SKIP_TASKBAR"); _ATOM_GET("_NET_WM_STATE_MAXIMIZED_HORZ");
_ecore_x_atom_net_wm_state_skip_pager = _ATOM_GET("_NET_WM_STATE_SKIP_PAGER"); ECORE_X_ATOM_NET_WM_STATE_SHADED = _ATOM_GET("_NET_WM_STATE_SHADED");
_ecore_x_atom_net_wm_state_hidden = _ATOM_GET("_NET_WM_STATE_HIDDEN"); ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR =
_ecore_x_atom_net_wm_state_fullscreen = _ATOM_GET("_NET_WM_STATE_FULLSCREEN"); _ATOM_GET("_NET_WM_STATE_SKIP_TASKBAR");
_ecore_x_atom_net_wm_state_above = _ATOM_GET("_NET_WM_STATE_ABOVE"); ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER = _ATOM_GET("_NET_WM_STATE_SKIP_PAGER");
_ecore_x_atom_net_wm_state_below = _ATOM_GET("_NET_WM_STATE_BELOW"); ECORE_X_ATOM_NET_WM_STATE_HIDDEN = _ATOM_GET("_NET_WM_STATE_HIDDEN");
ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN = _ATOM_GET("_NET_WM_STATE_FULLSCREEN");
ECORE_X_ATOM_NET_WM_STATE_ABOVE = _ATOM_GET("_NET_WM_STATE_ABOVE");
ECORE_X_ATOM_NET_WM_STATE_BELOW = _ATOM_GET("_NET_WM_STATE_BELOW");
_ecore_x_atom_net_wm_window_opacity = _ATOM_GET("_NET_WM_WINDOW_OPACITY"); ECORE_X_ATOM_NET_WM_WINDOW_OPACITY = _ATOM_GET("_NET_WM_WINDOW_OPACITY");
} }
/* /*
@ -208,15 +219,14 @@ ecore_x_netwm_init(void)
*/ */
void void
ecore_x_netwm_wm_identify(Ecore_X_Window root, Ecore_X_Window check, ecore_x_netwm_wm_identify(Ecore_X_Window root, Ecore_X_Window check,
const char *wm_name) const char *wm_name)
{ {
_ATOM_SET_WINDOW(_ecore_x_atom_net_supporting_wm_check, root, &check, 1); _ATOM_SET_WINDOW(ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, root, &check, 1);
_ATOM_SET_WINDOW(_ecore_x_atom_net_supporting_wm_check, check, &check, 1); _ATOM_SET_WINDOW(ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, check, &check, 1);
_ATOM_SET_UTF8_STRING(_ecore_x_atom_net_wm_name, check, wm_name); _ATOM_SET_UTF8_STRING(ECORE_X_ATOM_NET_WM_NAME, check, wm_name);
/* This one isn't mandatory */ /* This one isn't mandatory */
_ATOM_SET_UTF8_STRING(_ecore_x_atom_net_wm_name, root, wm_name); _ATOM_SET_UTF8_STRING(ECORE_X_ATOM_NET_WM_NAME, root, wm_name);
} }
/* /*
* Desktop configuration and status * Desktop configuration and status
@ -228,14 +238,14 @@ ecore_x_netwm_desk_count_set(Ecore_X_Window root, int n_desks)
CARD32 val; CARD32 val;
val = n_desks; val = n_desks;
_ATOM_SET_CARD32(_ecore_x_atom_net_number_of_desktops, root, &val, 1); _ATOM_SET_CARD32(ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS, root, &val, 1);
} }
void void
ecore_x_netwm_desk_roots_set(Ecore_X_Window root, int n_desks, ecore_x_netwm_desk_roots_set(Ecore_X_Window root, int n_desks,
Ecore_X_Window * vroots) Ecore_X_Window * vroots)
{ {
_ATOM_SET_WINDOW(_ecore_x_atom_net_virtual_roots, root, vroots, n_desks); _ATOM_SET_WINDOW(ECORE_X_ATOM_NET_VIRTUAL_ROOTS, root, vroots, n_desks);
} }
void void
@ -265,7 +275,7 @@ ecore_x_netwm_desk_names_set(Ecore_X_Window root, int n_desks,
len += l; len += l;
} }
_ATOM_SET_UTF8_STRING_LIST(_ecore_x_atom_net_desktop_names, root, buf, len); _ATOM_SET_UTF8_STRING_LIST(ECORE_X_ATOM_NET_DESKTOP_NAMES, root, buf, len);
free(buf); free(buf);
} }
@ -277,7 +287,7 @@ ecore_x_netwm_desk_size_set(Ecore_X_Window root, int width, int height)
size[0] = width; size[0] = width;
size[1] = height; size[1] = height;
_ATOM_SET_CARD32(_ecore_x_atom_net_desktop_geometry, root, &size, 2); _ATOM_SET_CARD32(ECORE_X_ATOM_NET_DESKTOP_GEOMETRY, root, &size, 2);
} }
void void
@ -294,7 +304,7 @@ ecore_x_netwm_desk_workareas_set(Ecore_X_Window root, int n_desks, int *areas)
for (i = 0; i < n_coord; i++) for (i = 0; i < n_coord; i++)
p_coord[i] = areas[i]; p_coord[i] = areas[i];
_ATOM_SET_CARD32(_ecore_x_atom_net_workarea, root, p_coord, n_coord); _ATOM_SET_CARD32(ECORE_X_ATOM_NET_WORKAREA, root, p_coord, n_coord);
free(p_coord); free(p_coord);
} }
@ -305,7 +315,7 @@ ecore_x_netwm_desk_current_set(Ecore_X_Window root, int desk)
CARD32 val; CARD32 val;
val = desk; val = desk;
_ATOM_SET_CARD32(_ecore_x_atom_net_current_desktop, root, &val, 1); _ATOM_SET_CARD32(ECORE_X_ATOM_NET_CURRENT_DESKTOP, root, &val, 1);
} }
void void
@ -322,7 +332,7 @@ ecore_x_netwm_desk_viewports_set(Ecore_X_Window root, int n_desks, int *origins)
for (i = 0; i < n_coord; i++) for (i = 0; i < n_coord; i++)
p_coord[i] = origins[i]; p_coord[i] = origins[i];
_ATOM_SET_CARD32(_ecore_x_atom_net_desktop_viewport, root, p_coord, n_coord); _ATOM_SET_CARD32(ECORE_X_ATOM_NET_DESKTOP_VIEWPORT, root, p_coord, n_coord);
free(p_coord); free(p_coord);
} }
@ -333,7 +343,7 @@ ecore_x_netwm_showing_desktop_set(Ecore_X_Window root, int on)
CARD32 val; CARD32 val;
val = on; val = on;
_ATOM_SET_CARD32(_ecore_x_atom_net_showing_desktop, root, &val, 1); _ATOM_SET_CARD32(ECORE_X_ATOM_NET_SHOWING_DESKTOP, root, &val, 1);
} }
/* /*
@ -345,7 +355,7 @@ void
ecore_x_netwm_client_list_set(Ecore_X_Window root, int n_clients, ecore_x_netwm_client_list_set(Ecore_X_Window root, int n_clients,
Ecore_X_Window * p_clients) Ecore_X_Window * p_clients)
{ {
_ATOM_SET_WINDOW(_ecore_x_atom_net_client_list, root, p_clients, n_clients); _ATOM_SET_WINDOW(ECORE_X_ATOM_NET_CLIENT_LIST, root, p_clients, n_clients);
} }
/* Stacking order */ /* Stacking order */
@ -353,60 +363,66 @@ void
ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root, int n_clients, ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root, int n_clients,
Ecore_X_Window * p_clients) Ecore_X_Window * p_clients)
{ {
_ATOM_SET_WINDOW(_ecore_x_atom_net_client_list_stacking, root, p_clients, _ATOM_SET_WINDOW(ECORE_X_ATOM_NET_CLIENT_LIST_STACKING, root, p_clients,
n_clients); n_clients);
} }
void void
ecore_x_netwm_client_active_set(Ecore_X_Window root, Ecore_X_Window win) ecore_x_netwm_client_active_set(Ecore_X_Window root, Ecore_X_Window win)
{ {
_ATOM_SET_WINDOW(_ecore_x_atom_net_active_window, root, &win, 1); _ATOM_SET_WINDOW(ECORE_X_ATOM_NET_ACTIVE_WINDOW, root, &win, 1);
} }
void void
ecore_x_netwm_name_set(Ecore_X_Window win, const char *name) ecore_x_netwm_name_set(Ecore_X_Window win, const char *name)
{ {
_ecore_x_window_prop_string_utf8_set(_ecore_x_atom_net_wm_name, win, name); _ecore_x_window_prop_string_utf8_set(ECORE_X_ATOM_NET_WM_NAME, win, name);
} }
char * char *
ecore_x_netwm_name_get(Ecore_X_Window win) ecore_x_netwm_name_get(Ecore_X_Window win)
{ {
return _ecore_x_window_prop_string_utf8_get(win, _ecore_x_atom_net_wm_name); return _ecore_x_window_prop_string_utf8_get(win, ECORE_X_ATOM_NET_WM_NAME);
} }
void void
ecore_x_netwm_icon_name_set(Ecore_X_Window win, const char *name) ecore_x_netwm_icon_name_set(Ecore_X_Window win, const char *name)
{
_ecore_x_window_prop_string_utf8_set(_ecore_x_atom_net_wm_icon_name, win, name);
}
char *
ecore_x_netwm_icon_name_get(Ecore_X_Window win)
{ {
return _ecore_x_window_prop_string_utf8_get(win, _ecore_x_atom_net_wm_icon_name); _ecore_x_window_prop_string_utf8_set(ECORE_X_ATOM_NET_WM_ICON_NAME, win,
name);
}
char *
ecore_x_netwm_icon_name_get(Ecore_X_Window win)
{
return _ecore_x_window_prop_string_utf8_get(win,
ECORE_X_ATOM_NET_WM_ICON_NAME);
} }
void void
ecore_x_netwm_visible_name_set(Ecore_X_Window win, const char *name) ecore_x_netwm_visible_name_set(Ecore_X_Window win, const char *name)
{ {
_ecore_x_window_prop_string_utf8_set(_ecore_x_atom_net_wm_visible_name, win, name); _ecore_x_window_prop_string_utf8_set(ECORE_X_ATOM_NET_WM_VISIBLE_NAME, win,
name);
} }
char * char *
ecore_x_netwm_visible_name_get(Ecore_X_Window win) ecore_x_netwm_visible_name_get(Ecore_X_Window win)
{ {
return _ecore_x_window_prop_string_utf8_get(win, _ecore_x_atom_net_wm_visible_name); return _ecore_x_window_prop_string_utf8_get(win,
ECORE_X_ATOM_NET_WM_VISIBLE_NAME);
} }
void void
ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win, const char *name) ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win, const char *name)
{ {
_ecore_x_window_prop_string_utf8_set(_ecore_x_atom_net_wm_visible_icon_name, win, name); _ecore_x_window_prop_string_utf8_set(ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME,
} win, name);
}
char * char *
ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win) ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win)
{ {
return _ecore_x_window_prop_string_utf8_get(win, _ecore_x_atom_net_wm_visible_icon_name); return _ecore_x_window_prop_string_utf8_get(win,
} ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME);
}

View File

@ -16,6 +16,7 @@
#include <X11/extensions/XShm.h> #include <X11/extensions/XShm.h>
#include <X11/extensions/shape.h> #include <X11/extensions/shape.h>
#include "Ecore_X.h"
/* FIXME: this is for simulation only */ /* FIXME: this is for simulation only */
#include "Ecore_Job.h" #include "Ecore_Job.h"
@ -99,21 +100,6 @@ typedef struct _Ecore_X_DND_Protocol
} handlers; } handlers;
} Ecore_X_DND_Protocol; } Ecore_X_DND_Protocol;
typedef enum _Ecore_X_WM_Protocol {
/**
* If enabled the window manager will be asked to send a
* delete message instead of just closing (destroying) the window.
*/
ECORE_X_WM_PROTOCOL_DELETE_REQUEST,
/**
* If enabled the window manager will be told that the window
* explicitly sets input focus.
*/
ECORE_X_WM_PROTOCOL_TAKE_FOCUS,
ECORE_X_WM_PROTOCOL_NUM
} Ecore_X_WM_Protocol;
extern Display *_ecore_x_disp; extern Display *_ecore_x_disp;
extern double _ecore_x_double_click_time; extern double _ecore_x_double_click_time;
extern Time _ecore_x_event_last_time; extern Time _ecore_x_event_last_time;
@ -121,114 +107,7 @@ extern Window _ecore_x_event_last_win;
extern int _ecore_x_event_last_root_x; extern int _ecore_x_event_last_root_x;
extern int _ecore_x_event_last_root_y; extern int _ecore_x_event_last_root_y;
extern Atom _ecore_x_atom_wm_state; extern Ecore_X_Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
extern Atom _ecore_x_atom_wm_delete_window;
extern Atom _ecore_x_atom_wm_take_focus;
extern Atom _ecore_x_atom_wm_protocols;
extern Atom _ecore_x_atom_wm_class;
extern Atom _ecore_x_atom_wm_name;
extern Atom _ecore_x_atom_wm_command;
extern Atom _ecore_x_atom_wm_icon_name;
extern Atom _ecore_x_atom_wm_client_machine;
extern Atom _ecore_x_atom_wm_change_state;
extern Atom _ecore_x_atom_wm_colormap_windows;
extern Atom _ecore_x_atom_wm_window_role;
extern Atom _ecore_x_atom_wm_hints;
extern Atom _ecore_x_atom_wm_client_leader;
extern Atom _ecore_x_atom_wm_transient_for;
extern Atom _ecore_x_atom_wm_save_yourself;
extern Atom _ecore_x_atom_motif_wm_hints;
extern Atom _ecore_x_atom_win_layer;
extern Atom _ecore_x_atom_net_number_of_desktops;
extern Atom _ecore_x_atom_net_virtual_roots;
extern Atom _ecore_x_atom_net_desktop_names;
extern Atom _ecore_x_atom_net_desktop_geometry;
extern Atom _ecore_x_atom_net_workarea;
extern Atom _ecore_x_atom_net_current_desktop;
extern Atom _ecore_x_atom_net_desktop_viewport;
extern Atom _ecore_x_atom_net_showing_desktop;
extern Atom _ecore_x_atom_net_client_list;
extern Atom _ecore_x_atom_net_client_list_stacking;
extern Atom _ecore_x_atom_net_active_window;
extern Atom _ecore_x_atom_net_wm_desktop;
extern Atom _ecore_x_atom_net_wm_state;
extern Atom _ecore_x_atom_net_wm_state_above;
extern Atom _ecore_x_atom_net_wm_state_below;
extern Atom _ecore_x_atom_net_wm_name;
extern Atom _ecore_x_atom_net_wm_visible_name;
extern Atom _ecore_x_atom_net_wm_icon_name;
extern Atom _ecore_x_atom_net_wm_visible_icon_name;
extern Atom _ecore_x_atom_net_wm_desktop;
extern Atom _ecore_x_atom_net_wm_window_type;
extern Atom _ecore_x_atom_net_wm_state;
extern Atom _ecore_x_atom_net_wm_allowed_actions;
extern Atom _ecore_x_atom_net_wm_strut;
extern Atom _ecore_x_atom_net_wm_strut_partial;
extern Atom _ecore_x_atom_net_wm_icon_geometry;
extern Atom _ecore_x_atom_net_wm_icon;
extern Atom _ecore_x_atom_net_wm_pid;
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_window_opacity;
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;
extern Atom _ecore_x_atom_file_name;
extern Atom _ecore_x_atom_string;
extern Atom _ecore_x_atom_text;
extern Atom _ecore_x_atom_compound_text;
extern Atom _ecore_x_atom_selection_primary;
extern Atom _ecore_x_atom_selection_secondary;
extern Atom _ecore_x_atom_selection_clipboard;
extern Atom _ecore_x_atom_selection_prop_primary;
extern Atom _ecore_x_atom_selection_prop_secondary;
extern Atom _ecore_x_atom_selection_prop_clipboard;
extern Atom _ecore_x_atom_selection_xdnd;
extern Atom _ecore_x_atom_selection_prop_xdnd;
extern Atom _ecore_x_atom_xdnd_aware;
extern Atom _ecore_x_atom_xdnd_enter;
extern Atom _ecore_x_atom_xdnd_type_list;
extern Atom _ecore_x_atom_xdnd_position;
extern Atom _ecore_x_atom_xdnd_action_copy;
extern Atom _ecore_x_atom_xdnd_action_private;
extern Atom _ecore_x_atom_xdnd_action_ask;
extern Atom _ecore_x_atom_xdnd_action_list;
extern Atom _ecore_x_atom_xdnd_action_description;
extern Atom _ecore_x_atom_xdnd_status;
extern Atom _ecore_x_atom_xdnd_leave;
extern Atom _ecore_x_atom_xdnd_drop;
extern Atom _ecore_x_atom_xdnd_finished;
extern int _ecore_window_grabs_num; extern int _ecore_window_grabs_num;
extern Window *_ecore_window_grabs; extern Window *_ecore_window_grabs;

View File

@ -1,6 +1,7 @@
#include "Ecore.h" #include "Ecore.h"
#include "ecore_x_private.h" #include "ecore_x_private.h"
#include "Ecore_X.h" #include "Ecore_X.h"
#include "Ecore_X_Atoms.h"
static Ecore_X_Selection_Data selections[3] = {{0}}; static Ecore_X_Selection_Data selections[3] = {{0}};
static Ecore_X_Selection_Data request_data[3] = {{0}}; static Ecore_X_Selection_Data request_data[3] = {{0}};
@ -12,15 +13,15 @@ void
_ecore_x_selection_data_init(void) _ecore_x_selection_data_init(void)
{ {
/* Initialize converters */ /* Initialize converters */
ecore_x_selection_converter_atom_add(_ecore_x_atom_text, ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT,
_ecore_x_selection_converter_text); _ecore_x_selection_converter_text);
#ifdef X_HAVE_UTF8_STRING #ifdef X_HAVE_UTF8_STRING
ecore_x_selection_converter_atom_add(_ecore_x_atom_utf8_string, ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING,
_ecore_x_selection_converter_text); _ecore_x_selection_converter_text);
#endif #endif
ecore_x_selection_converter_atom_add(_ecore_x_atom_compound_text, ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT,
_ecore_x_selection_converter_text); _ecore_x_selection_converter_text);
ecore_x_selection_converter_atom_add(_ecore_x_atom_string, ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING,
_ecore_x_selection_converter_text); _ecore_x_selection_converter_text);
} }
@ -47,11 +48,11 @@ _ecore_x_selection_request_data_get(Ecore_X_Atom selection, void **buf, int *len
{ {
int i; int i;
char *data; char *data;
if (selection == _ecore_x_atom_selection_primary) if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
i = 0; i = 0;
else if (selection == _ecore_x_atom_selection_secondary) else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
i = 1; i = 1;
else if (selection == _ecore_x_atom_selection_clipboard) else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
i = 2; i = 2;
else else
return; return;
@ -81,7 +82,7 @@ _ecore_x_selection_request_data_get(Ecore_X_Atom selection, void **buf, int *len
void void
ecore_x_selection_primary_request_data_get(void **buf, int *len) ecore_x_selection_primary_request_data_get(void **buf, int *len)
{ {
_ecore_x_selection_request_data_get(_ecore_x_atom_selection_primary, _ecore_x_selection_request_data_get(ECORE_X_ATOM_SELECTION_PRIMARY,
buf, len); buf, len);
} }
@ -96,7 +97,7 @@ ecore_x_selection_primary_request_data_get(void **buf, int *len)
void void
ecore_x_selection_secondary_request_data_get(void **buf, int *len) ecore_x_selection_secondary_request_data_get(void **buf, int *len)
{ {
_ecore_x_selection_request_data_get(_ecore_x_atom_selection_secondary, _ecore_x_selection_request_data_get(ECORE_X_ATOM_SELECTION_SECONDARY,
buf, len); buf, len);
} }
@ -111,7 +112,7 @@ ecore_x_selection_secondary_request_data_get(void **buf, int *len)
void void
ecore_x_selection_clipboard_request_data_get(void **buf, int *len) ecore_x_selection_clipboard_request_data_get(void **buf, int *len)
{ {
_ecore_x_selection_request_data_get(_ecore_x_atom_selection_clipboard, _ecore_x_selection_request_data_get(ECORE_X_ATOM_SELECTION_CLIPBOARD,
buf, len); buf, len);
} }
@ -119,11 +120,11 @@ void
_ecore_x_selection_request_data_set(Ecore_X_Selection_Data data) _ecore_x_selection_request_data_set(Ecore_X_Selection_Data data)
{ {
int i; int i;
if (data.selection == _ecore_x_atom_selection_primary) if (data.selection == ECORE_X_ATOM_SELECTION_PRIMARY)
i = 0; i = 0;
else if (data.selection == _ecore_x_atom_selection_secondary) else if (data.selection == ECORE_X_ATOM_SELECTION_SECONDARY)
i = 1; i = 1;
else if (data.selection == _ecore_x_atom_selection_clipboard) else if (data.selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
i = 2; i = 2;
else else
return; return;
@ -134,11 +135,11 @@ _ecore_x_selection_request_data_set(Ecore_X_Selection_Data data)
Ecore_X_Selection_Data * Ecore_X_Selection_Data *
_ecore_x_selection_get(Atom selection) _ecore_x_selection_get(Atom selection)
{ {
if (selection == _ecore_x_atom_selection_primary) if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
return &selections[0]; return &selections[0];
else if (selection == _ecore_x_atom_selection_secondary) else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
return &selections[1]; return &selections[1];
else if (selection == _ecore_x_atom_selection_clipboard) else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
return &selections[2]; return &selections[2];
else else
return NULL; return NULL;
@ -154,9 +155,9 @@ _ecore_x_selection_set(Window w, unsigned char *data, int size, Atom selection)
if (XGetSelectionOwner(_ecore_x_disp, selection) != w) if (XGetSelectionOwner(_ecore_x_disp, selection) != w)
return 0; return 0;
if (selection == _ecore_x_atom_selection_primary) if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
in = 0; in = 0;
else if (selection == _ecore_x_atom_selection_secondary) else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
in = 1; in = 1;
else else
in = 2; in = 2;
@ -198,7 +199,7 @@ _ecore_x_selection_set(Window w, unsigned char *data, int size, Atom selection)
int int
ecore_x_selection_primary_set(Ecore_X_Window w, unsigned char *data, int size) ecore_x_selection_primary_set(Ecore_X_Window w, unsigned char *data, int size)
{ {
return _ecore_x_selection_set(w, data, size, _ecore_x_atom_selection_primary); return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_PRIMARY);
} }
/** /**
@ -210,7 +211,7 @@ ecore_x_selection_primary_set(Ecore_X_Window w, unsigned char *data, int size)
int int
ecore_x_selection_primary_clear(void) ecore_x_selection_primary_clear(void)
{ {
return _ecore_x_selection_set(None, NULL, 0, _ecore_x_atom_selection_primary); return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_PRIMARY);
} }
/** /**
@ -227,7 +228,7 @@ ecore_x_selection_primary_clear(void)
int int
ecore_x_selection_secondary_set(Ecore_X_Window w, unsigned char *data, int size) ecore_x_selection_secondary_set(Ecore_X_Window w, unsigned char *data, int size)
{ {
return _ecore_x_selection_set(w, data, size, _ecore_x_atom_selection_secondary); return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_SECONDARY);
} }
/** /**
@ -239,7 +240,7 @@ ecore_x_selection_secondary_set(Ecore_X_Window w, unsigned char *data, int size)
int int
ecore_x_selection_secondary_clear(void) ecore_x_selection_secondary_clear(void)
{ {
return _ecore_x_selection_set(None, NULL, 0, _ecore_x_atom_selection_secondary); return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_SECONDARY);
} }
/** /**
@ -256,7 +257,7 @@ ecore_x_selection_secondary_clear(void)
int int
ecore_x_selection_clipboard_set(Ecore_X_Window w, unsigned char *data, int size) ecore_x_selection_clipboard_set(Ecore_X_Window w, unsigned char *data, int size)
{ {
return _ecore_x_selection_set(w, data, size, _ecore_x_atom_selection_clipboard); return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_CLIPBOARD);
} }
/** /**
@ -268,7 +269,7 @@ ecore_x_selection_clipboard_set(Ecore_X_Window w, unsigned char *data, int size)
int int
ecore_x_selection_clipboard_clear(void) ecore_x_selection_clipboard_clear(void)
{ {
return _ecore_x_selection_set(None, NULL, 0, _ecore_x_atom_selection_clipboard); return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_CLIPBOARD);
} }
Atom Atom
@ -277,15 +278,15 @@ _ecore_x_selection_target_atom_get(char *target)
Atom x_target; Atom x_target;
if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT)) if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT))
x_target = _ecore_x_atom_text; x_target = ECORE_X_ATOM_TEXT;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT)) else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
x_target = _ecore_x_atom_compound_text; x_target = ECORE_X_ATOM_COMPOUND_TEXT;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING)) else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
x_target = _ecore_x_atom_string; x_target = ECORE_X_ATOM_STRING;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING)) else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
x_target = _ecore_x_atom_utf8_string; x_target = ECORE_X_ATOM_UTF8_STRING;
else if (!strcmp(target, ECORE_X_SELECTION_TARGET_FILENAME)) else if (!strcmp(target, ECORE_X_SELECTION_TARGET_FILENAME))
x_target = _ecore_x_atom_file_name; x_target = ECORE_X_ATOM_FILE_NAME;
else else
{ {
char *atom_name; char *atom_name;
@ -301,13 +302,13 @@ _ecore_x_selection_target_atom_get(char *target)
char * char *
_ecore_x_selection_target_get(Atom target) _ecore_x_selection_target_get(Atom target)
{ {
if (target == _ecore_x_atom_file_name) if (target == ECORE_X_ATOM_FILE_NAME)
return strdup(ECORE_X_SELECTION_TARGET_FILENAME); return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
else if (target == _ecore_x_atom_string) else if (target == ECORE_X_ATOM_STRING)
return strdup(ECORE_X_SELECTION_TARGET_STRING); return strdup(ECORE_X_SELECTION_TARGET_STRING);
else if (target == _ecore_x_atom_utf8_string) else if (target == ECORE_X_ATOM_UTF8_STRING)
return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING); return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING);
else if (target == _ecore_x_atom_text) else if (target == ECORE_X_ATOM_TEXT)
return strdup(ECORE_X_SELECTION_TARGET_TEXT); return strdup(ECORE_X_SELECTION_TARGET_TEXT);
else else
return strdup(ECORE_X_SELECTION_TARGET_TEXT); return strdup(ECORE_X_SELECTION_TARGET_TEXT);
@ -320,14 +321,14 @@ _ecore_x_selection_request(Ecore_X_Window w, Ecore_X_Atom selection, char *targe
target = _ecore_x_selection_target_atom_get(target_str); target = _ecore_x_selection_target_atom_get(target_str);
if (selection == _ecore_x_atom_selection_primary) if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
prop = _ecore_x_atom_selection_prop_primary; prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY;
else if (selection == _ecore_x_atom_selection_secondary) else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
prop = _ecore_x_atom_selection_prop_secondary; prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY;
else if (selection == _ecore_x_atom_selection_xdnd) else if (selection == ECORE_X_ATOM_SELECTION_XDND)
prop = _ecore_x_atom_selection_prop_xdnd; prop = ECORE_X_ATOM_SELECTION_PROP_XDND;
else else
prop = _ecore_x_atom_selection_prop_clipboard; prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD;
XConvertSelection(_ecore_x_disp, selection, target, prop, XConvertSelection(_ecore_x_disp, selection, target, prop,
w, _ecore_x_event_last_time); w, _ecore_x_event_last_time);
@ -336,19 +337,19 @@ _ecore_x_selection_request(Ecore_X_Window w, Ecore_X_Atom selection, char *targe
void void
ecore_x_selection_primary_request(Ecore_X_Window w, char *target) ecore_x_selection_primary_request(Ecore_X_Window w, char *target)
{ {
_ecore_x_selection_request(w, _ecore_x_atom_selection_primary, target); _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_PRIMARY, target);
} }
void void
ecore_x_selection_secondary_request(Ecore_X_Window w, char *target) ecore_x_selection_secondary_request(Ecore_X_Window w, char *target)
{ {
_ecore_x_selection_request(w, _ecore_x_atom_selection_secondary, target); _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_SECONDARY, target);
} }
void void
ecore_x_selection_clipboard_request(Ecore_X_Window w, char *target) ecore_x_selection_clipboard_request(Ecore_X_Window w, char *target)
{ {
_ecore_x_selection_request(w, _ecore_x_atom_selection_clipboard, target); _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_CLIPBOARD, target);
} }
void void
@ -410,9 +411,9 @@ ecore_x_selection_converter_atom_del(Ecore_X_Atom target)
{ {
if (cnv->target == target) if (cnv->target == target)
{ {
if (target == _ecore_x_atom_text || if (target == ECORE_X_ATOM_TEXT ||
target == _ecore_x_atom_compound_text || target == ECORE_X_ATOM_COMPOUND_TEXT ||
target == _ecore_x_atom_string) target == ECORE_X_ATOM_STRING)
{ {
cnv->convert = _ecore_x_selection_converter_text; cnv->convert = _ecore_x_selection_converter_text;
} }

View File

@ -5,6 +5,7 @@
#include "Ecore.h" #include "Ecore.h"
#include "ecore_x_private.h" #include "ecore_x_private.h"
#include "Ecore_X.h" #include "Ecore_X.h"
#include "Ecore_X_Atoms.h"
/** /**
* @defgroup Ecore_X_Window_Create_Group X Window Creation Functions * @defgroup Ecore_X_Window_Create_Group X Window Creation Functions
@ -208,7 +209,7 @@ ecore_x_window_defaults_set(Ecore_X_Window win)
hostname[0] = buf; hostname[0] = buf;
/* The ecore function uses UTF8 which Xlib may not like (especially /* The ecore function uses UTF8 which Xlib may not like (especially
* with older clients) */ * with older clients) */
/* ecore_x_window_prop_string_set(win, _ecore_x_atom_wm_client_machine, /* ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_CLIENT_MACHINE,
(char *)buf); */ (char *)buf); */
if (XStringListToTextProperty(hostname, 1, &xprop)) if (XStringListToTextProperty(hostname, 1, &xprop))
{ {
@ -220,7 +221,7 @@ ecore_x_window_defaults_set(Ecore_X_Window win)
* Set _NET_WM_PID * Set _NET_WM_PID
*/ */
pid = getpid(); pid = getpid();
ecore_x_window_prop_property_set(win, _ecore_x_atom_net_wm_pid, XA_CARDINAL, ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_PID, XA_CARDINAL,
32, &pid, 1); 32, &pid, 1);
ecore_x_window_prop_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL); ecore_x_window_prop_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
@ -292,9 +293,9 @@ ecore_x_window_delete_request_send(Ecore_X_Window win)
xev.xclient.type = ClientMessage; xev.xclient.type = ClientMessage;
xev.xclient.display = _ecore_x_disp; xev.xclient.display = _ecore_x_disp;
xev.xclient.window = win; xev.xclient.window = win;
xev.xclient.message_type = _ecore_x_atom_wm_protocols; xev.xclient.message_type = ECORE_X_ATOM_WM_PROTOCOLS;
xev.xclient.format = 32; xev.xclient.format = 32;
xev.xclient.data.l[0] = _ecore_x_atom_wm_delete_window; xev.xclient.data.l[0] = ECORE_X_ATOM_WM_DELETE_WINDOW;
xev.xclient.data.l[1] = CurrentTime; xev.xclient.data.l[1] = CurrentTime;
XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev); XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);

View File

@ -5,6 +5,7 @@
#include "Ecore.h" #include "Ecore.h"
#include "ecore_x_private.h" #include "ecore_x_private.h"
#include "Ecore_X.h" #include "Ecore_X.h"
#include "Ecore_X_Atoms.h"
#include <inttypes.h> #include <inttypes.h>
#include <limits.h> #include <limits.h>
@ -164,7 +165,7 @@ ecore_x_window_prop_string_set(Ecore_X_Window win, Ecore_X_Atom type, char *str)
if (win == 0) win = DefaultRootWindow(_ecore_x_disp); if (win == 0) win = DefaultRootWindow(_ecore_x_disp);
xtp.value = str; xtp.value = str;
xtp.format = 8; xtp.format = 8;
xtp.encoding = _ecore_x_atom_utf8_string; xtp.encoding = ECORE_X_ATOM_UTF8_STRING;
xtp.nitems = strlen(str); xtp.nitems = strlen(str);
XSetTextProperty(_ecore_x_disp, win, &xtp, type); XSetTextProperty(_ecore_x_disp, win, &xtp, type);
} }
@ -227,14 +228,14 @@ ecore_x_window_prop_title_set(Ecore_X_Window win, const char *t)
/* Xlib may not like the UTF8 String */ /* Xlib may not like the UTF8 String */
/* FIXME convert utf8 to whatever encoding xlib prefers */ /* FIXME convert utf8 to whatever encoding xlib prefers */
/* ecore_x_window_prop_string_set(win, _ecore_x_atom_wm_name, (char *)t); */ /* ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_NAME, (char *)t); */
if (XStringListToTextProperty(list, 1, &xprop)) if (XStringListToTextProperty(list, 1, &xprop))
{ {
XSetWMName(_ecore_x_disp, win, &xprop); XSetWMName(_ecore_x_disp, win, &xprop);
XFree(xprop.value); XFree(xprop.value);
} }
ecore_x_window_prop_string_set(win, _ecore_x_atom_net_wm_name, (char *)t); ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_NAME, (char *)t);
} }
/** /**
@ -249,8 +250,8 @@ ecore_x_window_prop_title_get(Ecore_X_Window win)
{ {
char *title; char *title;
/* title = ecore_x_window_prop_string_get(win, _ecore_x_atom_net_wm_name);*/ /* title = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_NET_WM_NAME);*/
title = ecore_x_window_prop_string_get(win, _ecore_x_atom_wm_name); title = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_NAME);
return title; return title;
} }
@ -298,7 +299,7 @@ ecore_x_window_prop_command_get(Ecore_X_Window win, int *argc, char ***argv)
void void
ecore_x_window_prop_visible_title_set(Ecore_X_Window win, const char *t) ecore_x_window_prop_visible_title_set(Ecore_X_Window win, const char *t)
{ {
ecore_x_window_prop_string_set(win, _ecore_x_atom_net_wm_visible_name, ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_NAME,
(char *)t); (char *)t);
} }
@ -314,7 +315,7 @@ ecore_x_window_prop_visible_title_get(Ecore_X_Window win)
{ {
char *title; char *title;
title = ecore_x_window_prop_string_get(win, _ecore_x_atom_net_wm_visible_name); title = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_NET_WM_VISIBLE_NAME);
return title; return title;
} }
@ -330,8 +331,8 @@ ecore_x_window_prop_visible_title_get(Ecore_X_Window win)
void void
ecore_x_window_prop_icon_name_set(Ecore_X_Window win, const char *t) ecore_x_window_prop_icon_name_set(Ecore_X_Window win, const char *t)
{ {
ecore_x_window_prop_string_set(win, _ecore_x_atom_wm_icon_name, (char *)t); ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_ICON_NAME, (char *)t);
ecore_x_window_prop_string_set(win, _ecore_x_atom_net_wm_icon_name, ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME,
(char *)t); (char *)t);
} }
@ -348,8 +349,8 @@ ecore_x_window_prop_icon_name_get(Ecore_X_Window win)
{ {
char *name; char *name;
name = ecore_x_window_prop_string_get(win, _ecore_x_atom_net_wm_icon_name); name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_NET_WM_ICON_NAME);
if (!name) name = ecore_x_window_prop_string_get(win, _ecore_x_atom_wm_icon_name); if (!name) name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_ICON_NAME);
return name; return name;
} }
@ -363,7 +364,7 @@ ecore_x_window_prop_icon_name_get(Ecore_X_Window win)
void void
ecore_x_window_prop_visible_icon_name_set(Ecore_X_Window win, const char *t) ecore_x_window_prop_visible_icon_name_set(Ecore_X_Window win, const char *t)
{ {
ecore_x_window_prop_string_set(win, _ecore_x_atom_net_wm_visible_icon_name, ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME,
(char *)t); (char *)t);
} }
@ -379,7 +380,7 @@ ecore_x_window_prop_visible_icon_name_get(Ecore_X_Window win)
{ {
char *name; char *name;
name = ecore_x_window_prop_string_get(win, _ecore_x_atom_net_wm_visible_icon_name); name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME);
return name; return name;
} }
@ -396,7 +397,7 @@ ecore_x_window_prop_client_machine_get(Ecore_X_Window win)
{ {
char *name; char *name;
name = ecore_x_window_prop_string_get(win, _ecore_x_atom_wm_client_machine); name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_CLIENT_MACHINE);
return name; return name;
} }
@ -414,7 +415,7 @@ ecore_x_window_prop_pid_get(Ecore_X_Window win)
pid_t pid = 0; pid_t pid = 0;
unsigned char *tmp = NULL; unsigned char *tmp = NULL;
ecore_x_window_prop_property_get(win, _ecore_x_atom_net_wm_pid, XA_CARDINAL, ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_PID, XA_CARDINAL,
32, &tmp, &num); 32, &tmp, &num);
if ((num) && (tmp)) if ((num) && (tmp))
{ {
@ -543,7 +544,7 @@ ecore_x_window_prop_protocol_set(Ecore_X_Window win,
protos_count - 1); protos_count - 1);
else else
XDeleteProperty(_ecore_x_disp, win, XDeleteProperty(_ecore_x_disp, win,
_ecore_x_atom_wm_protocols); ECORE_X_ATOM_WM_PROTOCOLS);
goto leave; goto leave;
} }
} }
@ -734,19 +735,19 @@ ecore_x_window_prop_sticky_set(Ecore_X_Window win, int on)
unsigned char *data = NULL; unsigned char *data = NULL;
if (on) { if (on) {
ecore_x_window_prop_property_set(win, _ecore_x_atom_net_wm_desktop, ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_DESKTOP,
XA_CARDINAL, 32, &val, 1); XA_CARDINAL, 32, &val, 1);
ecore_x_window_prop_state_set(win, ECORE_X_WINDOW_STATE_STICKY); ecore_x_window_prop_state_set(win, ECORE_X_WINDOW_STATE_STICKY);
return; return;
} }
ecore_x_window_prop_state_unset(win, ECORE_X_WINDOW_STATE_STICKY); ecore_x_window_prop_state_unset(win, ECORE_X_WINDOW_STATE_STICKY);
ret = ecore_x_window_prop_property_get(0, _ecore_x_atom_net_current_desktop, ret = ecore_x_window_prop_property_get(0, ECORE_X_ATOM_NET_CURRENT_DESKTOP,
XA_CARDINAL, 32, &data, &num); XA_CARDINAL, 32, &data, &num);
if (!ret || !num) if (!ret || !num)
return; return;
ecore_x_window_prop_property_set(win, _ecore_x_atom_net_wm_desktop, ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_DESKTOP,
XA_CARDINAL, 32, data, 1); XA_CARDINAL, 32, data, 1);
free(data); free(data);
} }
@ -836,8 +837,8 @@ ecore_x_window_prop_borderless_set(Ecore_X_Window win, int borderless)
data[2] = !borderless; data[2] = !borderless;
ecore_x_window_prop_property_set(win, ecore_x_window_prop_property_set(win,
_ecore_x_atom_motif_wm_hints, ECORE_X_ATOM_MOTIF_WM_HINTS,
_ecore_x_atom_motif_wm_hints, ECORE_X_ATOM_MOTIF_WM_HINTS,
32, (void *)data, 5); 32, (void *)data, 5);
} }
@ -854,8 +855,8 @@ ecore_x_window_prop_borderless_get(Ecore_X_Window win)
int borderless = 0; int borderless = 0;
ecore_x_window_prop_property_get(win, ecore_x_window_prop_property_get(win,
_ecore_x_atom_motif_wm_hints, ECORE_X_ATOM_MOTIF_WM_HINTS,
_ecore_x_atom_motif_wm_hints, ECORE_X_ATOM_MOTIF_WM_HINTS,
32, &data, &num); 32, &data, &num);
/* check for valid data. only read the borderless flag if the /* check for valid data. only read the borderless flag if the
@ -904,7 +905,7 @@ ecore_x_window_prop_layer_set(Ecore_X_Window win, int layer)
} }
/* set the gnome atom */ /* set the gnome atom */
ecore_x_window_prop_property_set(win, _ecore_x_atom_win_layer, ecore_x_window_prop_property_set(win, ECORE_X_ATOM_WIN_LAYER,
XA_CARDINAL, 32, &layer, 1); XA_CARDINAL, 32, &layer, 1);
return 1; return 1;
@ -956,7 +957,7 @@ ecore_x_window_prop_desktop_request(Ecore_X_Window win, long desktop)
xev.xclient.type = ClientMessage; xev.xclient.type = ClientMessage;
xev.xclient.display = _ecore_x_disp; xev.xclient.display = _ecore_x_disp;
xev.xclient.window = win; xev.xclient.window = win;
xev.xclient.message_type = _ecore_x_atom_net_wm_desktop; xev.xclient.message_type = ECORE_X_ATOM_NET_WM_DESKTOP;
xev.xclient.format = 32; xev.xclient.format = 32;
xev.xclient.data.l[0] = desktop; xev.xclient.data.l[0] = desktop;
@ -998,11 +999,11 @@ ecore_x_window_prop_state_request(Ecore_X_Window win, Ecore_X_Window_State state
} }
if (action != 1) if (action != 1)
return; return;
xev.xclient.message_type = _ecore_x_atom_wm_change_state; xev.xclient.message_type = ECORE_X_ATOM_WM_CHANGE_STATE;
xev.xclient.data.l[0] = IconicState; xev.xclient.data.l[0] = IconicState;
break; break;
default: /* The _NET_WM_STATE_... hints */ default: /* The _NET_WM_STATE_... hints */
xev.xclient.message_type = _ecore_x_atom_net_wm_state; xev.xclient.message_type = ECORE_X_ATOM_NET_WM_STATE;
xev.xclient.data.l[0] = action; xev.xclient.data.l[0] = action;
xev.xclient.data.l[1] = _ecore_x_window_prop_state_atom_get(state); xev.xclient.data.l[1] = _ecore_x_window_prop_state_atom_get(state);
break; break;
@ -1023,7 +1024,7 @@ ecore_x_window_prop_state_request(Ecore_X_Window win, Ecore_X_Window_State state
void void
ecore_x_window_prop_desktop_set(Ecore_X_Window win, long desktop) 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, ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_DESKTOP,
XA_CARDINAL, 32, &desktop, 1); XA_CARDINAL, 32, &desktop, 1);
} }
@ -1040,7 +1041,7 @@ ecore_x_window_prop_desktop_get(Ecore_X_Window win)
unsigned char *tmp; unsigned char *tmp;
long desktop = -1; long desktop = -1;
ecore_x_window_prop_property_get(win, _ecore_x_atom_net_wm_desktop, ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_DESKTOP,
XA_CARDINAL, 32, &tmp, &num); XA_CARDINAL, 32, &tmp, &num);
if ((tmp) && (num)) if ((tmp) && (num))
{ {
@ -1058,21 +1059,21 @@ _ecore_x_window_prop_type_atom_get(Ecore_X_Window_Type type)
switch (type) switch (type)
{ {
case ECORE_X_WINDOW_TYPE_DESKTOP: case ECORE_X_WINDOW_TYPE_DESKTOP:
return _ecore_x_atom_net_wm_window_type_desktop; return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP;
case ECORE_X_WINDOW_TYPE_DOCK: case ECORE_X_WINDOW_TYPE_DOCK:
return _ecore_x_atom_net_wm_window_type_dock; return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK;
case ECORE_X_WINDOW_TYPE_TOOLBAR: case ECORE_X_WINDOW_TYPE_TOOLBAR:
return _ecore_x_atom_net_wm_window_type_toolbar; return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR;
case ECORE_X_WINDOW_TYPE_MENU: case ECORE_X_WINDOW_TYPE_MENU:
return _ecore_x_atom_net_wm_window_type_menu; return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU;
case ECORE_X_WINDOW_TYPE_UTILITY: case ECORE_X_WINDOW_TYPE_UTILITY:
return _ecore_x_atom_net_wm_window_type_utility; return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY;
case ECORE_X_WINDOW_TYPE_SPLASH: case ECORE_X_WINDOW_TYPE_SPLASH:
return _ecore_x_atom_net_wm_window_type_splash; return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH;
case ECORE_X_WINDOW_TYPE_DIALOG: case ECORE_X_WINDOW_TYPE_DIALOG:
return _ecore_x_atom_net_wm_window_type_dialog; return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG;
case ECORE_X_WINDOW_TYPE_NORMAL: case ECORE_X_WINDOW_TYPE_NORMAL:
return _ecore_x_atom_net_wm_window_type_normal; return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL;
default: default:
return 0; return 0;
} }
@ -1092,7 +1093,7 @@ ecore_x_window_prop_window_type_set(Ecore_X_Window win, Ecore_X_Window_Type type
a = _ecore_x_window_prop_type_atom_get(type); a = _ecore_x_window_prop_type_atom_get(type);
if (a) if (a)
ecore_x_window_prop_property_set(win, _ecore_x_atom_net_wm_window_type, ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
XA_ATOM, 32, (unsigned char*)&a, 1); XA_ATOM, 32, (unsigned char*)&a, 1);
} }
@ -1112,7 +1113,7 @@ ecore_x_window_prop_window_type_set(Ecore_X_Window win, Ecore_X_Atom type)
unsigned char *data = NULL; unsigned char *data = NULL;
if (ecore_x_window_prop_property_get(win, if (ecore_x_window_prop_property_get(win,
_ecore_x_atom_net_wm_window_type, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
XA_ATOM, 32, &data, &num)) XA_ATOM, 32, &data, &num))
XFree(data); XFree(data);
@ -1121,7 +1122,7 @@ ecore_x_window_prop_window_type_set(Ecore_X_Window win, Ecore_X_Atom type)
{ {
((Atom *)data)[0] = type; ((Atom *)data)[0] = type;
ecore_x_window_prop_property_set(win, ecore_x_window_prop_property_set(win,
_ecore_x_atom_net_wm_window_type, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
XA_ATOM, 32, data, 1); XA_ATOM, 32, data, 1);
} }
free(data); free(data);
@ -1134,27 +1135,27 @@ _ecore_x_window_prop_state_atom_get(Ecore_X_Window_State s)
switch(s) switch(s)
{ {
case ECORE_X_WINDOW_STATE_MODAL: case ECORE_X_WINDOW_STATE_MODAL:
return _ecore_x_atom_net_wm_state_modal; return ECORE_X_ATOM_NET_WM_STATE_MODAL;
case ECORE_X_WINDOW_STATE_STICKY: case ECORE_X_WINDOW_STATE_STICKY:
return _ecore_x_atom_net_wm_state_sticky; return ECORE_X_ATOM_NET_WM_STATE_STICKY;
case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT: case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
return _ecore_x_atom_net_wm_state_maximized_vert; return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT;
case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ: case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
return _ecore_x_atom_net_wm_state_maximized_horz; return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ;
case ECORE_X_WINDOW_STATE_SHADED: case ECORE_X_WINDOW_STATE_SHADED:
return _ecore_x_atom_net_wm_state_shaded; return ECORE_X_ATOM_NET_WM_STATE_SHADED;
case ECORE_X_WINDOW_STATE_SKIP_TASKBAR: case ECORE_X_WINDOW_STATE_SKIP_TASKBAR:
return _ecore_x_atom_net_wm_state_skip_taskbar; return ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR;
case ECORE_X_WINDOW_STATE_SKIP_PAGER: case ECORE_X_WINDOW_STATE_SKIP_PAGER:
return _ecore_x_atom_net_wm_state_skip_pager; return ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
case ECORE_X_WINDOW_STATE_HIDDEN: case ECORE_X_WINDOW_STATE_HIDDEN:
return _ecore_x_atom_net_wm_state_skip_pager; return ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
case ECORE_X_WINDOW_STATE_FULLSCREEN: case ECORE_X_WINDOW_STATE_FULLSCREEN:
return _ecore_x_atom_net_wm_state_fullscreen; return ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
case ECORE_X_WINDOW_STATE_ABOVE: case ECORE_X_WINDOW_STATE_ABOVE:
return _ecore_x_atom_net_wm_state_above; return ECORE_X_ATOM_NET_WM_STATE_ABOVE;
case ECORE_X_WINDOW_STATE_BELOW: case ECORE_X_WINDOW_STATE_BELOW:
return _ecore_x_atom_net_wm_state_below; return ECORE_X_ATOM_NET_WM_STATE_BELOW;
default: default:
return 0; return 0;
} }
@ -1179,7 +1180,7 @@ ecore_x_window_prop_state_set(Ecore_X_Window win, Ecore_X_Window_State s)
state = _ecore_x_window_prop_state_atom_get(s); state = _ecore_x_window_prop_state_atom_get(s);
ecore_x_window_prop_property_get(win, _ecore_x_atom_net_wm_state, ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_STATE,
XA_ATOM, 32, &old_data, &num); XA_ATOM, 32, &old_data, &num);
oldset = (Atom *) old_data; oldset = (Atom *) old_data;
newset = calloc(num + 1, sizeof(Atom)); newset = calloc(num + 1, sizeof(Atom));
@ -1200,7 +1201,7 @@ ecore_x_window_prop_state_set(Ecore_X_Window win, Ecore_X_Window_State s)
newset[num] = state; newset[num] = state;
ecore_x_window_prop_property_set(win, _ecore_x_atom_net_wm_state, ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_STATE,
XA_ATOM, 32, data, num + 1); XA_ATOM, 32, data, num + 1);
XFree(old_data); XFree(old_data);
free(data); free(data);
@ -1224,7 +1225,7 @@ ecore_x_window_prop_state_isset(Ecore_X_Window win, Ecore_X_Window_State s)
Ecore_X_Atom state; Ecore_X_Atom state;
state = _ecore_x_window_prop_state_atom_get(s); state = _ecore_x_window_prop_state_atom_get(s);
if (!ecore_x_window_prop_property_get(win, _ecore_x_atom_net_wm_state, if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_STATE,
XA_ATOM, 32, &data, &num)) XA_ATOM, 32, &data, &num))
return ret; return ret;
@ -1267,7 +1268,7 @@ ecore_x_window_prop_state_unset(Ecore_X_Window win, Ecore_X_Window_State s)
return; return;
} }
ecore_x_window_prop_property_get(win, _ecore_x_atom_net_wm_state, ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_STATE,
XA_ATOM, 32, &old_data, &num); XA_ATOM, 32, &old_data, &num);
oldset = (Atom *) old_data; oldset = (Atom *) old_data;
newset = calloc(num - 1, sizeof(Atom)); newset = calloc(num - 1, sizeof(Atom));
@ -1276,7 +1277,7 @@ ecore_x_window_prop_state_unset(Ecore_X_Window win, Ecore_X_Window_State s)
if (oldset[i] != state) if (oldset[i] != state)
newset[j++] = oldset[i]; newset[j++] = oldset[i];
ecore_x_window_prop_property_set(win, _ecore_x_atom_net_wm_state, ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_STATE,
XA_ATOM, 32, data, j); XA_ATOM, 32, data, j);
XFree(oldset); XFree(oldset);
free(newset); free(newset);
@ -1286,7 +1287,7 @@ ecore_x_window_prop_state_unset(Ecore_X_Window win, Ecore_X_Window_State s)
void void
ecore_x_window_prop_window_type_utility_set(Ecore_X_Window win) ecore_x_window_prop_window_type_utility_set(Ecore_X_Window win)
{ {
ecore_x_window_prop_window_type_set(win, _ecore_x_atom_net_wm_window_type_utility); ecore_x_window_prop_window_type_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY);
} }
/** /**
@ -1298,7 +1299,7 @@ ecore_x_window_prop_window_type_utility_set(Ecore_X_Window win)
void void
ecore_x_window_prop_window_type_splash_set(Ecore_X_Window win) ecore_x_window_prop_window_type_splash_set(Ecore_X_Window win)
{ {
ecore_x_window_prop_window_type_set(win, _ecore_x_atom_net_wm_window_type_splash); ecore_x_window_prop_window_type_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH);
} }
/** /**
@ -1310,7 +1311,7 @@ ecore_x_window_prop_window_type_splash_set(Ecore_X_Window win)
void void
ecore_x_window_prop_window_type_dialog_set(Ecore_X_Window win) ecore_x_window_prop_window_type_dialog_set(Ecore_X_Window win)
{ {
ecore_x_window_prop_window_type_set(win, _ecore_x_atom_net_wm_window_type_dialog); ecore_x_window_prop_window_type_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG);
} }
/** /**
@ -1322,7 +1323,7 @@ ecore_x_window_prop_window_type_dialog_set(Ecore_X_Window win)
void void
ecore_x_window_prop_window_type_normal_set(Ecore_X_Window win) ecore_x_window_prop_window_type_normal_set(Ecore_X_Window win)
{ {
ecore_x_window_prop_window_type_set(win, _ecore_x_atom_net_wm_window_type_normal); ecore_x_window_prop_window_type_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL);
} }
#endif #endif
@ -1349,7 +1350,7 @@ void ecore_x_window_prop_window_opacity_set(Ecore_X_Window win, int opacity)
tmp = (double) opacity/255. * 4294967295.; tmp = (double) opacity/255. * 4294967295.;
o_val = (unsigned long) tmp; o_val = (unsigned long) tmp;
ecore_x_window_prop_property_set(win, _ecore_x_atom_net_wm_window_opacity, ecore_x_window_prop_property_set(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
XA_CARDINAL, 32, &o_val, 1); XA_CARDINAL, 32, &o_val, 1);
} }
@ -1366,7 +1367,7 @@ int ecore_x_window_prop_window_opacity_get(Ecore_X_Window win)
int ret_val = -1; int ret_val = -1;
int num; int num;
if(ecore_x_window_prop_property_get(win, _ecore_x_atom_net_wm_window_opacity, if(ecore_x_window_prop_property_get(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
XA_CARDINAL, 32, &data, &num)) XA_CARDINAL, 32, &data, &num))
{ {
if (data && num) if (data && num)