Here is ecore_x with XCB backend.

* The XCB backend is disabled by default during the
   configuration. To enable it, add --enable-ecore-x-xcb. See the
   messages that configure displays when it finishes.
 * The way XCB is detected, and used in src/lib/ecore_x/Makefile.am
   should be improved
 * Any program that uses ecore_evas does not need to be modified.
   Any program that uses ecore_x may need some changes. That is,
   adding some functions (_prefetch and _fetch ones). No other
   change is needed. See the documention of any _get functions, as
   these are the ones that need those functions.
 * There are some missing parts, especially everything that involves
   the keyboard, as porting Xlib functions related to strings (utf8
   stuff, XKeysymToString, etc...) is an horror. So keyboard events
   are not working yet.
 * I tried to write as much documentation as I could. But there is
   certainly some missing doc here and there.

there are certainly other things that I have forgotten.

Improvements of that backend:
 * the creation of an ecore_evas is faster. Especially when done over
   an ssh connection (on my computer, 7-10s with Xlib, 1.5s with XCB,
   over an ssh)
 * A Window Manager should be more responsive. But it's not tomorrow
   that e17 will use it :)

Have fun !


SVN revision: 29500
This commit is contained in:
doursse 2007-04-13 17:15:19 +00:00 committed by doursse
parent 5e20d74ef1
commit 61543a8933
31 changed files with 19155 additions and 223 deletions

View File

@ -142,11 +142,92 @@ AC_SUBST(iconv_libs)
ECORE_CHECK_MODULE([Txt], [yes], [$have_iconv],
[ecore_txt_libs="$ecore_txt_libs $iconv_libs"])
dnl Check for XCB
have_ecore_x="no"
have_ecore_x_xcb="no"
AC_ARG_ENABLE(ecore-x-xcb,
AC_HELP_STRING(
[--enable-ecore-x-xcb],
[enable the ecore_x module with XCB backend. [[default=disabled]]]),
[ want_ecore_x_xcb=$enableval ],
[ want_ecore_x_xcb="no" ])
AC_MSG_CHECKING(whether ecore_x with XCB backend is to be built)
AC_MSG_RESULT($want_ecore_x_xcb)
if test "x$want_ecore_x_xcb" = "xyes" ; then
PKG_CHECK_MODULES(XCB, xcb xcb-icccm xcb-image xcb-keysyms,
[ have_ecore_x_xcb="yes" ],
[ have_ecore_x_xcb="no" ])
if test "x$have_ecore_x_xcb" = "xyes" ; then
PKG_CHECK_MODULES(XCB_DAMAGE, xcb-damage,
[ have_ecore_x_xcb_damage="yes"
AC_DEFINE(ECORE_XCB_DAMAGE, 1, [Build support for XCB damage]) ],
[ have_ecore_x_xcb_damage="no" ])
PKG_CHECK_MODULES(XCB_DPMS, xcb-dpms,
[ have_ecore_x_xcb_dpms="yes"
AC_DEFINE(ECORE_XCB_DPMS, 1, [Build support for XCB dpms]) ],
[ have_ecore_x_xcb_dpms="no" ])
PKG_CHECK_MODULES(XCB_RANDR, xcb-randr,
[ have_ecore_x_xcb_randr="yes"
AC_DEFINE(ECORE_XCB_RANDR, 1, [Build support for XCB randr]) ],
[ have_ecore_x_xcb_randr="no" ])
PKG_CHECK_MODULES(XCB_RENDER, xcb-render,
[ have_ecore_x_xcb_render="yes"
AC_DEFINE(ECORE_XCB_RENDER, 1, [Build support for XCB render]) ],
[ have_ecore_x_xcb_render="no" ])
PKG_CHECK_MODULES(XCB_SCREENSAVER, xcb-screensaver,
[ have_ecore_x_xcb_screensaver="yes"
AC_DEFINE(ECORE_XCB_SCREENSAVER, 1, [Build support for XCB screensaver]) ],
[ have_ecore_x_xcb_screensaver="no" ])
PKG_CHECK_MODULES(XCB_SHAPE, xcb-shape,
[ have_ecore_x_xcb_shape="yes"
AC_DEFINE(ECORE_XCB_SHAPE, 1, [Build support for XCB shape]) ],
[ have_ecore_x_xcb_shape="no" ])
PKG_CHECK_MODULES(XCB_SYNC, xcb-sync,
[ have_ecore_x_xcb_sync="yes"
AC_DEFINE(ECORE_XCB_SYNC, 1, [Build support for XCB sync]) ],
[ have_ecore_x_xcb_sync="no" ])
PKG_CHECK_MODULES(XCB_XFIXES, xcb-xfixes,
[ have_ecore_x_xcb_xfixes="yes"
AC_DEFINE(ECORE_XCB_FIXES, 1, [Build support for XCB xfixes]) ],
[ have_ecore_x_xcb_xfixes="no" ])
PKG_CHECK_MODULES(XCB_XINERAMA, xcb-xinerama,
[ have_ecore_x_xcb_xinerama="yes"
AC_DEFINE(ECORE_XCB_XINERAMA, 1, [Build support for XCB xinerama]) ],
[ have_ecore_x_xcb_xinerama="no" ])
PKG_CHECK_MODULES(XCB_XPRINT, xcb-xprint,
[ have_ecore_x_xcb_xprint="yes"
AC_DEFINE(ECORE_XCB_XPRINT, 1, [Build support for XCB xprint]) ],
[ have_ecore_x_xcb_xprint="no" ])
AC_DEFINE(BUILD_ECORE_X, 1, [Build Ecore_X Module (XCB backend)])
AC_DEFINE(HAVE_ECORE_X_XCB, 1, [Defined to 1 if XCB backend is enabled.])
requirements_ecore_evas="$requirements_ecore_evas ecore-x"
have_ecore_x_xcb_define="-DHAVE_ECORE_X_XCB"
have_ecore_x="yes"
AC_SUBST(have_ecore_x_xcb_define)
fi
fi
have_x="no"
x_dir="";
x_includes="";
x_cflags="";
x_libs="";
if test "x$have_ecore_x_xcb" != "xyes" ; then
AC_PATH_XTRA
AC_CHECK_HEADER(X11/X.h,
[
@ -214,6 +295,8 @@ if test "x$have_ecore_x" = "xyes"; then
requirements_ecore_evas="$requirements_ecore_evas ecore-x"
fi
fi
ECORE_CHECK_MODULE([Job], [yes])
PKG_CHECK_MODULES(DIRECTFB, directfb >= 0.9.16,
@ -630,6 +713,8 @@ AC_SUBST(requirements_ecore_txt)
AC_SUBST(requirements_ecore_x)
# set up conditionals
AM_CONDITIONAL(BUILD_ECORE_X, test "x$have_ecore_x" = "xyes")
AM_CONDITIONAL(BUILD_ECORE_X_XCB, test "x$have_ecore_x_xcb" = "xyes")
AM_CONDITIONAL(BUILD_ECORE_EVAS_GL, test $have_ecore_evas_gl = yes)
AM_CONDITIONAL(BUILD_ECORE_EVAS_XRENDER, test $have_ecore_evas_xrender = yes)
AM_CONDITIONAL(BUILD_ECORE_EVAS_DIRECTFB, test $have_ecore_evas_dfb = yes)
@ -683,7 +768,11 @@ echo
echo " Ecore_Job....................: $have_ecore_job"
echo " Ecore_Con....................: $have_ecore_con (OpenSSL: $use_openssl)"
echo " Ecore_Txt....................: $have_ecore_txt"
echo " Ecore_X......................: $have_ecore_x (Xcursor: $use_Xcursor) (Xprint: $use_xprint) (Xinerama: $use_xinerama) (Xrandr: $use_xrandr) (Xscreensaver: $use_xss) (Xrender: $use_xrender) (Xfixes: $use_xfixes) (Xdamage: $use_xdamage) (Xdpms: $use_xdpms)"
if test "x$have_ecore_x_xcb" = "xyes" ; then
echo " Ecore_X (XCB backend)........: $have_ecore_x_xcb (Xprint: $have_ecore_x_xcb_xprint) (Xinerama: $have_ecore_x_xcb_xinerama) (Xrandr: $have_ecore_x_xcb_randr) (Xscreensaver: $have_ecore_x_xcb_screensaver) (Xshape: $have_ecore_x_xcb_shape) (Xsync: $have_ecore_x_xcb_sync) (Xrender: $have_ecore_x_xcb_render) (Xfixes: $have_ecore_x_xcb_xfixes) (Xdamage: $have_ecore_x_xcb_damage) (Xdpms: $have_ecore_x_xcb_dpms)"
else
echo " Ecore_X (Xlib backend).......: $have_ecore_x (Xcursor: $use_Xcursor) (Xprint: $use_xprint) (Xinerama: $use_xinerama) (Xrandr: $use_xrandr) (Xscreensaver: $use_xss) (Xrender: $use_xrender) (Xfixes: $use_xfixes) (Xdamage: $use_xdamage) (Xdpms: $use_xdpms)"
fi
echo " Ecore_FB.....................: $have_ecore_fb"
echo " Ecore_DFB....................: $have_ecore_directfb"
echo " Ecore_Evas...................: $have_ecore_evas"

View File

@ -38,7 +38,8 @@ INCLUDES = \
$(ECORE_X_INC) \
$(ECORE_FB_INC) \
$(ECORE_DIRECTFB_INC) \
@EVAS_CFLAGS@
@EVAS_CFLAGS@ \
@XCB_CFLAGS@
libecore_evas_la_LDFLAGS = -version-info 1:0:0 \
$(ECORE_X_LDF) \
@ -65,7 +66,8 @@ $(ECORE_X_LIB) \
$(ECORE_FB_LIB) \
$(ECORE_DIRECTFB_LIB) \
$(top_builddir)/src/lib/ecore/libecore.la \
@EVAS_LIBS@
@EVAS_LIBS@ \
@XCB_LIBS@
libecore_evas_la_DEPENDENCIES = \
$(ECORE_X_LIB) \

View File

@ -23,19 +23,30 @@
#endif
#ifdef BUILD_ECORE_X
#include "Ecore_X.h"
#include <Evas_Engine_Software_X11.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#ifdef ECORE_XRENDER
#include <X11/extensions/Xrender.h>
#endif
#ifdef BUILD_ECORE_EVAS_GL
#include <Evas_Engine_GL_X11.h>
#endif
#ifdef BUILD_ECORE_EVAS_XRENDER
#include <Evas_Engine_XRender_X11.h>
#endif
# include "Ecore_X.h"
# ifdef HAVE_ECORE_X_XCB
# include <Evas_Engine_Software_Xcb.h>
# include <xcb/xcb.h>
# ifdef ECORE_XCB_RENDER
# include <xcb/render.h>
# endif
# ifdef BUILD_ECORE_EVAS_XRENDER
# include <Evas_Engine_XRender_Xcb.h>
# endif
# else
# include <Evas_Engine_Software_X11.h>
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# ifdef ECORE_XRENDER
# include <X11/extensions/Xrender.h>
# endif
# ifdef BUILD_ECORE_EVAS_GL
# include <Evas_Engine_GL_X11.h>
# endif
# ifdef BUILD_ECORE_EVAS_XRENDER
# include <Evas_Engine_XRender_X11.h>
# endif
# endif /* HAVE_ECORE_X_XCB */
#endif
#ifdef BUILD_ECORE_EVAS_FB
#include <Evas_Engine_FB.h>
@ -112,7 +123,11 @@ struct _Ecore_Evas_Engine
Ecore_X_Pixmap pmap;
Ecore_X_Pixmap mask;
Ecore_X_GC gc;
#ifdef HAVE_ECORE_X_XCB
#warning [XCB] No Region code
#else
Region damages;
#endif /* HAVE_ECORE_X_XCB */
int px, py, pw, ph;
unsigned char direct_resize : 1;
unsigned char using_bg_pixmap : 1;

File diff suppressed because it is too large Load Diff

View File

@ -40,19 +40,30 @@
* @li @ref Ecore_X_Flush_Group
*/
typedef unsigned int Ecore_X_ID;
#ifndef _ECORE_X_WINDOW_PREDEF
# ifndef _ECORE_X_WINDOW_PREDEF
typedef Ecore_X_ID Ecore_X_Window;
#endif
# endif
#ifdef HAVE_ECORE_X_XCB
typedef Ecore_X_ID Ecore_X_Visual;
#else
typedef void * Ecore_X_Visual;
#endif /* HAVE_ECORE_X_XCB */
typedef Ecore_X_ID Ecore_X_Pixmap;
typedef Ecore_X_ID Ecore_X_Drawable;
#ifdef HAVE_ECORE_X_XCB
typedef Ecore_X_ID Ecore_X_GC;
#else
typedef void * Ecore_X_GC;
#endif /* HAVE_ECORE_X_XCB */
typedef Ecore_X_ID Ecore_X_Atom;
typedef Ecore_X_ID Ecore_X_Colormap;
typedef Ecore_X_ID Ecore_X_Time;
typedef Ecore_X_ID Ecore_X_Cursor;
typedef void Ecore_X_Display;
typedef void Ecore_X_Connection;
typedef void Ecore_X_Screen;
typedef Ecore_X_ID Ecore_X_Sync_Counter;
typedef Ecore_X_ID Ecore_X_Sync_Alarm;
@ -972,7 +983,9 @@ EAPI int ecore_x_init(const char *name);
EAPI int ecore_x_shutdown(void);
EAPI int ecore_x_disconnect(void);
EAPI Ecore_X_Display *ecore_x_display_get(void);
EAPI Ecore_X_Connection *ecore_x_connection_get(void);
EAPI int ecore_x_fd_get(void);
EAPI Ecore_X_Screen *ecore_x_default_screen_get(void);
EAPI void ecore_x_double_click_time_set(double t);
EAPI double ecore_x_double_click_time_get(void);
EAPI void ecore_x_flush(void);
@ -991,12 +1004,20 @@ EAPI void ecore_x_event_mask_set(Ecore_X_Window w, Ecore_X_Event_Mas
EAPI void ecore_x_event_mask_unset(Ecore_X_Window w, Ecore_X_Event_Mask mask);
EAPI int ecore_x_selection_notify_send(Ecore_X_Window requestor, Ecore_X_Atom selection, Ecore_X_Atom target, Ecore_X_Atom property, Ecore_X_Time time);
EAPI void ecore_x_selection_primary_prefetch(void);
EAPI void ecore_x_selection_primary_fetch(void);
EAPI int ecore_x_selection_primary_set(Ecore_X_Window w, const void *data, int size);
EAPI int ecore_x_selection_primary_clear(void);
EAPI void ecore_x_selection_secondary_prefetch(void);
EAPI void ecore_x_selection_secondary_fetch(void);
EAPI int ecore_x_selection_secondary_set(Ecore_X_Window w, const void *data, int size);
EAPI int ecore_x_selection_secondary_clear(void);
EAPI void ecore_x_selection_xdnd_prefetch(void);
EAPI void ecore_x_selection_xdnd_fetch(void);
EAPI int ecore_x_selection_xdnd_set(Ecore_X_Window w, const void *data, int size);
EAPI int ecore_x_selection_xdnd_clear(void);
EAPI void ecore_x_selection_clipboard_prefetch(void);
EAPI void ecore_x_selection_clipboard_fetch(void);
EAPI int ecore_x_selection_clipboard_set(Ecore_X_Window w, const void *data, int size);
EAPI int ecore_x_selection_clipboard_clear(void);
EAPI void ecore_x_selection_primary_request(Ecore_X_Window w, const char *target);
@ -1012,10 +1033,16 @@ EAPI void ecore_x_selection_parser_add(const char *target, void *(*f
EAPI void ecore_x_selection_parser_del(const char *target);
EAPI void ecore_x_dnd_aware_set(Ecore_X_Window win, int on);
EAPI void ecore_x_dnd_version_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_dnd_version_get_fetch(void);
EAPI int ecore_x_dnd_version_get(Ecore_X_Window win);
EAPI void ecore_x_dnd_type_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_dnd_type_get_fetch(void);
EAPI int ecore_x_dnd_type_isset(Ecore_X_Window win, const char *type);
EAPI void ecore_x_dnd_type_set(Ecore_X_Window win, const char *type, int on);
EAPI void ecore_x_dnd_types_set(Ecore_X_Window win, char **types, unsigned int num_types);
EAPI void ecore_x_dnd_begin_prefetch(Ecore_X_Window source);
EAPI void ecore_x_dnd_begin_fetch(void);
EAPI int ecore_x_dnd_begin(Ecore_X_Window source, unsigned char *data, int size);
EAPI int ecore_x_dnd_drop(void);
EAPI void ecore_x_dnd_send_status(int will_accept, int suppress, Ecore_X_Rectangle rectangle, Ecore_X_Atom action);
@ -1047,6 +1074,8 @@ EAPI void ecore_x_window_resize(Ecore_X_Window win, int w, int h);
EAPI void ecore_x_window_move_resize(Ecore_X_Window win, int x, int y, int w, int h);
EAPI void ecore_x_window_focus(Ecore_X_Window win);
EAPI void ecore_x_window_focus_at_time(Ecore_X_Window win, Ecore_X_Time t);
EAPI void ecore_x_get_input_focus_prefetch(void);
EAPI void ecore_x_get_input_focus_fetch(void);
EAPI Ecore_X_Window ecore_x_window_focus_get(void);
EAPI void ecore_x_window_raise(Ecore_X_Window win);
EAPI void ecore_x_window_lower(Ecore_X_Window win);
@ -1062,6 +1091,8 @@ EAPI int ecore_x_window_visible_get(Ecore_X_Window win);
EAPI Ecore_X_Window ecore_x_window_at_xy_get(int x, int y);
EAPI Ecore_X_Window ecore_x_window_at_xy_with_skip_get(int x, int y, Ecore_X_Window *skip, int skip_num);
EAPI Ecore_X_Window ecore_x_window_at_xy_begin_get(Ecore_X_Window begin, int x, int y);
EAPI void ecore_x_query_tree_prefetch(Ecore_X_Window window);
EAPI void ecore_x_query_tree_fetch(void);
EAPI Ecore_X_Window ecore_x_window_parent_get(Ecore_X_Window win);
EAPI void ecore_x_window_background_color_set(Ecore_X_Window win,
@ -1082,6 +1113,9 @@ EAPI void ecore_x_window_override_set(Ecore_X_Window win, int overri
EAPI void ecore_x_window_prop_card32_set(Ecore_X_Window win, Ecore_X_Atom atom,
unsigned int *val, unsigned int num);
EAPI void ecore_x_window_prop_card32_get_prefetch(Ecore_X_Window window,
Ecore_X_Atom atom);
EAPI void ecore_x_window_prop_card32_get_fetch(void);
EAPI int ecore_x_window_prop_card32_get(Ecore_X_Window win, Ecore_X_Atom atom,
unsigned int *val, unsigned int len);
EAPI int ecore_x_window_prop_card32_list_get(Ecore_X_Window win,
@ -1093,6 +1127,10 @@ EAPI void ecore_x_window_prop_xid_set(Ecore_X_Window win,
Ecore_X_Atom type,
Ecore_X_ID * lst,
unsigned int num);
EAPI void ecore_x_window_prop_xid_get_prefetch(Ecore_X_Window window,
Ecore_X_Atom atom,
Ecore_X_Atom type);
EAPI void ecore_x_window_prop_xid_get_fetch(void);
EAPI int ecore_x_window_prop_xid_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom type,
@ -1111,6 +1149,9 @@ EAPI void ecore_x_window_prop_atom_set(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom * val,
unsigned int num);
EAPI void ecore_x_window_prop_atom_get_prefetch(Ecore_X_Window window,
Ecore_X_Atom atom);
EAPI void ecore_x_window_prop_atom_get_fetch(void);
EAPI int ecore_x_window_prop_atom_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom * val,
@ -1126,6 +1167,9 @@ EAPI void ecore_x_window_prop_window_set(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Window * val,
unsigned int num);
EAPI void ecore_x_window_prop_window_get_prefetch(Ecore_X_Window window,
Ecore_X_Atom atom);
EAPI void ecore_x_window_prop_window_get_fetch(void);
EAPI int ecore_x_window_prop_window_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Window * val,
@ -1136,10 +1180,19 @@ EAPI int ecore_x_window_prop_window_list_get(Ecore_X_Window win,
EAPI Ecore_X_Atom ecore_x_window_prop_any_type(void);
EAPI void ecore_x_window_prop_property_set(Ecore_X_Window win, Ecore_X_Atom type, Ecore_X_Atom format, int size, void *data, int number);
EAPI void ecore_x_window_prop_property_get_prefetch(Ecore_X_Window window,
Ecore_X_Atom property,
Ecore_X_Atom type);
EAPI void ecore_x_window_prop_property_get_fetch(void);
EAPI int ecore_x_window_prop_property_get(Ecore_X_Window win, Ecore_X_Atom property, Ecore_X_Atom type, int size, unsigned char **data, int *num);
EAPI void ecore_x_window_prop_property_del(Ecore_X_Window win, Ecore_X_Atom property);
EAPI void ecore_x_window_prop_list_prefetch(Ecore_X_Window window);
EAPI void ecore_x_window_prop_list_fetch(void);
EAPI Ecore_X_Atom *ecore_x_window_prop_list(Ecore_X_Window win, int *num_ret);
EAPI void ecore_x_window_prop_string_set(Ecore_X_Window win, Ecore_X_Atom type, const char *str);
EAPI void ecore_x_window_prop_string_get_prefetch(Ecore_X_Window window,
Ecore_X_Atom type);
EAPI void ecore_x_window_prop_string_get_fetch(void);
EAPI char *ecore_x_window_prop_string_get(Ecore_X_Window win, Ecore_X_Atom type);
EAPI int ecore_x_window_prop_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol);
EAPI Ecore_X_WM_Protocol *ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, int *num_ret);
@ -1154,6 +1207,8 @@ EAPI void ecore_x_window_shape_window_add_xy(Ecore_X_Window win, E
EAPI void ecore_x_window_shape_rectangle_add(Ecore_X_Window win, int x, int y, int w, int h);
EAPI void ecore_x_window_shape_rectangle_clip(Ecore_X_Window win, int x, int y, int w, int h);
EAPI void ecore_x_window_shape_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle *rects, int num);
EAPI void ecore_x_window_shape_rectangles_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_window_shape_rectangles_get_fetch(void);
EAPI Ecore_X_Rectangle *ecore_x_window_shape_rectangles_get(Ecore_X_Window win, int *num_ret);
EAPI void ecore_x_window_shape_events_select(Ecore_X_Window win, int on);
@ -1172,6 +1227,8 @@ EAPI int ecore_x_mouse_move_send(Ecore_X_Window win, int x, int y);
EAPI int ecore_x_mouse_down_send(Ecore_X_Window win, int x, int y, int b);
EAPI int ecore_x_mouse_up_send(Ecore_X_Window win, int x, int y, int b);
EAPI void ecore_x_drawable_geometry_get_prefetch(Ecore_X_Drawable drawable);
EAPI void ecore_x_drawable_geometry_get_fetch(void);
EAPI void ecore_x_drawable_geometry_get(Ecore_X_Drawable d, int *x, int *y, int *w, int *h);
EAPI int ecore_x_drawable_border_width_get(Ecore_X_Drawable d);
EAPI int ecore_x_drawable_depth_get(Ecore_X_Drawable d);
@ -1192,6 +1249,8 @@ EAPI void ecore_x_window_container_manage(Ecore_X_Window win);
EAPI void ecore_x_window_client_manage(Ecore_X_Window win);
EAPI void ecore_x_window_sniff(Ecore_X_Window win);
EAPI void ecore_x_window_client_sniff(Ecore_X_Window win);
EAPI void ecore_x_atom_get_prefetch(const char *name);
EAPI void ecore_x_atom_get_fetch(void);
EAPI Ecore_X_Atom ecore_x_atom_get(const char *name);
@ -1296,10 +1355,12 @@ typedef enum _Ecore_X_MWM_Hint_Input
ECORE_X_MWM_HINT_INPUT_FULL_APPLICATION_MODAL = 3,
} Ecore_X_MWM_Hint_Input;
EAPI int ecore_x_mwm_hints_get(Ecore_X_Window win,
Ecore_X_MWM_Hint_Func *fhint,
Ecore_X_MWM_Hint_Decor *dhint,
Ecore_X_MWM_Hint_Input *ihint);
EAPI void ecore_x_mwm_hints_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_mwm_hints_get_fetch(void);
EAPI int ecore_x_mwm_hints_get(Ecore_X_Window win,
Ecore_X_MWM_Hint_Func *fhint,
Ecore_X_MWM_Hint_Decor *dhint,
Ecore_X_MWM_Hint_Input *ihint);
EAPI void ecore_x_mwm_borderless_set(Ecore_X_Window win, int borderless);
/* netwm */
@ -1307,6 +1368,8 @@ EAPI void ecore_x_netwm_init(void);
EAPI void ecore_x_netwm_shutdown(void);
EAPI void ecore_x_netwm_wm_identify(Ecore_X_Window root, Ecore_X_Window check, const char *wm_name);
EAPI void ecore_x_netwm_supported_set(Ecore_X_Window root, Ecore_X_Atom *supported, int num);
EAPI void ecore_x_netwm_supported_get_prefetch(Ecore_X_Window root);
EAPI void ecore_x_netwm_supported_get_fetch(void);
EAPI int ecore_x_netwm_supported_get(Ecore_X_Window root, Ecore_X_Atom **supported, int *num);
EAPI void ecore_x_netwm_desk_count_set(Ecore_X_Window root, unsigned int n_desks);
EAPI void ecore_x_netwm_desk_roots_set(Ecore_X_Window root, Ecore_X_Window *vroots, unsigned int n_desks);
@ -1321,41 +1384,79 @@ EAPI void ecore_x_netwm_client_list_set(Ecore_X_Window root, Ecor
EAPI void ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root, Ecore_X_Window *p_clients, unsigned int n_clients);
EAPI void ecore_x_netwm_client_active_set(Ecore_X_Window root, Ecore_X_Window win);
EAPI void ecore_x_netwm_name_set(Ecore_X_Window win, const char *name);
EAPI void ecore_x_netwm_name_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_name_get_fetch(void);
EAPI int ecore_x_netwm_name_get(Ecore_X_Window win, char **name);
EAPI void ecore_x_netwm_startup_id_set(Ecore_X_Window win, const char *id);
EAPI void ecore_x_netwm_startup_id_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_startup_id_get_fetch(void);
EAPI int ecore_x_netwm_startup_id_get(Ecore_X_Window win, char **id);
EAPI void ecore_x_netwm_visible_name_set(Ecore_X_Window win, const char *name);
EAPI void ecore_x_netwm_visible_name_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_visible_name_get_fetch(void);
EAPI int ecore_x_netwm_visible_name_get(Ecore_X_Window win, char **name);
EAPI void ecore_x_netwm_icon_name_set(Ecore_X_Window win, const char *name);
EAPI void ecore_x_netwm_icon_name_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_icon_name_get_fetch(void);
EAPI int ecore_x_netwm_icon_name_get(Ecore_X_Window win, char **name);
EAPI void ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win, const char *name);
EAPI void ecore_x_netwm_visible_icon_name_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_visible_icon_name_get_fetch(void);
EAPI int ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win, char **name);
EAPI void ecore_x_netwm_desktop_set(Ecore_X_Window win, unsigned int desk);
EAPI void ecore_x_netwm_desktop_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_desktop_get_fetch(void);
EAPI int ecore_x_netwm_desktop_get(Ecore_X_Window win, unsigned int *desk);
EAPI void ecore_x_netwm_strut_set(Ecore_X_Window win, int left, int right, int top, int bottom);
EAPI void ecore_x_netwm_strut_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_strut_get_fetch(void);
EAPI int ecore_x_netwm_strut_get(Ecore_X_Window win, int *left, int *right, int *top, int *bottom);
EAPI void ecore_x_netwm_strut_partial_set(Ecore_X_Window win, int left, int right, int top, int bottom, int left_start_y, int left_end_y, int right_start_y, int right_end_y, int top_start_x, int top_end_x, int bottom_start_x, int bottom_end_x);
EAPI void ecore_x_netwm_strut_partial_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_strut_partial_get_fetch(void);
EAPI int ecore_x_netwm_strut_partial_get(Ecore_X_Window win, int *left, int *right, int *top, int *bottom, int *left_start_y, int *left_end_y, int *right_start_y, int *right_end_y, int *top_start_x, int *top_end_x, int *bottom_start_x, int *bottom_end_x);
EAPI void ecore_x_netwm_icons_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_icons_get_fetch(void);
EAPI int ecore_x_netwm_icons_get(Ecore_X_Window win, Ecore_X_Icon **icon, int *num);
EAPI void ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, int x, int y, int width, int height);
EAPI void ecore_x_netwm_icon_geometry_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_icon_geometry_get_fetch(void);
EAPI int ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, int *x, int *y, int *width, int *height);
EAPI void ecore_x_netwm_pid_set(Ecore_X_Window win, int pid);
EAPI void ecore_x_netwm_pid_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_pid_get_fetch(void);
EAPI int ecore_x_netwm_pid_get(Ecore_X_Window win, int *pid);
EAPI void ecore_x_netwm_handled_icons_set(Ecore_X_Window win);
EAPI void ecore_x_netwm_handled_icons_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_handled_icons_get_fetch(void);
EAPI int ecore_x_netwm_handled_icons_get(Ecore_X_Window win);
EAPI void ecore_x_netwm_user_time_set(Ecore_X_Window win, unsigned int time);
EAPI void ecore_x_netwm_user_time_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_user_time_get_fetch(void);
EAPI int ecore_x_netwm_user_time_get(Ecore_X_Window win, unsigned int *time);
EAPI void ecore_x_netwm_window_state_set(Ecore_X_Window win, Ecore_X_Window_State *state, unsigned int num);
EAPI void ecore_x_netwm_window_state_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_window_state_get_fetch(void);
EAPI int ecore_x_netwm_window_state_get(Ecore_X_Window win, Ecore_X_Window_State **state, unsigned int *num);
EAPI void ecore_x_netwm_window_type_set(Ecore_X_Window win, Ecore_X_Window_Type type);
EAPI void ecore_x_netwm_window_type_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_window_type_get_fetch(void);
EAPI int ecore_x_netwm_window_type_get(Ecore_X_Window win, Ecore_X_Window_Type *type);
EAPI int ecore_x_netwm_allowed_action_isset(Ecore_X_Window win, Ecore_X_Action action);
EAPI void ecore_x_netwm_allowed_action_set(Ecore_X_Window win, Ecore_X_Action *action, unsigned int num);
EAPI void ecore_x_netwm_allowed_action_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_allowed_action_get_fetch(void);
EAPI int ecore_x_netwm_allowed_action_get(Ecore_X_Window win, Ecore_X_Action **action, unsigned int *num);
EAPI void ecore_x_netwm_opacity_set(Ecore_X_Window win, unsigned int opacity);
EAPI void ecore_x_netwm_opacity_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_opacity_get_fetch(void);
EAPI int ecore_x_netwm_opacity_get(Ecore_X_Window win, unsigned int *opacity);
EAPI void ecore_x_netwm_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb);
EAPI void ecore_x_netwm_frame_size_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_frame_size_get_fetch(void);
EAPI int ecore_x_netwm_frame_size_get(Ecore_X_Window win, int *fl, int *fr, int *ft, int *fb);
EAPI void ecore_x_netwm_sync_counter_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_netwm_sync_counter_get_fetch(void);
EAPI int ecore_x_netwm_sync_counter_get(Ecore_X_Window win, Ecore_X_Sync_Counter *counter);
EAPI void ecore_x_netwm_ping_send(Ecore_X_Window win);
EAPI void ecore_x_netwm_sync_request_send(Ecore_X_Window win, unsigned int serial);
@ -1369,11 +1470,17 @@ EAPI void ecore_x_e_init(void);
EAPI void ecore_x_e_frame_size_set(Ecore_X_Window win, int fl, int fr, int ft, int fb);
EAPI void ecore_x_xinerama_query_screens_prefetch(void);
EAPI void ecore_x_xinerama_query_screens_fetch(void);
EAPI int ecore_x_xinerama_screen_count_get(void);
EAPI int ecore_x_xinerama_screen_geometry_get(int screen, int *x, int *y, int *w, int *h);
EAPI int ecore_x_screensaver_event_available_get(void);
EAPI int ecore_x_screensaver_idle_time_get(void);
EAPI void ecore_x_screensaver_idle_time_prefetch(void);
EAPI void ecore_x_screensaver_idle_time_fetch(void);
EAPI int ecore_x_screensaver_idle_time_get(void);
EAPI void ecore_x_get_screensaver_prefetch(void);
EAPI void ecore_x_get_screensaver_fetch(void);
EAPI void ecore_x_screensaver_set(int timeout, int interval, int blank, int expose);
EAPI void ecore_x_screensaver_timeout_set(double timeout);
EAPI double ecore_x_screensaver_timeout_get(void);
@ -1413,12 +1520,16 @@ typedef struct _Ecore_X_Window_Attributes
*/
} Ecore_X_Window_Attributes;
EAPI void ecore_x_get_window_attributes_prefetch(Ecore_X_Window window);
EAPI void ecore_x_get_window_attributes_fetch(void);
EAPI int ecore_x_window_attributes_get(Ecore_X_Window win, Ecore_X_Window_Attributes *att_ret);
EAPI void ecore_x_window_save_set_add(Ecore_X_Window win);
EAPI void ecore_x_window_save_set_del(Ecore_X_Window win);
EAPI Ecore_X_Window *ecore_x_window_children_get(Ecore_X_Window win, int *num);
EAPI int ecore_x_pointer_control_set(int accel_num, int accel_denom, int threshold);
EAPI void ecore_x_pointer_control_get_prefetch(void);
EAPI void ecore_x_pointer_control_get_fetch(void);
EAPI int ecore_x_pointer_control_get(int *accel_num, int *accel_denom, int *threshold);
EAPI int ecore_x_pointer_grab(Ecore_X_Window win);
EAPI int ecore_x_pointer_confine_grab(Ecore_X_Window win);
@ -1442,6 +1553,8 @@ EAPI void ecore_x_window_key_ungrab(Ecore_X_Window win, const char *key,
EAPI void ecore_x_focus_reset(void);
EAPI void ecore_x_events_allow_all(void);
EAPI void ecore_x_pointer_last_xy_get(int *x, int *y);
EAPI void ecore_x_pointer_xy_get_prefetch(Ecore_X_Window window);
EAPI void ecore_x_pointer_xy_get_fetch(void);
EAPI void ecore_x_pointer_xy_get(Ecore_X_Window win, int *x, int *y);
/* ecore_x_sync.c */
@ -1462,6 +1575,8 @@ struct _Ecore_X_Screen_Refresh_Rate
};
EAPI int ecore_x_randr_events_select(Ecore_X_Window win, int on);
EAPI void ecore_x_randr_get_screen_info_prefetch(Ecore_X_Window window);
EAPI void ecore_x_randr_get_screen_info_fetch(void);
EAPI Ecore_X_Randr_Rotation ecore_x_randr_screen_rotations_get(Ecore_X_Window root);
EAPI Ecore_X_Randr_Rotation ecore_x_randr_screen_rotation_get(Ecore_X_Window root);
EAPI void ecore_x_randr_screen_rotation_set(Ecore_X_Window root, Ecore_X_Randr_Rotation rot);
@ -1499,6 +1614,8 @@ EAPI void ecore_x_region_subtract(Ecore_X_Region dest, Ecore_X_Region
EAPI void ecore_x_region_invert(Ecore_X_Region dest, Ecore_X_Rectangle *bounds, Ecore_X_Region source);
EAPI void ecore_x_region_translate(Ecore_X_Region region, int dx, int dy);
EAPI void ecore_x_region_extents(Ecore_X_Region dest, Ecore_X_Region source);
EAPI void ecore_x_region_fetch_prefetch(Ecore_X_Region region);
EAPI void ecore_x_region_fetch_fetch(void);
EAPI Ecore_X_Rectangle * ecore_x_region_fetch(Ecore_X_Region region, int *num, Ecore_X_Rectangle *bounds);
EAPI void ecore_x_region_expand(Ecore_X_Region dest, Ecore_X_Region source, unsigned int left, unsigned int right, unsigned int top, unsigned int bottom);
EAPI void ecore_x_region_gc_clip_set(Ecore_X_Region region, Ecore_X_GC gc, int x_origin, int y_origin);
@ -1535,14 +1652,20 @@ EAPI void ecore_x_damage_subtract(Ecore_X_Damage damage, Ecore_X_Re
EAPI int ecore_x_screen_is_composited(int screen);
EAPI int ecore_x_dpms_query(void);
EAPI void ecore_x_dpms_capable_get_prefetch(void);
EAPI void ecore_x_dpms_capable_get_fetch(void);
EAPI int ecore_x_dpms_capable_get(void);
EAPI void ecore_x_dpms_enable_get_prefetch(void);
EAPI void ecore_x_dpms_enable_get_fetch(void);
EAPI int ecore_x_dpms_enabled_get(void);
EAPI void ecore_x_dpms_enabled_set(int enabled);
EAPI void ecore_x_dpms_timeouts_get_prefetch(void);
EAPI void ecore_x_dpms_timeouts_get_fetch(void);
EAPI void ecore_x_dpms_timeouts_get(unsigned int *standby, unsigned int *suspend, unsigned int *off);
EAPI int ecore_x_dpms_timeouts_set(unsigned int standby, unsigned int suspend, unsigned int off);
EAPI unsigned int ecore_x_dpms_timeout_standby_get();
EAPI unsigned int ecore_x_dpms_timeout_suspend_get();
EAPI unsigned int ecore_x_dpms_timeout_off_get();
EAPI unsigned int ecore_x_dpms_timeout_standby_get(void);
EAPI unsigned int ecore_x_dpms_timeout_suspend_get(void);
EAPI unsigned int ecore_x_dpms_timeout_off_get(void);
EAPI void ecore_x_dpms_timeout_standby_set(unsigned int new_timeout);
EAPI void ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout);
EAPI void ecore_x_dpms_timeout_off_set(unsigned int new_timeout);

View File

@ -1,5 +1,23 @@
MAINTAINERCLEANFILES = Makefile.in
if BUILD_ECORE_X_XCB
INCLUDES = \
@XCB_DAMAGE_CFLAGS@ \
@XCB_DPMS_CFLAGS@ \
@XCB_RANDR_CFLAGS@ \
@XCB_RENDER_CFLAGS@ \
@XCB_SCREENSAVER_CFLAGS@ \
@XCB_SHAPE_CFLAGS@ \
@XCB_SYNC_CFLAGS@ \
@XCB_XFIXES_CFLAGS@ \
@XCB_XINERAMA_CFLAGS@ \
@XCB_XPRINT_CFLAGS@ \
@XCB_CFLAGS@ \
-I$(top_srcdir)/src/lib/ecore \
-I$(top_srcdir)/src/lib/ecore_txt \
-I$(top_builddir)/src/lib/ecore \
-I$(top_builddir)/src/lib/ecore_txt
else
INCLUDES = \
@Xcursor_cflags@ \
@XDAMAGE_CFLAGS@ \
@ -15,11 +33,68 @@ INCLUDES = \
-I$(top_srcdir)/src/lib/ecore_txt \
-I$(top_builddir)/src/lib/ecore \
-I$(top_builddir)/src/lib/ecore_txt
endif
libecore_x_la_LDFLAGS = -version-info 1:0:0 \
-L$(top_builddir)/src/lib/ecore/.libs \
-L$(top_builddir)/src/lib/ecore_txt/.libs
if BUILD_ECORE_X_XCB
lib_LTLIBRARIES = libecore_x.la
include_HEADERS = \
Ecore_X.h \
Ecore_X_Atoms.h \
Ecore_X_Cursor.h
libecore_x_la_SOURCES = \
ecore_xcb_atom.c \
ecore_xcb_cursor.c \
ecore_xcb_damage.c \
ecore_xcb_dnd.c \
ecore_xcb_dpms.c \
ecore_xcb_drawable.c \
ecore_xcb_e.c \
ecore_xcb_events.c \
ecore_xcb_fixes.c \
ecore_xcb_gc.c \
ecore_xcb_icccm.c \
ecore_xcb_mwm.c \
ecore_xcb_netwm.c \
ecore_xcb_pixmap.c \
ecore_xcb_randr.c \
ecore_xcb_reply.c \
ecore_xcb_screensaver.c \
ecore_xcb_selection.c \
ecore_xcb_shape.c \
ecore_xcb_sync.c \
ecore_xcb_window.c \
ecore_xcb_window_prop.c \
ecore_xcb_xinerama.c \
ecore_xcb.c \
ecore_xcb_private.h
libecore_x_la_LIBADD = \
@XCB_DAMAGE_LIBS@ \
@XCB_DPMS_LIBS@ \
@XCB_RANDR_LIBS@ \
@XCB_RENDER_LIBS@ \
@XCB_SCREENSAVER_LIBS@ \
@XCB_SHAPE_LIBS@ \
@XCB_SYNC_LIBS@ \
@XCB_XFIXES_LIBS@ \
@XCB_XINERAMA_LIBS@ \
@XCB_XPRINT_LIBS@ \
@XCB_LIBS@ \
$(top_builddir)/src/lib/ecore/libecore.la \
$(top_builddir)/src/lib/ecore_txt/libecore_txt.la
libecore_x_la_DEPENDENCIES = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(top_builddir)/src/lib/ecore_txt/libecore_txt.la
endif
if BUILD_ECORE_X
lib_LTLIBRARIES = libecore_x.la

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,607 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_xcb_private.h"
/**
* @defgroup Ecore_X_Atom_Group XCB Atom Functions
*
* Functions that operate on atoms.
*/
#define ECORE_X_ATOMS_COUNT 115
static xcb_intern_atom_cookie_t ecore_xcb_atom_init_cookies[ECORE_X_ATOMS_COUNT];
/*********/
/* Atoms */
/*********/
/* generic atoms */
EAPI Ecore_X_Atom ECORE_X_ATOM_ATOM = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_CARDINAL = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_COMPOUND_TEXT = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_FILE_NAME = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_STRING = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_TEXT = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_UTF8_STRING = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_WINDOW = 0;
/* dnd atoms */
EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_XDND = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_XDND = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_AWARE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ENTER = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_TYPE_LIST = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_POSITION = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_COPY = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_MOVE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_PRIVATE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_ASK = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LIST = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LINK = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_DESCRIPTION = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_PROXY = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_STATUS = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_LEAVE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_DROP = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_FINISHED = 0;
/* dnd atoms that need to be exposed to the application interface */
EAPI Ecore_X_Atom ECORE_X_DND_ACTION_COPY = 0;
EAPI Ecore_X_Atom ECORE_X_DND_ACTION_MOVE = 0;
EAPI Ecore_X_Atom ECORE_X_DND_ACTION_LINK = 0;
EAPI Ecore_X_Atom ECORE_X_DND_ACTION_ASK = 0;
EAPI Ecore_X_Atom ECORE_X_DND_ACTION_PRIVATE = 0;
/* old E atom */
EAPI Ecore_X_Atom ECORE_X_ATOM_E_FRAME_SIZE = 0;
/* old Gnome atom */
EAPI Ecore_X_Atom ECORE_X_ATOM_WIN_LAYER = 0;
/* ICCCM atoms */
/* ICCCM: client properties */
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_NAME = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_ICON_NAME = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_NORMAL_HINTS = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_SIZE_HINTS = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_HINTS = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CLASS = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_TRANSIENT_FOR = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_PROTOCOLS = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_COLORMAP_WINDOWS = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_COMMAND = 0; /* obsolete */
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_MACHINE = 0; /* obsolete */
/* ICCCM: window manager properties */
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_STATE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_ICON_SIZE = 0;
/* ICCCM: WM_STATE property */
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CHANGE_STATE = 0;
/* ICCCM: WM_PROTOCOLS properties */
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_TAKE_FOCUS = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_SAVE_YOURSELF = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_DELETE_WINDOW = 0;
/* ICCCM: WM_COLORMAP properties */
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_COLORMAP_NOTIFY = 0;
/* ICCCM: session management properties */
EAPI Ecore_X_Atom ECORE_X_ATOM_SM_CLIENT_ID = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_LEADER = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_WM_WINDOW_ROLE = 0;
/* Motif WM atom */
EAPI Ecore_X_Atom ECORE_X_ATOM_MOTIF_WM_HINTS = 0;
/* NetWM 1.3 atoms (http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html) */
/*
* NetWM: Root Window Properties and related messages (complete)
*/
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTED = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST_STACKING = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_GEOMETRY = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_VIEWPORT = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CURRENT_DESKTOP = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_NAMES = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_ACTIVE_WINDOW = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WORKAREA = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_VIRTUAL_ROOTS = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_LAYOUT = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_SHOWING_DESKTOP = 0;
/*
* NetWM: Other Root Window Messages (complete)
*/
/* pager */
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CLOSE_WINDOW = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_MOVERESIZE_WINDOW = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_MOVERESIZE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_RESTACK_WINDOW = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS = 0;
/*
* NetWM: Application Window Properties (complete)
*/
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_NAME = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_NAME = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_NAME = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_DESKTOP = 0;
/* window type */
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL = 0;
/* state */
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MODAL = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_STICKY = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SHADED = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_HIDDEN = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_ABOVE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_BELOW = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION = 0;
/* allowed actions */
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MOVE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_RESIZE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_SHADE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_STICK = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CLOSE = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT_PARTIAL = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_GEOMETRY = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_PID = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_HANDLED_ICONS = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_USER_TIME = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_ID = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_FRAME_EXTENTS = 0;
/*
* NetWM: Window Manager Protocols (complete)
*/
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_PING = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER = 0;
/*
* NetWM: Not in the spec
*/
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_OPACITY = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_SHADOW = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_SHADE = 0;
/*
* Startup Notification (http://standards.freedesktop.org/startup-notification-spec/startup-notification-0.1.txt)
*/
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_INFO = 0;
/* selection atoms */
EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_TARGETS = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PRIMARY = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_SECONDARY = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_CLIPBOARD = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_PRIMARY = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_SECONDARY = 0;
EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD = 0;
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_atom_init and
_ecore_xcb_atom_init_finalize. The first one gets the cookies and
the second one gets the replies and set the atoms. */
void
_ecore_x_atom_init(void)
{
const char *atom_names[ECORE_X_ATOMS_COUNT] = {
/* generic atoms */
"COMPOUND_TEXT",
"FILE_NAME",
"TEXT",
"UTF8_STRING",
/* dnd atoms */
"JXSelectionWindowProperty",
"XdndSelection",
"XdndAware",
"XdndEnter",
"XdndTypeList",
"XdndPosition",
"XdndActionCopy",
"XdndActionMove",
"XdndActionPrivate",
"XdndActionAsk",
"XdndActionList",
"XdndActionLink",
"XdndActionDescription",
"XdndProxy",
"XdndStatus",
"XdndLeave",
"XdndDrop",
"XdndFinished",
/* old E atom */
"_E_FRAME_SIZE",
/* old Gnome atom */
"_WIN_LAYER",
/* ICCCM */
"WM_PROTOCOLS",
"WM_COLORMAP_WINDOWS",
"WM_STATE",
"WM_CHANGE_STATE",
"WM_TAKE_FOCUS",
"WM_SAVE_YOURSELF",
"WM_DELETE_WINDOW",
"WM_COLORMAP_NOTIFY",
"SM_CLIENT_ID",
"WM_CLIENT_LEADER",
"WM_WINDOW_ROLE",
/* Motif WM atom */
"_MOTIF_WM_HINTS",
/* NetWM atoms */
"_NET_SUPPORTED",
"_NET_CLIENT_LIST",
"_NET_CLIENT_LIST_STACKING",
"_NET_NUMBER_OF_DESKTOPS",
"_NET_DESKTOP_GEOMETRY",
"_NET_DESKTOP_VIEWPORT",
"_NET_CURRENT_DESKTOP",
"_NET_DESKTOP_NAMES",
"_NET_ACTIVE_WINDOW",
"_NET_WORKAREA",
"_NET_SUPPORTING_WM_CHECK",
"_NET_VIRTUAL_ROOTS",
"_NET_DESKTOP_LAYOUT",
"_NET_SHOWING_DESKTOP",
"_NET_CLOSE_WINDOW",
"_NET_MOVERESIZE_WINDOW",
"_NET_WM_MOVERESIZE",
"_NET_RESTACK_WINDOW",
"_NET_REQUEST_FRAME_EXTENTS",
"_NET_WM_NAME",
"_NET_WM_VISIBLE_NAME",
"_NET_WM_ICON_NAME",
"_NET_WM_VISIBLE_ICON_NAME",
"_NET_WM_DESKTOP",
"_NET_WM_WINDOW_TYPE",
"_NET_WM_WINDOW_TYPE_DESKTOP",
"_NET_WM_WINDOW_TYPE_DOCK",
"_NET_WM_WINDOW_TYPE_TOOLBAR",
"_NET_WM_WINDOW_TYPE_MENU",
"_NET_WM_WINDOW_TYPE_UTILITY",
"_NET_WM_WINDOW_TYPE_SPLASH",
"_NET_WM_WINDOW_TYPE_DIALOG",
"_NET_WM_WINDOW_TYPE_NORMAL",
"_NET_WM_STATE",
"_NET_WM_STATE_MODAL",
"_NET_WM_STATE_STICKY",
"_NET_WM_STATE_MAXIMIZED_VERT",
"_NET_WM_STATE_MAXIMIZED_HORZ",
"_NET_WM_STATE_SHADED",
"_NET_WM_STATE_SKIP_TASKBAR",
"_NET_WM_STATE_SKIP_PAGER",
"_NET_WM_STATE_HIDDEN",
"_NET_WM_STATE_FULLSCREEN",
"_NET_WM_STATE_ABOVE",
"_NET_WM_STATE_BELOW",
"_NET_WM_STATE_DEMANDS_ATTENTION",
"_NET_WM_ALLOWED_ACTIONS",
"_NET_WM_ACTION_MOVE",
"_NET_WM_ACTION_RESIZE",
"_NET_WM_ACTION_MINIMIZE",
"_NET_WM_ACTION_SHADE",
"_NET_WM_ACTION_STICK",
"_NET_WM_ACTION_MAXIMIZE_HORZ",
"_NET_WM_ACTION_MAXIMIZE_VERT",
"_NET_WM_ACTION_FULLSCREEN",
"_NET_WM_ACTION_CHANGE_DESKTOP",
"_NET_WM_ACTION_CLOSE",
"_NET_WM_STRUT",
"_NET_WM_STRUT_PARTIAL",
"_NET_WM_ICON_GEOMETRY",
"_NET_WM_ICON",
"_NET_WM_PID",
"_NET_WM_HANDLED_ICONS",
"_NET_WM_USER_TIME",
"_NET_STARTUP_ID",
"_NET_FRAME_EXTENTS",
"_NET_WM_PING",
"_NET_WM_SYNC_REQUEST",
"_NET_WM_SYNC_REQUEST_COUNTER",
"_NET_WM_WINDOW_OPACITY",
"_NET_WM_WINDOW_SHADOW",
"_NET_WM_WINDOW_SHADE",
"_NET_STARTUP_INFO_BEGIN",
"_NET_STARTUP_INFO",
/* selection atoms */
"TARGETS",
"CLIPBOARD",
"_ECORE_SELECTION_PRIMARY",
"_ECORE_SELECTION_SECONDARY",
"_ECORE_SELECTION_CLIPBOARD"
};
int i;
for (i = 0; i < ECORE_X_ATOMS_COUNT; i++)
ecore_xcb_atom_init_cookies[i] = xcb_intern_atom(_ecore_xcb_conn, 0,
strlen(atom_names[i]),
atom_names[i]);
/* These atoms are already internally defined */
ECORE_X_ATOM_SELECTION_PRIMARY = 1;
ECORE_X_ATOM_SELECTION_SECONDARY = 2;
ECORE_X_ATOM_ATOM = 4;
ECORE_X_ATOM_CARDINAL = 6;
ECORE_X_ATOM_STRING = 31;
ECORE_X_ATOM_WINDOW = 33;
ECORE_X_ATOM_WM_NAME = 39;
ECORE_X_ATOM_WM_ICON_NAME = 37;
ECORE_X_ATOM_WM_NORMAL_HINTS = 40;
ECORE_X_ATOM_WM_SIZE_HINTS = 41;
ECORE_X_ATOM_WM_HINTS = 35;
ECORE_X_ATOM_WM_CLASS = 67;
ECORE_X_ATOM_WM_TRANSIENT_FOR = 68;
ECORE_X_ATOM_WM_COMMAND = 34;
ECORE_X_ATOM_WM_CLIENT_MACHINE = 36;
ECORE_X_ATOM_WM_ICON_SIZE = 38;
/* Initialize the globally defined xdnd atoms */
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_LINK = ECORE_X_ATOM_XDND_ACTION_LINK;
ECORE_X_DND_ACTION_ASK = ECORE_X_ATOM_XDND_ACTION_ASK;
ECORE_X_DND_ACTION_PRIVATE = ECORE_X_ATOM_XDND_ACTION_PRIVATE;
}
void
_ecore_x_atom_init_finalize(void)
{
xcb_intern_atom_reply_t *replies[ECORE_X_ATOMS_COUNT];
int i;
for (i = 0; i < ECORE_X_ATOMS_COUNT; i++) {
xcb_generic_error_t *error = NULL;
replies[i] = xcb_intern_atom_reply(_ecore_xcb_conn,
ecore_xcb_atom_init_cookies[i],
&error);
if (!replies[i]) {
printf ("pas de reply %d\n", i);
if (error)
printf ("Error !\n");
}
}
ECORE_X_ATOM_COMPOUND_TEXT = replies[0]->atom;
ECORE_X_ATOM_FILE_NAME = replies[1]->atom;
ECORE_X_ATOM_TEXT = replies[2]->atom;
ECORE_X_ATOM_UTF8_STRING = replies[3]->atom;
ECORE_X_ATOM_SELECTION_PROP_XDND = replies[4]->atom;
ECORE_X_ATOM_SELECTION_XDND = replies[5]->atom;
ECORE_X_ATOM_XDND_AWARE = replies[6]->atom;
ECORE_X_ATOM_XDND_ENTER = replies[7]->atom;
ECORE_X_ATOM_XDND_TYPE_LIST = replies[8]->atom;
ECORE_X_ATOM_XDND_POSITION = replies[9]->atom;
ECORE_X_ATOM_XDND_ACTION_COPY = replies[10]->atom;
ECORE_X_ATOM_XDND_ACTION_MOVE = replies[11]->atom;
ECORE_X_ATOM_XDND_ACTION_PRIVATE = replies[12]->atom;
ECORE_X_ATOM_XDND_ACTION_ASK = replies[13]->atom;
ECORE_X_ATOM_XDND_ACTION_LIST = replies[14]->atom;
ECORE_X_ATOM_XDND_ACTION_LINK = replies[15]->atom;
ECORE_X_ATOM_XDND_ACTION_DESCRIPTION = replies[16]->atom;
ECORE_X_ATOM_XDND_PROXY = replies[17]->atom;
ECORE_X_ATOM_XDND_STATUS = replies[18]->atom;
ECORE_X_ATOM_XDND_LEAVE = replies[19]->atom;
ECORE_X_ATOM_XDND_DROP = replies[20]->atom;
ECORE_X_ATOM_XDND_FINISHED = replies[21]->atom;
ECORE_X_ATOM_E_FRAME_SIZE = replies[22]->atom;
ECORE_X_ATOM_WIN_LAYER = replies[23]->atom;
ECORE_X_ATOM_WM_PROTOCOLS = replies[24]->atom;
ECORE_X_ATOM_WM_COLORMAP_WINDOWS = replies[25]->atom;
ECORE_X_ATOM_WM_STATE = replies[26]->atom;
ECORE_X_ATOM_WM_CHANGE_STATE = replies[27]->atom;
ECORE_X_ATOM_WM_TAKE_FOCUS = replies[28]->atom;
ECORE_X_ATOM_WM_SAVE_YOURSELF = replies[29]->atom;
ECORE_X_ATOM_WM_DELETE_WINDOW = replies[30]->atom;
ECORE_X_ATOM_WM_COLORMAP_NOTIFY = replies[31]->atom;
ECORE_X_ATOM_SM_CLIENT_ID = replies[32]->atom;
ECORE_X_ATOM_WM_CLIENT_LEADER = replies[33]->atom;
ECORE_X_ATOM_WM_WINDOW_ROLE = replies[34]->atom;
ECORE_X_ATOM_MOTIF_WM_HINTS = replies[35]->atom;
ECORE_X_ATOM_NET_SUPPORTED = replies[36]->atom;
ECORE_X_ATOM_NET_CLIENT_LIST = replies[37]->atom;
ECORE_X_ATOM_NET_CLIENT_LIST_STACKING = replies[38]->atom;
ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS = replies[39]->atom;
ECORE_X_ATOM_NET_DESKTOP_GEOMETRY = replies[40]->atom;
ECORE_X_ATOM_NET_DESKTOP_VIEWPORT = replies[41]->atom;
ECORE_X_ATOM_NET_CURRENT_DESKTOP = replies[42]->atom;
ECORE_X_ATOM_NET_DESKTOP_NAMES = replies[43]->atom;
ECORE_X_ATOM_NET_ACTIVE_WINDOW = replies[44]->atom;
ECORE_X_ATOM_NET_WORKAREA = replies[45]->atom;
ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK = replies[46]->atom;
ECORE_X_ATOM_NET_VIRTUAL_ROOTS = replies[47]->atom;
ECORE_X_ATOM_NET_DESKTOP_LAYOUT = replies[48]->atom;
ECORE_X_ATOM_NET_SHOWING_DESKTOP = replies[49]->atom;
ECORE_X_ATOM_NET_CLOSE_WINDOW = replies[50]->atom;
ECORE_X_ATOM_NET_MOVERESIZE_WINDOW = replies[51]->atom;
ECORE_X_ATOM_NET_WM_MOVERESIZE = replies[52]->atom;
ECORE_X_ATOM_NET_RESTACK_WINDOW = replies[53]->atom;
ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS = replies[54]->atom;
ECORE_X_ATOM_NET_WM_NAME = replies[55]->atom;
ECORE_X_ATOM_NET_WM_VISIBLE_NAME = replies[56]->atom;
ECORE_X_ATOM_NET_WM_ICON_NAME = replies[57]->atom;
ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME = replies[58]->atom;
ECORE_X_ATOM_NET_WM_DESKTOP = replies[59]->atom;
ECORE_X_ATOM_NET_WM_WINDOW_TYPE = replies[60]->atom;
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP = replies[61]->atom;
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK = replies[62]->atom;
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR = replies[63]->atom;
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU = replies[64]->atom;
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY = replies[65]->atom;
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH = replies[66]->atom;
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG = replies[67]->atom;
ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL = replies[68]->atom;
ECORE_X_ATOM_NET_WM_STATE = replies[69]->atom;
ECORE_X_ATOM_NET_WM_STATE_MODAL = replies[70]->atom;
ECORE_X_ATOM_NET_WM_STATE_STICKY = replies[71]->atom;
ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT = replies[72]->atom;
ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ = replies[73]->atom;
ECORE_X_ATOM_NET_WM_STATE_SHADED = replies[74]->atom;
ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR = replies[75]->atom;
ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER = replies[76]->atom;
ECORE_X_ATOM_NET_WM_STATE_HIDDEN = replies[77]->atom;
ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN = replies[78]->atom;
ECORE_X_ATOM_NET_WM_STATE_ABOVE = replies[79]->atom;
ECORE_X_ATOM_NET_WM_STATE_BELOW = replies[80]->atom;
ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION = replies[81]->atom;
ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS = replies[82]->atom;
ECORE_X_ATOM_NET_WM_ACTION_MOVE = replies[83]->atom;
ECORE_X_ATOM_NET_WM_ACTION_RESIZE = replies[84]->atom;
ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE = replies[85]->atom;
ECORE_X_ATOM_NET_WM_ACTION_SHADE = replies[86]->atom;
ECORE_X_ATOM_NET_WM_ACTION_STICK = replies[87]->atom;
ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ = replies[88]->atom;
ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT = replies[89]->atom;
ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN = replies[90]->atom;
ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP = replies[91]->atom;
ECORE_X_ATOM_NET_WM_ACTION_CLOSE = replies[92]->atom;
ECORE_X_ATOM_NET_WM_STRUT = replies[93]->atom;
ECORE_X_ATOM_NET_WM_STRUT_PARTIAL = replies[94]->atom;
ECORE_X_ATOM_NET_WM_ICON_GEOMETRY = replies[95]->atom;
ECORE_X_ATOM_NET_WM_ICON = replies[96]->atom;
ECORE_X_ATOM_NET_WM_PID = replies[97]->atom;
ECORE_X_ATOM_NET_WM_HANDLED_ICONS = replies[98]->atom;
ECORE_X_ATOM_NET_WM_USER_TIME = replies[99]->atom;
ECORE_X_ATOM_NET_STARTUP_ID = replies[100]->atom;
ECORE_X_ATOM_NET_FRAME_EXTENTS = replies[101]->atom;
ECORE_X_ATOM_NET_WM_PING = replies[102]->atom;
ECORE_X_ATOM_NET_WM_SYNC_REQUEST = replies[103]->atom;
ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER = replies[104]->atom;
ECORE_X_ATOM_NET_WM_WINDOW_OPACITY = replies[105]->atom;
ECORE_X_ATOM_NET_WM_WINDOW_SHADOW = replies[106]->atom;
ECORE_X_ATOM_NET_WM_WINDOW_SHADE = replies[107]->atom;
ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN = replies[108]->atom;
ECORE_X_ATOM_NET_STARTUP_INFO = replies[109]->atom;
ECORE_X_ATOM_SELECTION_TARGETS = replies[110]->atom;
ECORE_X_ATOM_SELECTION_CLIPBOARD = replies[111]->atom;
ECORE_X_ATOM_SELECTION_PROP_PRIMARY = replies[112]->atom;
ECORE_X_ATOM_SELECTION_PROP_SECONDARY = replies[113]->atom;
ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD = replies[114]->atom;
for (i = 0; i < ECORE_X_ATOMS_COUNT; i++)
free(replies[i]);
}
/**
* Sends the InternAtom request.
* @param name Name of the requested atom.
* @ingroup Ecore_X_Atom_Group
*/
EAPI void
ecore_x_atom_get_prefetch(const char *name)
{
xcb_intern_atom_cookie_t cookie;
cookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, strlen(name), name);
_ecore_xcb_cookie_cache(cookie.sequence);
}
/**
* Gets the reply of the InternAtom request sent by ecore_x_atom_get_prefetch().
* @ingroup Ecore_X_Atom_Group
*/
EAPI void
ecore_x_atom_get_fetch(void)
{
xcb_intern_atom_cookie_t cookie;
xcb_intern_atom_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
}
/**
* Retrieves the atom value associated to a name.
* @param name Unused.
* @return Associated atom value.
*
* Retrieves the atom value associated to a name. The reply is the
* returned value of the function ecore_xcb_intern_atom_reply(). If
* @p reply is @c NULL, the NULL atom is returned. Otherwise, the atom
* associated to the name is returned.
*
* To use this function, you must call before, and in order,
* ecore_x_atom_get_prefetch(), which sends the InternAtom request,
* then ecore_x_atom_get_fetch(), which gets the reply.
* @ingroup Ecore_X_Atom_Group
*/
EAPI Ecore_X_Atom
ecore_x_atom_get(const char *name __UNUSED__)
{
xcb_intern_atom_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return XCB_NONE;
return reply->atom;
}

View File

@ -0,0 +1,270 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_xcb_private.h"
#include <xcb/shm.h>
#include <xcb/xcb_image.h>
extern int _ecore_xcb_xcursor;
EAPI int
ecore_x_cursor_color_supported_get(void)
{
return _ecore_xcb_xcursor;
}
EAPI Ecore_X_Cursor
ecore_x_cursor_new(Ecore_X_Window window,
int *pixels,
int w,
int h,
int hot_x,
int hot_y)
{
Ecore_X_Cursor cursor = 0;
#ifdef ECORE_XCB_CURSOR
if (_ecore_x_xcursor)
{
Cursor c;
XcursorImage *xci;
xci = XcursorImageCreate(w, h);
if (xci)
{
int i;
xci->xhot = hot_x;
xci->yhot = hot_y;
xci->delay = 0;
for (i = 0; i < (w * h); i++)
{
// int r, g, b, a;
//
// a = (pixels[i] >> 24) & 0xff;
// r = (((pixels[i] >> 16) & 0xff) * a) / 0xff;
// g = (((pixels[i] >> 8 ) & 0xff) * a) / 0xff;
// b = (((pixels[i] ) & 0xff) * a) / 0xff;
xci->pixels[i] = pixels[i];
// (a << 24) | (r << 16) | (g << 8) | (b);
}
c = XcursorImageLoadCursor(_ecore_x_disp, xci);
XcursorImageDestroy(xci);
return c;
}
}
else
#endif /* ECORE_XCB_CURSOR */
{
const uint32_t dither[2][2] =
{
{0, 2},
{3, 1}
};
Ecore_X_Drawable draw;
Ecore_X_Pixmap pixmap;
Ecore_X_Pixmap mask;
Ecore_X_GC gc;
xcb_image_t *image;
uint32_t *pix;
uint8_t fr;
uint8_t fg;
uint8_t fb;
uint8_t br;
uint8_t bg;
uint8_t bb;
uint32_t brightest = 0;
uint32_t darkest = 255 * 3;
uint16_t x;
uint16_t y;
draw = window;
pixmap = xcb_generate_id(_ecore_xcb_conn);
xcb_create_pixmap(_ecore_xcb_conn,
1, pixmap, draw,
1, 1);
mask = xcb_generate_id(_ecore_xcb_conn);
xcb_create_pixmap(_ecore_xcb_conn,
1, mask, draw,
1, 1);
image = xcb_image_create(_ecore_xcb_conn, 1,
XCB_IMAGE_FORMAT_Z_PIXMAP, 0,
NULL, w, h, 32, 0);
image->data = malloc(image->bytes_per_line * image->height);
fr = 0x00; fg = 0x00; fb = 0x00;
br = 0xff; bg = 0xff; bb = 0xff;
pix = (uint32_t *)pixels;
for (y = 0; y < h; y++)
{
for (x = 0; x < w; x++)
{
uint8_t r, g, b, a;
a = (pix[0] >> 24) & 0xff;
r = (pix[0] >> 16) & 0xff;
g = (pix[0] >> 8 ) & 0xff;
b = (pix[0] ) & 0xff;
if (a > 0)
{
if ((uint32_t)(r + g + b) > brightest)
{
brightest = r + g + b;
br = r;
bg = g;
bb = b;
}
if ((uint32_t)(r + g + b) < darkest)
{
darkest = r + g + b;
fr = r;
fg = g;
fb = b;
}
}
pix++;
}
}
pix = (uint32_t *)pixels;
for (y = 0; y < h; y++)
{
for (x = 0; x < w; x++)
{
uint32_t v;
uint8_t r, g, b;
int32_t d1, d2;
r = (pix[0] >> 16) & 0xff;
g = (pix[0] >> 8 ) & 0xff;
b = (pix[0] ) & 0xff;
d1 =
((r - fr) * (r - fr)) +
((g - fg) * (g - fg)) +
((b - fb) * (b - fb));
d2 =
((r - br) * (r - br)) +
((g - bg) * (g - bg)) +
((b - bb) * (b - bb));
if (d1 + d2)
{
v = (((d2 * 255) / (d1 + d2)) * 5) / 256;
if (v > dither[x & 0x1][y & 0x1]) v = 1;
else v = 0;
}
else
{
v = 0;
}
xcb_image_put_pixel(image, x, y, v);
pix++;
}
}
draw = pixmap;
gc = xcb_generate_id(_ecore_xcb_conn);
xcb_create_gc(_ecore_xcb_conn, gc, draw, 0, NULL);
xcb_image_put(_ecore_xcb_conn, draw, gc, image, 0, 0, 0, 0, w, h);
xcb_free_gc(_ecore_xcb_conn, gc);
pix = (uint32_t *)pixels;
for (y = 0; y < h; y++)
{
for (x = 0; x < w; x++)
{
uint32_t v;
v = (((pix[0] >> 24) & 0xff) * 5) / 256;
if (v > dither[x & 0x1][y & 0x1]) v = 1;
else v = 0;
xcb_image_put_pixel(image, x, y, v);
pix++;
}
}
draw = mask;
gc = xcb_generate_id(_ecore_xcb_conn);
xcb_create_gc (_ecore_xcb_conn, gc, draw, 0, NULL);
xcb_image_put(_ecore_xcb_conn, draw, gc, image, 0, 0, 0, 0, w, h);
xcb_free_gc(_ecore_xcb_conn, gc);
free(image->data);
image->data = NULL;
xcb_image_destroy(image);
cursor = xcb_generate_id(_ecore_xcb_conn);
xcb_create_cursor (_ecore_xcb_conn, cursor,
pixmap, mask,
fr << 8 | fr,
fg << 8 | fg,
fb << 8 | fb,
br << 8 | br,
bg << 8 | bg,
bb << 8 | bb,
hot_x,
hot_y);
xcb_free_pixmap(_ecore_xcb_conn, pixmap);
xcb_free_pixmap(_ecore_xcb_conn, mask);
return cursor;
}
return 0;
}
EAPI void
ecore_x_cursor_free(Ecore_X_Cursor cursor)
{
xcb_free_cursor(_ecore_xcb_conn, cursor);
}
/*
* Returns the cursor for the given shape.
* Note that the return value must not be freed with
* ecore_x_cursor_free()!
*/
EAPI Ecore_X_Cursor
ecore_x_cursor_shape_get(int shape)
{
Ecore_X_Cursor cursor;
xcb_font_t font;
/* Shapes are defined in Ecore_X_Cursor.h */
font = xcb_generate_id(_ecore_xcb_conn);
xcb_open_font(_ecore_xcb_conn, font, strlen("cursor"), "cursor");
cursor = xcb_generate_id(_ecore_xcb_conn);
xcb_create_glyph_cursor (_ecore_xcb_conn,
cursor,
font,
font,
shape,
shape + 1,
0, 0, 0,
65535, 65535, 65535);
xcb_close_font(_ecore_xcb_conn, font);
return cursor;
}
EAPI void
ecore_x_cursor_size_set(int size)
{
#ifdef ECORE_XCB_CURSOR
XcursorSetDefaultSize(_ecore_x_disp, size);
#else
size = 0;
#endif /* ECORE_XCB_CURSOR */
}
EAPI int
ecore_x_cursor_size_get(void)
{
#ifdef ECORE_XCB_CURSOR
return XcursorGetDefaultSize(_ecore_x_disp);
#else
return 0;
#endif /* ECORE_XCB_CURSOR */
}

View File

@ -0,0 +1,138 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_xcb_private.h"
/**
* @defgroup Ecore_X_Damage_Group X Damage Extension Functions
*
* Functions related to the X Damage extension.
*/
#ifdef ECORE_XCB_DAMAGE
static uint8_t _damage_available = 0;
static xcb_damage_query_version_cookie_t _ecore_xcb_damage_init_cookie;
#endif /* ECORE_XCB_DAMAGE */
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_damage_init and
_ecore_xcb_damage_init_finalize. The first one gets the cookies and
the second one gets the replies. */
void
_ecore_x_damage_init(const xcb_query_extension_reply_t *reply)
{
#ifdef ECORE_XCB_DAMAGE
if (reply && (reply->present))
_ecore_xcb_damage_init_cookie = xcb_damage_query_version_unchecked(_ecore_xcb_conn, 1, 1);
#endif /* ECORE_XCB_DAMAGE */
}
void
_ecore_x_damage_init_finalize(void)
{
#ifdef ECORE_XCB_DAMAGE
xcb_damage_query_version_reply_t *reply;
reply = xcb_damage_query_version_reply(_ecore_xcb_conn,
_ecore_xcb_damage_init_cookie,
NULL);
if (reply)
{
if (reply->major_version >= 1)
_damage_available = 1;
free(reply);
}
#endif /* ECORE_XCB_DAMAGE */
}
/**
* Return whether the Damage Extension is available.
* @return 1 if the Damage Extension is available, 0 if not.
*
* Return 1 if the X server supports the Damage Extension version 1.0,
* 0 otherwise.
* @ingroup Ecore_X_Damage_Group
*/
EAPI int
ecore_x_damage_query(void)
{
#ifdef ECORE_XCB_DAMAGE
return _damage_available;
#else
return 0;
#endif /* ECORE_XCB_DAMAGE */
}
/**
* Creates a damage object.
* @param drawable The drawable to monotor.
* @param level The level of the damage report.
* @return The damage object.
*
* Creates a damage object to monitor changes to @p drawable, with the
* level @p level.
* @ingroup Ecore_X_Damage_Group
*/
EAPI Ecore_X_Damage
ecore_x_damage_new(Ecore_X_Drawable drawable,
Ecore_X_Damage_Report_Level level)
{
Ecore_X_Damage damage = 0;
#ifdef ECORE_XCB_DAMAGE
damage = xcb_generate_id(_ecore_xcb_conn);
xcb_damage_create(_ecore_xcb_conn, damage, drawable, level);
#endif /* ECORE_XCB_DAMAGE */
return damage;
}
/**
* Destroys a damage object.
* @param damage The damage object to destroy.
*
* Destroys the damage object @p damage.
* @ingroup Ecore_X_Damage_Group
*/
EAPI void
ecore_x_damage_del(Ecore_X_Damage damage)
{
#ifdef ECORE_XCB_DAMAGE
xcb_damage_destroy(_ecore_xcb_conn, damage);
#endif /* ECORE_XCB_DAMAGE */
}
/**
* Synchronously modifies the region.
* @param damage The damage object to destroy.
* @param repair The repair region.
* @param parts The parts region.
*
* Synchronously modifies the regions in the following manner:
* If @p repair is @c XCB_NONE:
* 1) parts = damage
* 2) damage = <empty>
* Otherwise:
* 1) parts = damage INTERSECT repair
* 2) damage = damage - parts
* 3) Generate DamageNotify for remaining damage areas
* @ingroup Ecore_X_Damage_Group
*/
EAPI void
ecore_x_damage_subtract(Ecore_X_Damage damage,
Ecore_X_Region repair,
Ecore_X_Region parts)
{
#ifdef ECORE_XCB_DAMAGE
xcb_damage_subtract(_ecore_xcb_conn, damage, repair, parts);
#endif /* ECORE_XCB_DAMAGE */
}

View File

@ -0,0 +1,749 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "Ecore.h"
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
EAPI int ECORE_X_EVENT_XDND_ENTER = 0;
EAPI int ECORE_X_EVENT_XDND_POSITION = 0;
EAPI int ECORE_X_EVENT_XDND_STATUS = 0;
EAPI int ECORE_X_EVENT_XDND_LEAVE = 0;
EAPI int ECORE_X_EVENT_XDND_DROP = 0;
EAPI int ECORE_X_EVENT_XDND_FINISHED = 0;
static Ecore_X_DND_Source *_source = NULL;
static Ecore_X_DND_Target *_target = NULL;
static int _ecore_x_dnd_init_count = 0;
void
_ecore_x_dnd_init(void)
{
if (!_ecore_x_dnd_init_count)
{
_source = calloc(1, sizeof(Ecore_X_DND_Source));
_source->version = ECORE_X_DND_VERSION;
_source->win = XCB_NONE;
_source->dest = XCB_NONE;
_source->state = ECORE_X_DND_SOURCE_IDLE;
_target = calloc(1, sizeof(Ecore_X_DND_Target));
_target->win = XCB_NONE;
_target->source = XCB_NONE;
_target->state = ECORE_X_DND_TARGET_IDLE;
ECORE_X_EVENT_XDND_ENTER = ecore_event_type_new();
ECORE_X_EVENT_XDND_POSITION = ecore_event_type_new();
ECORE_X_EVENT_XDND_STATUS = ecore_event_type_new();
ECORE_X_EVENT_XDND_LEAVE = ecore_event_type_new();
ECORE_X_EVENT_XDND_DROP = ecore_event_type_new();
ECORE_X_EVENT_XDND_FINISHED = ecore_event_type_new();
}
_ecore_x_dnd_init_count++;
}
void
_ecore_x_dnd_shutdown(void)
{
_ecore_x_dnd_init_count--;
if (_ecore_x_dnd_init_count > 0)
return;
if (_source)
free(_source);
_source = NULL;
if (_target)
free(_target);
_target = NULL;
_ecore_x_dnd_init_count = 0;
}
EAPI void
ecore_x_dnd_aware_set(Ecore_X_Window window,
int on)
{
Ecore_X_Atom prop_data = ECORE_X_DND_VERSION;
if (on)
ecore_x_window_prop_property_set(window, ECORE_X_ATOM_XDND_AWARE,
ECORE_X_ATOM_ATOM, 32, &prop_data, 1);
else
ecore_x_window_prop_property_del(window, ECORE_X_ATOM_XDND_AWARE);
}
/**
* Sends the GetProperty request.
* @param window Window whose properties are requested.
*/
EAPI void
ecore_x_dnd_version_get_prefetch(Ecore_X_Window window)
{
xcb_get_property_cookie_t cookie;
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0,
window ? window : ((xcb_screen_t *)_ecore_xcb_screen)->root,
ECORE_X_ATOM_XDND_AWARE,
ECORE_X_ATOM_ATOM,
0, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
}
/**
* Gets the reply of the GetProperty request sent by ecore_x_dnd_version_get_prefetch().
*/
EAPI void
ecore_x_dnd_version_get_fetch(void)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
}
/**
* Get the DnD version.
* @param window Unused.
* @return 0 on failure, the version otherwise.
*
* Get the DnD version. Returns 0 on failure, the version otherwise.
*
* To use this function, you must call before, and in order,
* ecore_x_dnd_version_get_prefetch(), which sends the GetProperty request,
* then ecore_x_dnd_version_get_fetch(), which gets the reply.
*/
EAPI int
ecore_x_dnd_version_get(Ecore_X_Window window)
{
unsigned char *prop_data;
int num;
if (ecore_x_window_prop_property_get(window, ECORE_X_ATOM_XDND_AWARE,
ECORE_X_ATOM_ATOM, 32, &prop_data, &num))
{
int version = (int) *prop_data;
free(prop_data);
return version;
}
else
return 0;
}
/**
* Sends the GetProperty request.
* @param window Window whose properties are requested.
*/
EAPI void
ecore_x_dnd_type_get_prefetch(Ecore_X_Window window)
{
xcb_get_property_cookie_t cookie;
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0,
window ? window : ((xcb_screen_t *)_ecore_xcb_screen)->root,
ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM,
0, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
}
/**
* Gets the reply of the GetProperty request sent by ecore_x_dnd_type_get_prefetch().
*/
EAPI void
ecore_x_dnd_type_get_fetch(void)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
}
/* FIXME: round trip (InternAtomGet request) */
/**
* Check if the type is set.
* @param window Unused.
* @param type The type to check
* @return 0 on failure, 1 otherwise.
*
* Check if the type is set. 0 on failure, 1 otherwise.
*
* To use this function, you must call before, and in order,
* ecore_x_dnd_type_get_prefetch(), which sends the GetProperty request,
* then ecore_x_dnd_type_get_fetch(), which gets the reply.
*/
EAPI int
ecore_x_dnd_type_isset(Ecore_X_Window window,
const char *type)
{
xcb_intern_atom_cookie_t cookie;
xcb_intern_atom_reply_t *reply;
Ecore_X_Atom *atoms;
unsigned char *data;
int num;
int i;
uint8_t ret = 0;
cookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
strlen(type), type);
if (!ecore_x_window_prop_property_get(window, ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM, 32, &data, &num))
{
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
if (reply) free(reply);
return ret;
}
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply)
{
free(data);
return 0;
}
atoms = (Ecore_X_Atom *)data;
for (i = 0; i < num; ++i)
{
if (reply->atom == atoms[i])
{
ret = 1;
break;
}
}
free(data);
free(reply);
return ret;
}
/* FIXME: round trip (InternAtomGet request) */
/**
* Set the type.
* @param window Unused.
* @param type The type to set
* @param on 0 or non 0...
*
* Set the type.
*
* To use this function, you must call before, and in order,
* ecore_x_dnd_type_get_prefetch(), which sends the GetProperty request,
* then ecore_x_dnd_type_get_fetch(), which gets the reply.
*/
EAPI void
ecore_x_dnd_type_set(Ecore_X_Window window,
const char *type,
int on)
{
xcb_intern_atom_cookie_t cookie;
xcb_intern_atom_reply_t *reply;
Ecore_X_Atom *oldset = NULL;
Ecore_X_Atom *newset = NULL;
unsigned char *data = NULL;
unsigned char *old_data = NULL;
Ecore_X_Atom atom;
int i, j = 0, num = 0;
cookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
strlen(type), type);
atom = ecore_x_atom_get(type);
if (!ecore_x_window_prop_property_get(window, ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM,
32, &old_data, &num))
{
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
if (reply) free(reply);
return;
}
oldset = (Ecore_X_Atom *)old_data;
if (on)
{
if (ecore_x_dnd_type_isset(window, type))
{
free(old_data);
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
if (reply) free(reply);
return;
}
data = calloc(num + 1, sizeof(Ecore_X_Atom));
if (!data)
{
free(old_data);
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
if (reply) free(reply);
return;
}
newset = (Ecore_X_Atom *)data;
for (i = 0; i < num; i++)
newset[i + 1] = oldset[i];
/* prepend the new type */
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply)
{
free(old_data);
return;
}
newset[0] = reply->atom;
free(reply);
ecore_x_window_prop_property_set(window,
ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM,
32, data, num + 1);
}
else
{
if (!ecore_x_dnd_type_isset(window, type))
{
free(old_data);
return;
}
newset = calloc(num - 1, sizeof(Ecore_X_Atom));
if (!newset)
{
free(old_data);
return;
}
data = (unsigned char *)newset;
for (i = 0; i < num; i++)
if (oldset[i] != atom)
newset[j++] = oldset[i];
ecore_x_window_prop_property_set(window,
ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM,
32, data, num - 1);
}
free(oldset);
free(newset);
}
/* FIXME: round trips, but I don't think we can do much, here */
/**
* Set the types.
* @param window Unused.
* @param types The types to set
* @param num_types The number of types
*
* Set the types.
*
* To use this function, you must call before, and in order,
* ecore_x_dnd_type_get_prefetch(), which sends the GetProperty request,
* then ecore_x_dnd_type_get_fetch(), which gets the reply.
*/
EAPI void
ecore_x_dnd_types_set(Ecore_X_Window window,
char **types,
unsigned int num_types)
{
Ecore_X_Atom *newset = NULL;
void *data = NULL;
uint32_t i;
if (!num_types)
{
ecore_x_window_prop_property_del(window, ECORE_X_ATOM_XDND_TYPE_LIST);
}
else
{
xcb_intern_atom_cookie_t *cookies;
xcb_intern_atom_reply_t *reply;
cookies = (xcb_intern_atom_cookie_t *)malloc(sizeof(xcb_intern_atom_cookie_t));
if (!cookies) return;
for (i = 0; i < num_types; i++)
cookies[i] = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0,
strlen(types[i]), types[i]);
data = calloc(num_types, sizeof(Ecore_X_Atom));
if (!data)
{
for (i = 0; i < num_types; i++)
{
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], NULL);
if (reply) free(reply);
}
free(cookies);
return;
}
newset = data;
for (i = 0; i < num_types; i++)
{
reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], NULL);
if (reply)
{
newset[i] = reply->atom;
free(reply);
}
else
newset[i] = XCB_NONE;
}
free(cookies);
ecore_x_window_prop_property_set(window, ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM, 32, data, num_types);
free(data);
}
}
Ecore_X_DND_Source *
_ecore_x_dnd_source_get(void)
{
return _source;
}
Ecore_X_DND_Target *
_ecore_x_dnd_target_get(void)
{
return _target;
}
/**
* Sends the GetProperty request.
* @param source Window whose properties are requested.
*/
EAPI void
ecore_x_dnd_begin_prefetch(Ecore_X_Window source)
{
xcb_get_property_cookie_t cookie;
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0,
source ? source : ((xcb_screen_t *)_ecore_xcb_screen)->root,
ECORE_X_ATOM_XDND_AWARE,
ECORE_X_ATOM_ATOM,
0, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
}
/**
* Gets the reply of the GetProperty request sent by ecore_x_dnd_begin_prefetch().
*/
EAPI void
ecore_x_dnd_begin_fetch(void)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
}
/* FIXME: round trip */
/**
* Begins the DnD.
* @param source Unused.
* @param data The data.
* @param size The size of the data.
* @return 0 on failure, 1 otherwise.
*
* Begins the DnD. Returns 0 on failure, 1 otherwise.
*
* To use this function, you must call before, and in order,
* ecore_x_dnd_begin_prefetch(), which sends the GetProperty request,
* then ecore_x_dnd_begin_fetch(), which gets the reply.
*/
EAPI int
ecore_x_dnd_begin(Ecore_X_Window source,
unsigned char *data,
int size)
{
ecore_x_selection_xdnd_prefetch();
if (!ecore_x_dnd_version_get(source))
{
ecore_x_selection_xdnd_fetch();
return 0;
}
/* Take ownership of XdndSelection */
ecore_x_selection_xdnd_prefetch();
ecore_x_selection_xdnd_fetch();
if (!ecore_x_selection_xdnd_set(source, data, size))
return 0;
_source->win = source;
ecore_x_window_ignore_set(_source->win, 1);
_source->state = ECORE_X_DND_SOURCE_DRAGGING;
_source->time = _ecore_xcb_event_last_time;
/* Default Accepted Action: ask */
_source->action = ECORE_X_ATOM_XDND_ACTION_COPY;
_source->accepted_action = XCB_NONE;
return 1;
}
EAPI int
ecore_x_dnd_drop(void)
{
uint8_t status = 0;
if (_source->dest)
{
xcb_client_message_event_t ev;
ev.response_type = XCB_CLIENT_MESSAGE;
ev.format = 32;
ev.window = _source->dest;
if (_source->will_accept)
{
ev.type = ECORE_X_ATOM_XDND_DROP;
ev.data.data32[0] = _source->win;
ev.data.data32[1] = 0;
ev.data.data32[2] = _source->time;
xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
_source->state = ECORE_X_DND_SOURCE_DROPPED;
status = 1;
}
else
{
ev.type = ECORE_X_ATOM_XDND_LEAVE;
ev.data.data32[0] = _source->win;
ev.data.data32[1] = 0;
xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
_source->state = ECORE_X_DND_SOURCE_IDLE;
}
}
else
{
/* Dropping on nothing */
ecore_x_selection_xdnd_clear();
_source->state = ECORE_X_DND_SOURCE_IDLE;
}
ecore_x_window_ignore_set(_source->win, 0);
_source->dest = XCB_NONE;
return status;
}
EAPI void
ecore_x_dnd_send_status(int will_accept,
int suppress,
Ecore_X_Rectangle rectangle,
Ecore_X_Atom action)
{
xcb_client_message_event_t ev;
if (_target->state == ECORE_X_DND_TARGET_IDLE)
return;
_target->will_accept = will_accept;
ev.response_type = XCB_CLIENT_MESSAGE;
ev.format = 32;
ev.window = _target->source;
ev.type = ECORE_X_ATOM_XDND_STATUS;
ev.data.data32[0] = _target->win;
ev.data.data32[1] = 0;
if (will_accept)
ev.data.data32[1] |= 0x1UL;
if (!suppress)
ev.data.data32[1] |= 0x2UL;
/* Set rectangle information */
ev.data.data32[2] = rectangle.x;
ev.data.data32[2] <<= 16;
ev.data.data32[2] |= rectangle.y;
ev.data.data32[3] = rectangle.width;
ev.data.data32[3] <<= 16;
ev.data.data32[3] |= rectangle.height;
if (will_accept)
{
ev.data.data32[4] = action;
_target->accepted_action = action;
}
else
{
ev.data.data32[4] = XCB_NONE;
_target->accepted_action = action;
}
xcb_send_event(_ecore_xcb_conn, 0, _target->source, 0, (const char *)&ev);
}
EAPI void
ecore_x_dnd_send_finished(void)
{
xcb_client_message_event_t ev;
if (_target->state == ECORE_X_DND_TARGET_IDLE)
return;
ev.response_type = XCB_CLIENT_MESSAGE;
ev.format = 32;
ev.window = _target->source;
ev.type = ECORE_X_ATOM_XDND_FINISHED;
ev.data.data32[0] = _target->win;
ev.data.data32[1] = 0;
ev.data.data32[2] = 0;
if (_target->will_accept)
{
ev.data.data32[1] |= 0x1UL;
ev.data.data32[2] = _target->accepted_action;
}
xcb_send_event(_ecore_xcb_conn, 0, _target->source, 0, (const char *)&ev);
_target->state = ECORE_X_DND_TARGET_IDLE;
}
void
_ecore_x_dnd_drag(int x,
int y)
{
xcb_client_message_event_t ev;
Ecore_X_Window win;
Ecore_X_Window *skip;
int num;
if (_source->state != ECORE_X_DND_SOURCE_DRAGGING)
return;
ev.response_type = XCB_CLIENT_MESSAGE;
ev.format = 32;
/* Attempt to find a DND-capable window under the cursor */
skip = ecore_x_window_ignore_list(&num);
win = ecore_x_window_at_xy_with_skip_get(x, y, skip, num);
while (win)
{
xcb_query_tree_cookie_t cookie_tree;
xcb_query_tree_reply_t *reply_tree;
ecore_x_dnd_version_get_prefetch(win);
cookie_tree = xcb_query_tree_unchecked(_ecore_xcb_conn, win);
ecore_x_dnd_version_get_fetch();
/* We found the correct window ? */
if (ecore_x_dnd_version_get(win))
{
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
if (reply_tree) free(reply_tree);
break;
}
reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL);
if (reply_tree)
{
win = reply_tree->parent;
free(reply_tree);
}
}
/* Send XdndLeave to current destination window if we have left it */
if ((_source->dest) && (win != _source->dest))
{
ev.window = _source->dest;
ev.type = ECORE_X_ATOM_XDND_LEAVE;
ev.data.data32[0] = _source->win;
ev.data.data32[1] = 0;
xcb_send_event(_ecore_xcb_conn, 0, _source->dest, 0, (const char *)&ev);
_source->suppress = 0;
}
if (win)
{
int16_t x1;
int16_t x2;
int16_t y1;
int16_t y2;
ecore_x_dnd_version_get_prefetch(win);
ecore_x_dnd_type_get_prefetch(_source->win);
ecore_x_dnd_version_get_fetch();
if (!ecore_x_dnd_version_get(win))
{
ecore_x_dnd_type_get_fetch();
return;
}
_source->version = MIN(ECORE_X_DND_VERSION,
ecore_x_dnd_version_get(win));
if (win != _source->dest)
{
unsigned char *data;
Ecore_X_Atom *types;
int num;
int i;
ecore_x_dnd_type_get_fetch();
if (!ecore_x_window_prop_property_get(_source->win,
ECORE_X_ATOM_XDND_TYPE_LIST,
ECORE_X_ATOM_ATOM,
32, &data, &num))
return;
types = (Ecore_X_Atom *)data;
/* Entered new window, send XdndEnter */
ev.window = win;
ev.type = ECORE_X_ATOM_XDND_ENTER;
ev.data.data32[0] = _source->win;
ev.data.data32[1] = 0;
if (num > 3)
ev.data.data32[1] |= 0x1UL;
else
ev.data.data32[1] &= 0xfffffffeUL;
ev.data.data32[1] |= ((unsigned long) _source->version) << 24;
for (i = 2; i < 5; i++)
ev.data.data32[i] = 0;
for (i = 0; i < MIN(num, 3); ++i)
ev.data.data32[i + 2] = types[i];
free(data);
xcb_send_event(_ecore_xcb_conn, 0, win, 0, (const char *)&ev);
_source->await_status = 0;
_source->will_accept = 0;
}
else
ecore_x_dnd_type_get_fetch();
/* Determine if we're still in the rectangle from the last status */
x1 = _source->rectangle.x;
x2 = _source->rectangle.x + _source->rectangle.width;
y1 = _source->rectangle.y;
y2 = _source->rectangle.y + _source->rectangle.height;
if ((!_source->await_status) ||
(!_source->suppress) ||
((x < x1) || (x > x2) || (y < y1) || (y > y2)))
{
ev.window = win;
ev.type = ECORE_X_ATOM_XDND_POSITION;
ev.data.data32[0] = _source->win;
ev.data.data32[1] = 0; /* Reserved */
ev.data.data32[2] = ((x << 16) & 0xffff0000) | (y & 0xffff);
ev.data.data32[3] = _source->time; /* Version 1 */
ev.data.data32[4] = _source->action; /* Version 2, Needs to be pre-set */
xcb_send_event(_ecore_xcb_conn, 0, win, 0, (const char *)&ev);
_source->await_status = 1;
}
}
_source->dest = win;
}

View File

@ -0,0 +1,451 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_xcb_private.h"
/**
* @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions
*
* Functions related to the X DPMS extension.
*/
#ifdef ECORE_XCB_DPMS
static int _dpms_available = 0;
static xcb_dpms_get_version_cookie_t _ecore_xcb_dpms_init_cookie;
#endif /* ECORE_XCB_DPMS */
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_dpms_init and
_ecore_xcb_dpms_init_finalize. The first one gets the cookies and
the second one gets the replies. */
void
_ecore_x_dpms_init(const xcb_query_extension_reply_t *reply)
{
#ifdef ECORE_XCB_DPMS
if (reply && (reply->present))
_ecore_xcb_dpms_init_cookie = xcb_dpms_get_version_unchecked(_ecore_xcb_conn, 0, 0);
#endif /* ECORE_XCB_DPMS */
}
void
_ecore_x_dpms_init_finalize(void)
{
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_version_reply_t *reply;
reply = xcb_dpms_get_version_reply(_ecore_xcb_conn,
_ecore_xcb_dpms_init_cookie, NULL);
if (reply)
{
if (reply->server_major_version >= 1)
_dpms_available = 1;
free(reply);
}
#endif /* ECORE_XCB_DPMS */
}
/**
* Checks if the DPMS extension is available or not.
* @return @c 1 if the DPMS extension is available, @c 0 otherwise.
*
* Return 1 if the X server supports the DPMS Extension version 1.0,
* 0 otherwise.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI int
ecore_x_dpms_query(void)
{
#ifdef ECORE_XCB_DPMS
return _dpms_available;
#else
return 0;
#endif /* ECORE_XCB_DPMS */
}
/**
* Sends the DPMSCapable request.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
ecore_x_dpms_capable_get_prefetch(void)
{
#ifdef ECORE_XCB_DPMS
xcb_dpms_capable_cookie_t cookie;
cookie = xcb_dpms_capable_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_DPMS */
}
/**
* Gets the reply of the DPMSCapable request sent by ecore_x_dpms_capable_get_prefetch().
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
ecore_x_dpms_capable_get_fetch(void)
{
#ifdef ECORE_XCB_DPMS
xcb_dpms_capable_cookie_t cookie;
xcb_dpms_capable_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_dpms_capable_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_DPMS */
}
/**
* Checks if the X server is capable of DPMS.
* @return @c 1 if the X server is capable of DPMS, @c 0 otherwise.
*
* To use this function, you must call before, and in order,
* ecore_x_dpms_capable_get_prefetch(), which sends the DPMSCapable request,
* then ecore_x_dpms_capable_get_fetch(), which gets the reply.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI int
ecore_x_dpms_capable_get(void)
{
int capable = 0;
#ifdef ECORE_XCB_DPMS
xcb_dpms_capable_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return 0;
capable = reply->capable;
#endif /* ECORE_XCB_DPMS */
return capable;
}
/**
* Sends the DPMSInfo request.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
ecore_x_dpms_enable_get_prefetch(void)
{
#ifdef ECORE_XCB_DPMS
xcb_dpms_info_cookie_t cookie;
cookie = xcb_dpms_info_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_DPMS */
}
/**
* Gets the reply of the DPMSInfo request sent by ecore_x_dpms_enable_get_prefetch().
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
ecore_x_dpms_enable_get_fetch(void)
{
#ifdef ECORE_XCB_DPMS
xcb_dpms_info_cookie_t cookie;
xcb_dpms_info_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_dpms_info_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_DPMS */
}
/**
* Checks the DPMS state of the display.
* @return @c 1 if DPMS is enabled, @c 0 otherwise.
*
* To use this function, you must call before, and in order,
* ecore_x_dpms_enapable_get_prefetch(), which sends the DPMSInfo request,
* then ecore_x_dpms_enapable_get_fetch(), which gets the reply.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI int
ecore_x_dpms_enable_get(void)
{
int enable = 0;
#ifdef ECORE_XCB_DPMS
xcb_dpms_info_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return 0;
enable = reply->state;
#endif /* ECORE_XCB_DPMS */
return enable;
}
/**
* Sets the DPMS state of the display.
* @param enabled @c 0 to disable DPMS characteristics of the server, enable it otherwise.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
ecore_x_dpms_enabled_set(int enabled)
{
#ifdef ECORE_XCB_DPMS
if (enabled)
xcb_dpms_enable(_ecore_xcb_conn);
else
xcb_dpms_disable(_ecore_xcb_conn);
#endif /* ECORE_XCB_DPMS */
}
/**
* Sets the timeouts. The values are in unit of seconds.
* @param standby Amount of time of inactivity before standby mode will be invoked.
* @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
* @param off Amount of time of inactivity before the monitor is shut off.
* @return Returns always 1.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI int
ecore_x_dpms_timeouts_set(unsigned int standby,
unsigned int suspend,
unsigned int off)
{
#ifdef ECORE_XCB_DPMS
xcb_dpms_set_timeouts(_ecore_xcb_conn, standby, suspend, off);
#endif /* ECORE_XCB_DPMS */
return 1;
}
/**
* Sends the DPMSGetTimeouts request.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
ecore_x_dpms_timeouts_get_prefetch(void)
{
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_timeouts_cookie_t cookie;
cookie = xcb_dpms_get_timeouts_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_DPMS */
}
/**
* Gets the reply of the DPMSGetTimeouts request sent by ecore_x_dpms_timeouts_get_prefetch().
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
ecore_x_dpms_timeouts_get_fetch(void)
{
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_timeouts_cookie_t cookie;
xcb_dpms_get_timeouts_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_dpms_get_timeouts_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_DPMS */
}
/**
* Gets the timeouts. The values are in unit of seconds.
* @param standby Amount of time of inactivity before standby mode will be invoked.
* @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
* @param off Amount of time of inactivity before the monitor is shut off.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
ecore_x_dpms_timeouts_get(unsigned int *standby,
unsigned int *suspend,
unsigned int *off)
{
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (reply)
{
if (standby) *standby = reply->standby_timeout;
if (suspend) *suspend = reply->suspend_timeout;
if (off) *off = 0;
}
else
#endif /* ECORE_XCB_DPMS */
{
if (standby) *standby = 0;
if (suspend) *suspend = 0;
if (off) *off = 0;
}
}
/**
* Returns the amount of time of inactivity before standby mode is invoked.
* @return The standby timeout value.
*
* To use this function, you must call before, and in order,
* ecore_x_dpms_timeouts_get_prefetch(), which sends the DPMSGetTimeouts request,
* then ecore_x_dpms_timeouts_get_fetch(), which gets the reply.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI unsigned int
ecore_x_dpms_timeout_standby_get(void)
{
int standby = 0;
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return 0;
standby = reply->standby_timeout;
#endif /* ECORE_XCB_DPMS */
return standby;
}
/**
* Returns the amount of time of inactivity before the second level of
* power saving is invoked.
* @return The suspend timeout value.
*
* To use this function, you must call before, and in order,
* ecore_x_dpms_timeouts_get_prefetch(), which sends the DPMSGetTimeouts request,
* then ecore_x_dpms_timeouts_get_fetch(), which gets the reply.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI unsigned int
ecore_x_dpms_timeout_suspend_get(void)
{
int suspend = 0;;
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return 0;
suspend = reply->suspend_timeout;
#endif /* ECORE_XCB_DPMS */
return suspend;
}
/**
* Returns the amount of time of inactivity before the third and final
* level of power saving is invoked.
* @return The off timeout value.
*
* To use this function, you must call before, and in order,
* ecore_x_dpms_timeouts_get_prefetch(), which sends the DPMSGetTimeouts request,
* then ecore_x_dpms_timeouts_get_fetch(), which gets the reply.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI unsigned int
ecore_x_dpms_timeout_off_get(void)
{
int off = 0;
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return 0;
off = reply->off_timeout;
#endif /* ECORE_XCB_DPMS */
return off;
}
/**
* Sets the standby timeout (in unit of seconds).
* @param new_standby Amount of time of inactivity before standby mode will be invoked.
*
* To use this function, you must call before, and in order,
* ecore_x_dpms_timeouts_get_prefetch(), which sends the DPMSGetTimeouts request,
* then ecore_x_dpms_timeouts_get_fetch(), which gets the reply.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
ecore_x_dpms_timeout_standby_set(unsigned int new_standby)
{
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return;
xcb_dpms_set_timeouts(_ecore_xcb_conn,
new_standby,
reply->suspend_timeout,
reply->off_timeout);
#endif /* ECORE_XCB_DPMS */
}
/**
* Sets the suspend timeout (in unit of seconds).
* @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
*
* To use this function, you must call before, and in order,
* ecore_x_dpms_timeouts_get_prefetch(), which sends the DPMSGetTimeouts request,
* then ecore_x_dpms_timeouts_get_fetch(), which gets the reply.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
ecore_x_dpms_timeout_suspend_set(unsigned int new_suspend)
{
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return;
xcb_dpms_set_timeouts(_ecore_xcb_conn,
reply->standby_timeout,
new_suspend,
reply->off_timeout);
#endif /* ECORE_XCB_DPMS */
}
/**
* Sets the off timeout (in unit of seconds).
* @param off Amount of time of inactivity before the monitor is shut off.
*
* To use this function, you must call before, and in order,
* ecore_x_dpms_timeouts_get_prefetch(), which sends the DPMSGetTimeouts request,
* then ecore_x_dpms_timeouts_get_fetch(), which gets the reply.
* @ingroup Ecore_X_DPMS_Group
*/
EAPI void
ecore_x_dpms_timeout_off_set(unsigned int new_off)
{
#ifdef ECORE_XCB_DPMS
xcb_dpms_get_timeouts_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return;
xcb_dpms_set_timeouts(_ecore_xcb_conn,
reply->standby_timeout,
reply->suspend_timeout,
new_off);
#endif /* ECORE_XCB_DPMS */
}

View File

@ -0,0 +1,129 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_xcb_private.h"
#include <xcb/xcb.h>
/**
* @defgroup Ecore_X_Drawable_Group X Drawable Functions
*
* Functions that operate on drawables.
*/
/**
* Sends the GetGeometry request.
* @param drawable Drawable whose characteristics are sought.
* @ingroup Ecore_X_Drawable_Group
*/
EAPI void
ecore_x_drawable_geometry_get_prefetch(Ecore_X_Drawable drawable)
{
xcb_get_geometry_cookie_t cookie;
cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, drawable);
_ecore_xcb_cookie_cache(cookie.sequence);
}
/**
* Gets the reply of the GetGeometry request sent by ecore_x_atom_get_prefetch().
* @ingroup Ecore_X_Drawable_Group
*/
EAPI void
ecore_x_drawable_geometry_get_fetch(void)
{
xcb_get_geometry_cookie_t cookie;
xcb_get_geometry_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
}
/**
* Retrieves the geometry of the given drawable.
* @param drawable Unused.
* @param x Pointer to an integer into which the X position is to be stored.
* @param y Pointer to an integer into which the Y position is to be stored.
* @param width Pointer to an integer into which the width is to be stored.
* @param height Pointer to an integer into which the height is to be stored.
*
* To use this function, you must call before, and in order,
* ecore_x_drawable_geometry_get_prefetch(), which sends the GetGeometry request,
* then ecore_x_drawable_geometry_get_fetch(), which gets the reply.
* @ingroup Ecore_X_Drawable_Group
*/
EAPI void
ecore_x_drawable_geometry_get(Ecore_X_Drawable drawable __UNUSED__,
int *x,
int *y,
int *width,
int *height)
{
xcb_get_geometry_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
{
if (x) *x = 0;
if (y) *y = 0;
if (width) *width = 0;
if (height) *height = 0;
return;
}
if (x) *x = reply->x;
if (y) *y = reply->y;
if (width) *width = reply->width;
if (height) *height = reply->height;
}
/**
* Retrieves the width of the border of the given drawable.
* @param drawable Unused.
* @return The border width of the given drawable.
*
* To use this function, you must call before, and in order,
* ecore_x_drawable_geometry_get_prefetch(), which sends the GetGeometry request,
* then ecore_x_drawable_geometry_get_fetch(), which gets the reply.
* @ingroup Ecore_X_Drawable_Group
*/
EAPI int
ecore_x_drawable_border_width_get(Ecore_X_Drawable drawable __UNUSED__)
{
xcb_get_geometry_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
return 0;
return reply->border_width;
}
/**
* Retrieves the depth of the given drawable.
* @param drawable Unused.
* @return The depth of the given drawable.
*
* To use this function, you must call before, and in order,
* ecore_x_drawable_geometry_get_prefetch(), which sends the GetGeometry request,
* then ecore_x_drawable_geometry_get_fetch(), which gets the reply.
* @ingroup Ecore_X_Drawable_Group
*/
EAPI int
ecore_x_drawable_depth_get(Ecore_X_Drawable drawable __UNUSED__)
{
xcb_get_geometry_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
return 0;
return reply->depth;
}

View File

@ -0,0 +1,29 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
/*
* OLD E hints
*/
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
EAPI void
ecore_x_e_frame_size_set(Ecore_X_Window window,
int fl,
int fr,
int ft,
int fb)
{
uint32_t frames[4];
frames[0] = fl;
frames[1] = fr;
frames[2] = ft;
frames[3] = fb;
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_E_FRAME_SIZE, ECORE_X_ATOM_CARDINAL, 32,
4, (const void *)frames);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,581 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_xcb_private.h"
/**
* @defgroup Ecore_X_Fixes_Group X Fixes Extension Functions
*
* Functions related to the X Fixes extension.
*/
#ifdef ECORE_XCB_FIXES
static int _xfixes_available = 0;
static xcb_xfixes_query_version_cookie_t _ecore_xcb_xfixes_init_cookie;
#endif /* ECORE_XCB_FIXES */
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_xfixes_init and
_ecore_xcb_xfixes_init_finalize. The first one gets the cookies and
the second one gets the replies and set the atoms. */
void
_ecore_x_xfixes_init(const xcb_query_extension_reply_t *reply)
{
#ifdef ECORE_XCB_FIXES
if (reply && (reply->present))
_ecore_xcb_xfixes_init_cookie = xcb_xfixes_query_version_unchecked(_ecore_xcb_conn, 4, 0);
#endif /* ECORE_XCB_FIXES */
}
void
_ecore_x_xfixes_init_finalize(void)
{
#ifdef ECORE_XCB_FIXES
xcb_xfixes_query_version_reply_t *reply;
reply = xcb_xfixes_query_version_reply(_ecore_xcb_conn,
_ecore_xcb_xfixes_init_cookie, NULL);
if (reply)
{
if (reply->major_version >= 3)
_xfixes_available = 1;
free(reply);
}
#endif /* ECORE_XCB_FIXES */
}
/**
* Return whether the X server supports the Fixes Extension.
* @return 1 if the X Fixes Extension is available, 0 otherwise.
*
* Return 1 if the X server supports the Fixes Extension version 3.0,
* 0 otherwise.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI int
ecore_x_xfixes_query(void)
{
#ifdef ECORE_XCB_FIXES
return _xfixes_available;
#else
return 0;
#endif /* ECORE_XCB_FIXES */
}
/**
* Create a region from rectangles.
* @param rects The rectangles used to initialize the region.
* @param num The number of rectangles.
* @return The newly created region.
*
* Create a region initialized to the specified list of rectangles
* @p rects. The rectangles may be specified in any order, their union
* becomes the region.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI Ecore_X_Region
ecore_x_region_new(Ecore_X_Rectangle *rects,
int num)
{
Ecore_X_Region region = XCB_NONE;
#ifdef ECORE_XCB_FIXES
region = xcb_generate_id(_ecore_xcb_conn);
xcb_xfixes_create_region(_ecore_xcb_conn, region, num, (xcb_rectangle_t *)rects);
#endif /* ECORE_XCB_FIXES */
return region;
}
/**
* Create a region from a pixmap.
* @param bitmap The bitmap used to initialize the region.
* @return The newly created region.
*
* Creates a region initialized to the set of 'one' pixels in @p bitmap
* (which must be of depth 1, else Match error).
* @ingroup Ecore_X_Fixes_Group
*/
EAPI Ecore_X_Region
ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap)
{
Ecore_X_Region region = XCB_NONE;
#ifdef ECORE_XCB_FIXES
region = xcb_generate_id(_ecore_xcb_conn);
xcb_xfixes_create_region_from_bitmap(_ecore_xcb_conn, region, bitmap);
#endif /* ECORE_XCB_FIXES */
return region;
}
/**
* Create a region from a window.
* @param window The window used to initialize the region.
* @param type The type of the region.
* @return The newly created region.
*
* Creates a region initialized to the specified @p window region. See
* the Shape extension for the definition of Bounding and Clip
* regions.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI Ecore_X_Region
ecore_x_region_new_from_window(Ecore_X_Window window,
Ecore_X_Region_Type type)
{
Ecore_X_Region region = XCB_NONE;
#ifdef ECORE_XCB_FIXES
region = xcb_generate_id(_ecore_xcb_conn);
xcb_xfixes_create_region_from_window(_ecore_xcb_conn, region, window, type);
#endif /* ECORE_XCB_FIXES */
return region;
}
/**
* Create a region from a graphic context.
* @param gc The graphic context used to initialize the region.
* @return The newly created region.
*
* Creates a region initialized from the clip list of @p gc.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI Ecore_X_Region
ecore_x_region_new_from_gc(Ecore_X_GC gc)
{
Ecore_X_Region region = XCB_NONE;
#ifdef ECORE_XCB_FIXES
region = xcb_generate_id(_ecore_xcb_conn);
xcb_xfixes_create_region_from_gc(_ecore_xcb_conn, region, gc);
#endif /* ECORE_XCB_FIXES */
return region;
}
/**
* Create a region from a picture.
* @param picture The picture used to initialize the region.
* @return The newly created region.
*
* Creates a region initialized from the clip list of @p picture.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI Ecore_X_Region
ecore_x_region_new_from_picture(Ecore_X_Picture picture)
{
Ecore_X_Region region = XCB_NONE;
#ifdef ECORE_XCB_FIXES
region = xcb_generate_id(_ecore_xcb_conn);
xcb_xfixes_create_region_from_picture(_ecore_xcb_conn, region, picture);
#endif /* ECORE_XCB_FIXES */
return region;
}
/**
* Destroy a region.
* @param region The region to destroy.
*
* Destroy the specified @p region.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_del(Ecore_X_Region region)
{
#ifdef ECORE_XCB_FIXES
xcb_xfixes_destroy_region(_ecore_xcb_conn, region);
#endif /* ECORE_XCB_FIXES */
}
/**
* Set the content of a region.
* @param region The region to destroy.
* @param rects The rectangles used to set the region.
* @param num The number of rectangles.
*
* Replace the current contents of @p region with the region formed
* by the union of the rectangles @p rects.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_set(Ecore_X_Region region,
Ecore_X_Rectangle *rects,
int num)
{
#ifdef ECORE_XCB_FIXES
xcb_xfixes_set_region(_ecore_xcb_conn, region, num, (xcb_rectangle_t *)rects);
#endif /* ECORE_XCB_FIXES */
}
/**
* Copy the content of a region.
* @param dest The destination region.
* @param source The source region.
*
* Replace the contents of @p dest with the contents of @p source.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_copy(Ecore_X_Region dest,
Ecore_X_Region source)
{
#ifdef ECORE_XCB_FIXES
xcb_xfixes_copy_region(_ecore_xcb_conn, source, dest);
#endif /* ECORE_XCB_FIXES */
}
/**
* Make the union of two regions.
* @param dest The destination region.
* @param source1 The first source region.
* @param source2 The second source region.
*
* Replace the contents of @p dest with the union of @p source1 and
* @p source2.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_combine(Ecore_X_Region dest,
Ecore_X_Region source1,
Ecore_X_Region source2)
{
#ifdef ECORE_XCB_FIXES
xcb_xfixes_union_region(_ecore_xcb_conn, source1, source2, dest);
#endif /* ECORE_XCB_FIXES */
}
/**
* Make the intersection of two regions.
* @param dest The destination region.
* @param source1 The first source region.
* @param source2 The second source region.
*
* Replace the contents of @p dest with the intersection of @p source1 and
* @p source2.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_intersect(Ecore_X_Region dest,
Ecore_X_Region source1,
Ecore_X_Region source2)
{
#ifdef ECORE_XCB_FIXES
xcb_xfixes_intersect_region(_ecore_xcb_conn, source1, source2, dest);
#endif /* ECORE_XCB_FIXES */
}
/**
* Make the substraction of two regions.
* @param dest The destination region.
* @param source1 The first source region.
* @param source2 The second source region.
*
* Replace the contents of @p dest with the substraction of @p source1 by
* @p source2.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_subtract(Ecore_X_Region dest,
Ecore_X_Region source1,
Ecore_X_Region source2)
{
#ifdef ECORE_XCB_FIXES
xcb_xfixes_subtract_region(_ecore_xcb_conn, source1, source2, dest);
#endif /* ECORE_XCB_FIXES */
}
/**
* Make the substraction of regions by bounds.
* @param dest The destination region.
* @param bounds The bounds.
* @param source The source region.
*
* The @p source region is subtracted from the region specified by
* @p bounds. The result is placed in @p dest, replacing its
* contents.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_invert(Ecore_X_Region dest,
Ecore_X_Rectangle *bounds,
Ecore_X_Region source)
{
#ifdef ECORE_XCB_FIXES
xcb_rectangle_t rect;
rect.x = bounds->x;
rect.y = bounds->y;
rect.width = bounds->width;
rect.height = bounds->height;
xcb_xfixes_invert_region(_ecore_xcb_conn, source, rect, dest);
#endif /* ECORE_XCB_FIXES */
}
/**
* Translate a region.
* @param region The region to translate.
* @param dx The horizontal translation.
* @param dy The vertical translation.
*
* The @p region is translated by @p dx and @p dy in place.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_translate(Ecore_X_Region region,
int dx,
int dy)
{
#ifdef ECORE_XCB_FIXES
xcb_xfixes_translate_region(_ecore_xcb_conn, region, dx, dy);
#endif /* ECORE_XCB_FIXES */
}
/**
* Extent a region.
* @param dest The destination region.
* @param source The source region.
*
* The extents of the @p source region are placed in @p dest.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_extents(Ecore_X_Region dest,
Ecore_X_Region source)
{
#ifdef ECORE_XCB_FIXES
xcb_xfixes_region_extents(_ecore_xcb_conn, source, dest);
#endif /* ECORE_XCB_FIXES */
}
/**
* Sends the XFixesFetchRegion request.
* @param region Requested region.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_fetch_prefetch(Ecore_X_Region region)
{
#ifdef ECORE_XCB_FIXES
xcb_xfixes_fetch_region_cookie_t cookie;
cookie = xcb_xfixes_fetch_region_unchecked(_ecore_xcb_conn, region);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_FIXES */
}
/**
* Gets the reply of the XFixesFetchRegion request sent by ecore_xcb_region_fetch_prefetch().
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_fetch_fetch(void)
{
#ifdef ECORE_XCB_FIXES
xcb_xfixes_fetch_region_cookie_t cookie;
xcb_xfixes_fetch_region_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_xfixes_fetch_region_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_FIXES */
}
/**
* Return the rectangles that compose a region.
* @param region The region (Unused).
* @param num The number of returned rectangles.
* @param bounds The returned bounds of the region.
* @return The returned rectangles.
*
* The @p region passed to ecore_xcb_region_fetch_prefetch() is
* returned as a list of rectagles in XY-banded order.
*
* To use this function, you must call before, and in order,
* ecore_xcb_region_fetch_prefetch(), which sends the XFixesFetchRegion request,
* then ecore_xcb_region_fetch_fetch(), which gets the reply.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI Ecore_X_Rectangle *
ecore_x_region_fetch(Ecore_X_Region region __UNUSED__,
int *num,
Ecore_X_Rectangle *bounds)
{
Ecore_X_Rectangle extents = { 0, 0, 0, 0};
Ecore_X_Rectangle *rects = NULL;
#ifdef ECORE_XCB_FIXES
int n;
xcb_xfixes_fetch_region_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
{
if (num) *num = 0;
if (bounds) *bounds = extents;
return NULL;
}
n = xcb_xfixes_fetch_region_rectangles_length(reply);
rects = (Ecore_X_Rectangle *)malloc(n * sizeof(Ecore_X_Rectangle));
if (!rects)
{
if (num) *num = 0;
if (bounds) *bounds = extents;
return NULL;
}
if (num) *num = n;
if (bounds)
{
bounds->x = reply->extents.x;
bounds->y = reply->extents.y;
bounds->width = reply->extents.width;
bounds->height = reply->extents.height;
}
memcpy(rects,
xcb_xfixes_fetch_region_rectangles(reply),
sizeof(Ecore_X_Rectangle) * n);
return rects;
#else
if (num) *num = 0;
if (bounds) *bounds = extents;
return NULL;
#endif /* ECORE_XCB_FIXES */
}
/**
* Expand a region.
* @param dest The destination region.
* @param source The source region.
* @param left The number of pixels to add on the left.
* @param right The number of pixels to add on the right.
* @param top The number of pixels to add at the top.
* @param bottom The number of pixels to add at the bottom.
*
* Put in @p dest the area specified by expanding each rectangle in
* the @p source region by the specified number of pixels to the
* @p left, @p right, @p top and @p bottom.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_expand(Ecore_X_Region dest,
Ecore_X_Region source,
unsigned int left,
unsigned int right,
unsigned int top,
unsigned int bottom)
{
#ifdef ECORE_XCB_FIXES
xcb_xfixes_expand_region(_ecore_xcb_conn, source, dest, left, right, top, bottom);
#endif /* ECORE_XCB_FIXES */
}
/**
* Change clip-mask in a graphic context to the specified region.
* @param region The region to change.
* @param gc The clip-mask graphic context.
* @param x_origin The horizontal translation.
* @param y_origin The vertical translation.
*
* Changes clip-mask in @p gc to the specified @p region and
* sets the clip origin with the values of @p x_origin and @p y_origin.
* Output will be clippped to remain contained within the region. The
* clip origin is interpreted relative to the origin of whatever
* destination drawable is specified in a graphics request. The
* region is interpreted relative to the clip origin. Future changes
* to region have no effect on the gc clip-mask.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_gc_clip_set(Ecore_X_Region region,
Ecore_X_GC gc,
int x_origin,
int y_origin)
{
#ifdef ECORE_XCB_FIXES
xcb_xfixes_set_gc_clip_region(_ecore_xcb_conn, gc, region, x_origin, y_origin);
#endif /* ECORE_XCB_FIXES */
}
/**
* Change the shape extension of a window.
* @param region The region.
* @param dest The window whose shape is changed.
* @param type The kind of shape.
* @param x_offset The horizontal offset.
* @param y_offset The vertical offset.
*
* Set the specified Shape extension region of @p window to @p region,
* offset by @p x_offset and @p y_offset. Future changes to region
* have no effect on the window shape.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_window_shape_set(Ecore_X_Region region,
Ecore_X_Window dest,
Ecore_X_Shape_Type type,
int x_offset,
int y_offset)
{
#ifdef ECORE_XCB_FIXES
xcb_xfixes_set_window_shape_region(_ecore_xcb_conn, dest, type, x_offset, y_offset, region);
#endif /* ECORE_XCB_FIXES */
}
/**
* Change clip-mask in picture to the specified region.
* @param region The region.
* @param picture The picture.
* @param x_origin The X coordinate of the origin.
* @param y_origin The Y coordinate of the origin.
*
* Changes clip-mask in picture to the specified @p region
* and sets the clip origin. Input and output will be clipped to
* remain contained within the region. The clip origin is interpreted
* relative to the origin of the drawable associated with @p picture. The
* region is interpreted relative to the clip origin. Future changes
* to region have no effect on the picture clip-mask.
* @ingroup Ecore_X_Fixes_Group
*/
EAPI void
ecore_x_region_picture_clip_set(Ecore_X_Region region,
Ecore_X_Picture picture,
int x_origin,
int y_origin)
{
#ifdef ECORE_XCB_FIXES
xcb_xfixes_set_picture_clip_region(_ecore_xcb_conn, picture, region, x_origin, y_origin);
#endif /* ECORE_XCB_FIXES */
}

View File

@ -0,0 +1,45 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_xcb_private.h"
/**
* Creates a new default graphics context associated with the given
* drawable.
* @param drawable Drawable to create graphics context with. If @c 0 is
* given instead, the default root window is used.
* @return The new default graphics context.
*
* Creates a new default graphics context associated with @p
* drawable. The graphic context can be used with any destination
* drawable having the same root and depth as @p drawable. Use with
* other drawables results in a BadMatch error.
*/
EAPI Ecore_X_GC
ecore_x_gc_new(Ecore_X_Drawable drawable)
{
xcb_gcontext_t gc;
if (!drawable) drawable = ((xcb_screen_t *)_ecore_xcb_screen)->root;
gc = xcb_generate_id(_ecore_xcb_conn);
xcb_create_gc(_ecore_xcb_conn, gc, drawable, 0, NULL);
return gc;
}
/**
* Deletes and frees the given graphics context.
* @param gc The given graphics context.
*
* Destroyes the graphic context @p gc as well as the associated
* storage.
*/
EAPI void
ecore_x_gc_del(Ecore_X_GC gc)
{
xcb_free_gc(_ecore_xcb_conn, gc);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,149 @@
/*
* Various MWM related functions.
*
* This is ALL the code involving anything MWM related. for both WM and
* client.
*/
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
/**
* @defgroup Ecore_X_MWM_Group MWM related functions.
*
* Functions related to MWM.
*/
#define ECORE_X_MWM_HINTS_FUNCTIONS (1 << 0)
#define ECORE_X_MWM_HINTS_DECORATIONS (1 << 1)
#define ECORE_X_MWM_HINTS_INPUT_MODE (1 << 2)
#define ECORE_X_MWM_HINTS_STATUS (1 << 3)
typedef struct _mwmhints
{
uint32_t flags;
uint32_t functions;
uint32_t decorations;
int32_t inputmode;
uint32_t status;
}
MWMHints;
/**
* Sends the GetProperty request.
* @param window Window whose MWM hints are requested.
* @ingroup Ecore_X_MWM_Group
*/
EAPI void
ecore_x_mwm_hints_get_prefetch(Ecore_X_Window window)
{
xcb_get_property_cookie_t cookie;
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0,
window ? window : ((xcb_screen_t *)_ecore_xcb_screen)->root,
ECORE_X_ATOM_MOTIF_WM_HINTS,
ECORE_X_ATOM_MOTIF_WM_HINTS,
0, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
}
/**
* Gets the reply of the GetProperty request sent by ecore_x_mwm_hints_get_prefetch().
* @ingroup Ecore_X_MWM_Group
*/
EAPI void
ecore_x_mwm_hints_get_fetch(void)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
}
/**
* To document.
* @param window Unused.
* @param fhint To document.
* @param dhint To document.
* @param ihint To document.
* @return 1 on success, 0 otherwise.
*
* To use this function, you must call before, and in order,
* ecore_x_mwm_hints_get_prefetch(), which sends the GetProperty request,
* then ecore_x_mwm_hints_get_fetch(), which gets the reply.
* @ingroup Ecore_X_MWM_Group
*/
EAPI int
ecore_x_mwm_hints_get(Ecore_X_Window window __UNUSED__,
Ecore_X_MWM_Hint_Func *fhint,
Ecore_X_MWM_Hint_Decor *dhint,
Ecore_X_MWM_Hint_Input *ihint)
{
MWMHints *mwmhints = NULL;
int ret = 0;
xcb_get_property_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
return 0;
if ((reply->format != 32) ||
(reply->value_len == 0))
return 0;
mwmhints = xcb_get_property_value(reply);
if (reply->value_len >= 4)
{
if (dhint)
{
if (mwmhints->flags & ECORE_X_MWM_HINTS_DECORATIONS)
*dhint = mwmhints->decorations;
else
*dhint = ECORE_X_MWM_HINT_DECOR_ALL;
}
if (fhint)
{
if (mwmhints->flags & ECORE_X_MWM_HINTS_FUNCTIONS)
*fhint = mwmhints->functions;
else
*fhint = ECORE_X_MWM_HINT_FUNC_ALL;
}
if (ihint)
{
if (mwmhints->flags & ECORE_X_MWM_HINTS_INPUT_MODE)
*ihint = mwmhints->inputmode;
else
*ihint = ECORE_X_MWM_HINT_INPUT_MODELESS;
}
ret = 1;
}
return ret;
}
/**
* Sets the borderless flag of a window using MWM.
* @param window The window.
* @param borderless The borderless flag.
* @ingroup Ecore_X_MWM_Group
*/
EAPI void
ecore_x_mwm_borderless_set(Ecore_X_Window window,
int borderless)
{
uint32_t data[5] = {0, 0, 0, 0, 0};
data[0] = 2; /* just set the decorations hint! */
data[2] = !borderless;
if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
ECORE_X_ATOM_MOTIF_WM_HINTS, ECORE_X_ATOM_MOTIF_WM_HINTS,
32, 5, data);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,117 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_xcb_private.h"
/**
* @defgroup Ecore_X_Pixmap_Group X Pixmap Functions
*
* Functions that operate on pixmaps.
*/
/**
* Creates a new pixmap.
* @param win Window used to determine which screen of the display the
* pixmap should be created on. If 0, the default root window
* is used.
* @param w Width of the new pixmap.
* @param h Height of the new pixmap.
* @param dep Depth of the pixmap. If 0, the default depth of the default
* screen is used.
* @return New pixmap.
* @ingroup Ecore_X_Pixmap_Group
*/
EAPI Ecore_X_Pixmap
ecore_x_pixmap_new(Ecore_X_Window win,
int w,
int h,
int dep)
{
Ecore_X_Pixmap pmap;
if (win == 0) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
if (dep == 0) dep = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth;
pmap = xcb_generate_id(_ecore_xcb_conn);
xcb_create_pixmap(_ecore_xcb_conn, dep, pmap, win, w, h);
return pmap;
}
/**
* Deletes the reference to the given pixmap.
*
* If no other clients have a reference to the given pixmap, the server
* will destroy it.
*
* @param pmap The given pixmap.
* @ingroup Ecore_X_Pixmap_Group
*/
EAPI void
ecore_x_pixmap_del(Ecore_X_Pixmap pmap)
{
xcb_free_pixmap(_ecore_xcb_conn, pmap);
}
/**
* Pastes a rectangular area of the given pixmap onto the given drawable.
* @param pmap The given pixmap.
* @param dest The given drawable.
* @param gc The graphics context which governs which operation will
* be used to paste the area onto the drawable.
* @param sx The X position of the area on the pixmap.
* @param sy The Y position of the area on the pixmap.
* @param w The width of the area.
* @param h The height of the area.
* @param dx The X position at which to paste the area on @p dest.
* @param dy The Y position at which to paste the area on @p dest.
* @ingroup Ecore_X_Pixmap_Group
*/
EAPI void
ecore_x_pixmap_paste(Ecore_X_Pixmap pmap,
Ecore_X_Drawable dest,
Ecore_X_GC gc,
int sx,
int sy,
int w,
int h,
int dx,
int dy)
{
xcb_copy_area(_ecore_xcb_conn, pmap, dest, gc, sx, sy, dx, dy, w, h);
}
/**
* Retrieves the size of the given pixmap.
* @param pmap The given pixmap.
* @param x Pointer to an integer in which to store the X position.
* @param y Pointer to an integer in which to store the Y position.
* @param w Pointer to an integer in which to store the width.
* @param h Pointer to an integer in which to store the height.
* @ingroup Ecore_X_Pixmap_Group
*/
EAPI void
ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap, int *x, int *y, int *w, int *h)
{
if (pmap)
ecore_x_drawable_geometry_get(pmap, x, y, w, h);
}
/**
* Retrieves the depth of the given pixmap.
* @param pmap The given pixmap.
* @return The depth of the pixmap.
* @ingroup Ecore_X_Pixmap_Group
*/
EAPI int
ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap)
{
return ecore_x_drawable_depth_get(pmap);
}

View File

@ -0,0 +1,310 @@
#ifndef __ECORE_XCB_PRIVATE_H__
#define __ECORE_XCB_PRIVATE_H__
#include "config.h"
#include <sys/param.h>
#ifndef MAXHOSTNAMELEN
# define MAXHOSTNAMELEN 256
#endif
#ifndef XK_MISCELLANY
# define XK_MISCELLANY 1
#endif /* XK_MISCELLANY */
#include <xcb/xcb.h>
#include <xcb/xcb_icccm.h>
#include <xcb/xcb_keysyms.h>
#include <xcb/bigreq.h>
#ifdef ECORE_XCB_CURSOR
# include <xcb/cursor.h>
#endif /* ECORE_XCB_CURSOR */
#ifdef ECORE_XCB_DAMAGE
# include <xcb/damage.h>
#endif /* ECORE_XCB_DAMAGE */
#ifdef ECORE_XCB_DPMS
# include <xcb/dpms.h>
#endif /* ECORE_XCB_DPMS */
#ifdef ECORE_XCB_RANDR
# include <xcb/randr.h>
#endif /* ECORE_XCB_RANDR */
#ifdef ECORE_XCB_RENDER
# include <xcb/render.h>
#endif /* ECORE_XCB_RENDER */
#ifdef ECORE_XCB_SCREENSAVER
# include <xcb/screensaver.h>
#endif /* ECORE_XCB_SCREENSAVER */
#ifdef ECORE_XCB_SHAPE
# include <xcb/shape.h>
#endif /* ECORE_XCB_SHAPE */
#ifdef ECORE_XCB_SYNC
# include <xcb/sync.h>
#endif /* ECORE_XCB_SYNC */
#ifdef ECORE_XCB_XFIXES
# include <xcb/xfixes.h>
#endif /* ECORE_XCB_XFIXES */
#ifdef ECORE_XCB_XINERAMA
# include <xcb/xinerama.h>
#endif /* ECORE_XCB_XINERAMA */
#ifdef ECORE_XCB_XPRINT
# include <xcb/xprint.h>
#endif /* ECORE_XCB_XPRINT */
#include "ecore_private.h"
#include "Ecore_X.h"
/* FIXME: this is for simulation only */
#include "Ecore_Txt.h"
typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern;
struct _Ecore_X_Selection_Intern
{
Ecore_X_Window win;
Ecore_X_Atom selection;
unsigned char *data;
int length;
Ecore_X_Time time;
};
typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter;
struct _Ecore_X_Selection_Converter
{
Ecore_X_Atom target;
int (*convert)(char *target, void *data, int size,
void **data_ret, int *size_ret);
Ecore_X_Selection_Converter *next;
};
typedef struct _Ecore_X_Selection_Parser Ecore_X_Selection_Parser;
struct _Ecore_X_Selection_Parser
{
char *target;
void *(*parse)(const char *target, void *data, int size, int format);
Ecore_X_Selection_Parser *next;
};
typedef struct _Ecore_X_DND_Source
{
int version;
Ecore_X_Window win, dest;
enum {
ECORE_X_DND_SOURCE_IDLE,
ECORE_X_DND_SOURCE_DRAGGING,
ECORE_X_DND_SOURCE_DROPPED,
ECORE_X_DND_SOURCE_CONVERTING
} state;
struct {
short x, y;
unsigned short width, height;
} rectangle;
Ecore_X_Time time;
Ecore_X_Atom action, accepted_action;
int will_accept;
int suppress;
int await_status;
} Ecore_X_DND_Source;
typedef struct _Ecore_X_DND_Target
{
int version;
Ecore_X_Window win, source;
enum {
ECORE_X_DND_TARGET_IDLE,
ECORE_X_DND_TARGET_ENTERED
} state;
struct {
int x, y;
} pos;
Ecore_X_Time time;
Ecore_X_Atom action, accepted_action;
int will_accept;
} Ecore_X_DND_Target;
extern Ecore_X_Connection *_ecore_xcb_conn;
extern Ecore_X_Screen *_ecore_xcb_screen;
extern double _ecore_xcb_double_click_time;
extern Ecore_X_Time _ecore_xcb_event_last_time;
extern Ecore_X_Window _ecore_xcb_event_last_window;
extern int16_t _ecore_xcb_event_last_root_x;
extern int16_t _ecore_xcb_event_last_root_y;
extern int _ecore_xcb_xcursor;
extern Ecore_X_Atom _ecore_xcb_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];
extern int _ecore_window_grabs_num;
extern Ecore_X_Window *_ecore_window_grabs;
extern int (*_ecore_window_grab_replay_func) (void *data, int event_type, void *event);
extern void *_ecore_window_grab_replay_data;
extern Ecore_X_Window _ecore_xcb_private_window;
void _ecore_x_error_handler_init(void);
void _ecore_x_event_handle_key_press (xcb_generic_event_t *event);
void _ecore_x_event_handle_key_release (xcb_generic_event_t *event);
void _ecore_x_event_handle_button_press (xcb_generic_event_t *event);
void _ecore_x_event_handle_button_release (xcb_generic_event_t *event);
void _ecore_x_event_handle_motion_notify (xcb_generic_event_t *event);
void _ecore_x_event_handle_enter_notify (xcb_generic_event_t *event);
void _ecore_x_event_handle_leave_notify (xcb_generic_event_t *event);
void _ecore_x_event_handle_focus_in (xcb_generic_event_t *event);
void _ecore_x_event_handle_focus_out (xcb_generic_event_t *event);
void _ecore_x_event_handle_keymap_notify (xcb_generic_event_t *event);
void _ecore_x_event_handle_expose (xcb_generic_event_t *event);
void _ecore_x_event_handle_graphics_expose (xcb_generic_event_t *event);
void _ecore_x_event_handle_visibility_notify (xcb_generic_event_t *event);
void _ecore_x_event_handle_create_notify (xcb_generic_event_t *event);
void _ecore_x_event_handle_destroy_notify (xcb_generic_event_t *event);
void _ecore_x_event_handle_unmap_notify (xcb_generic_event_t *event);
void _ecore_x_event_handle_map_notify (xcb_generic_event_t *event);
void _ecore_x_event_handle_map_request (xcb_generic_event_t *event);
void _ecore_x_event_handle_reparent_notify (xcb_generic_event_t *event);
void _ecore_x_event_handle_configure_notify (xcb_generic_event_t *event);
void _ecore_x_event_handle_configure_request (xcb_generic_event_t *event);
void _ecore_x_event_handle_gravity_notify (xcb_generic_event_t *event);
void _ecore_x_event_handle_resize_request (xcb_generic_event_t *event);
void _ecore_x_event_handle_circulate_notify (xcb_generic_event_t *event);
void _ecore_x_event_handle_circulate_request (xcb_generic_event_t *event);
void _ecore_x_event_handle_property_notify (xcb_generic_event_t *event);
void _ecore_x_event_handle_selection_clear (xcb_generic_event_t *event);
void _ecore_x_event_handle_selection_request (xcb_generic_event_t *event);
void _ecore_x_event_handle_selection_notify (xcb_generic_event_t *event);
void _ecore_x_event_handle_colormap_notify (xcb_generic_event_t *event);
void _ecore_x_event_handle_client_message (xcb_generic_event_t *event);
void _ecore_x_event_handle_mapping_notify (xcb_generic_event_t *event);
#ifdef ECORE_XCB_DAMAGE
void _ecore_x_event_handle_damage_notify (xcb_generic_event_t *event);
#endif /* ECORE_XCB_DAMAGE */
#ifdef ECORE_XCB_RANDR
void _ecore_x_event_handle_randr_change (xcb_generic_event_t *event);
#endif /* ECORE_XCB_RANDR */
#ifdef ECORE_XCB_SCREENSAVER
void _ecore_x_event_handle_screensaver_notify (xcb_generic_event_t *event);
#endif /* ECORE_XCB_SCREENSAVER */
#ifdef ECORE_XCB_SHAPE
void _ecore_x_event_handle_shape_change (xcb_generic_event_t *event);
#endif /* ECORE_XCB_SHAPE */
#ifdef ECORE_XCB_SYNC
void _ecore_x_event_handle_sync_counter (xcb_generic_event_t *event);
void _ecore_x_event_handle_sync_alarm (xcb_generic_event_t *event);
#endif /* ECORE_XCB_SYNC */
#ifdef ECORE_XCB_FIXES
void _ecore_x_event_handle_fixes_selection_notify(xcb_generic_event_t *event);
#endif /* ECORE_XCB_FIXES */
/* requests / replies */
int _ecore_x_reply_init ();
void _ecore_x_reply_shutdown ();
void _ecore_xcb_cookie_cache (unsigned int cookie);
unsigned int _ecore_xcb_cookie_get (void);
void _ecore_xcb_reply_cache (void *reply);
void *_ecore_xcb_reply_get (void);
/* atoms */
extern Ecore_X_Atom ECORE_X_ATOM_ATOM;
extern Ecore_X_Atom ECORE_X_ATOM_CARDINAL;
extern Ecore_X_Atom ECORE_X_ATOM_STRING;
extern Ecore_X_Atom ECORE_X_ATOM_WINDOW;
extern Ecore_X_Atom ECORE_X_ATOM_E_FRAME_SIZE;
extern Ecore_X_Atom ECORE_X_ATOM_WM_SIZE_HINTS;
void _ecore_x_atom_init (void);
void _ecore_x_atom_init_finalize (void);
/* damage */
void _ecore_x_damage_init (const xcb_query_extension_reply_t *reply);
void _ecore_x_damage_init_finalize (void);
/* from dnd */
void _ecore_x_dnd_init (void);
void _ecore_x_dnd_shutdown (void);
Ecore_X_DND_Source *_ecore_x_dnd_source_get (void);
Ecore_X_DND_Target *_ecore_x_dnd_target_get (void);
void _ecore_x_dnd_drag (int x,
int y);
/* dpms */
void _ecore_x_dpms_init (const xcb_query_extension_reply_t *reply);
void _ecore_x_dpms_init_finalize (void);
/* netwm */
Ecore_X_Window_State _ecore_x_netwm_state_get(Ecore_X_Atom a);
int _ecore_x_netwm_startup_info_begin(Ecore_X_Window win, char *data);
int _ecore_x_netwm_startup_info(Ecore_X_Window win, char *data);
/* randr */
void _ecore_x_randr_init (const xcb_query_extension_reply_t *reply);
void _ecore_x_randr_init_finalize (void);
/* selection */
void _ecore_x_selection_init(void);
void _ecore_x_selection_shutdown(void);
Ecore_X_Atom _ecore_x_selection_target_atom_get(const char *target);
char *_ecore_x_selection_target_get(Ecore_X_Atom target);
Ecore_X_Selection_Intern *_ecore_x_selection_get(Ecore_X_Atom selection);
int _ecore_x_selection_set(Ecore_X_Window w, const void *data, int len, Ecore_X_Atom selection);
int _ecore_x_selection_convert(Ecore_X_Atom selection, Ecore_X_Atom target, void **data_ret);
void *_ecore_x_selection_parse(const char *target, void *data, int size, int format);
/* screensaver */
void _ecore_x_screensaver_init (const xcb_query_extension_reply_t *reply);
void _ecore_x_screensaver_init_finalize (void);
/* shape */
void _ecore_x_shape_init (const xcb_query_extension_reply_t *reply);
void _ecore_x_shape_init_finalize (void);
/* sync */
void _ecore_x_sync_init (const xcb_query_extension_reply_t *reply);
void _ecore_x_sync_init_finalize (void);
/* xfixes */
void _ecore_x_xfixes_init (const xcb_query_extension_reply_t *reply);
void _ecore_x_xfixes_init_finalize (void);
/* xinerama */
void _ecore_x_xinerama_init (const xcb_query_extension_reply_t *reply);
void _ecore_x_xinerama_init_finalize (void);
/* xprint */
void _ecore_x_xprint_init (const xcb_query_extension_reply_t *reply);
void _ecore_x_xprint_init_finalize (void);
/* to categorize */
void _ecore_x_sync_magic_send(int val, Ecore_X_Window swin);
void _ecore_x_window_grab_remove(Ecore_X_Window win);
void _ecore_x_key_grab_remove(Ecore_X_Window win);
#endif /* __ECORE_XCB_PRIVATE_H__*/

View File

@ -0,0 +1,544 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_xcb_private.h"
/**
* @defgroup Ecore_X_RandR_Group X RandR Extension Functions
*
* Functions related to the X RandR extension.
*/
#ifdef ECORE_XCB_RANDR
static int _randr_available = 0;
static xcb_randr_query_version_cookie_t _ecore_xcb_randr_init_cookie;
#endif /* ECORE_XCB_RANDR */
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_randr_init and
_ecore_xcb_randr_init_finalize. The first one gets the cookies and
the second one gets the replies and set the atoms. */
void
_ecore_x_randr_init(const xcb_query_extension_reply_t *reply)
{
#ifdef ECORE_XCB_RANDR
if (reply && (reply->present))
_ecore_xcb_randr_init_cookie = xcb_randr_query_version_unchecked(_ecore_xcb_conn, 1, 2);
#endif /* ECORE_XCB_RANDR */
}
void
_ecore_x_randr_init_finalize(void)
{
#ifdef ECORE_XCB_RANDR
xcb_randr_query_version_reply_t *reply;
reply = xcb_randr_query_version_reply(_ecore_xcb_conn,
_ecore_xcb_randr_init_cookie, NULL);
if (reply)
{
if ((reply->major_version >= 1) &&
(reply->minor_version >= 1))
_randr_available = 1;
free(reply);
}
#endif /* ECORE_XCB_RANDR */
}
/**
* Return whether the X server supports the RandR Extension.
* @return 1 if the X RandR Extension is available, 0 otherwise.
*
* Return 1 if the X server supports the RandR Extension version 1.1,
* 0 otherwise.
* @ingroup Ecore_X_RandR_Group
*/
EAPI int
ecore_x_randr_query(void)
{
#ifdef ECORE_XCB_RANDR
return _randr_available;
#else
return 0;
#endif /* ECORE_XCB_RANDR */
}
static Ecore_X_Window
_xcb_randr_root_to_screen(Ecore_X_Window root)
{
xcb_screen_iterator_t iter;
iter = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn));
for (; iter.rem; xcb_screen_next(&iter))
{
if (iter.data->root == root)
return iter.data->root;
}
return XCB_NONE;
}
/**
* Select if the ScreenChangeNotify events will be sent.
* @param window The window.
* @param on 1 to enable, 0 to disable.
* @return 1 on success, 0 otherwise.
*
* If @p on value is @c 1, ScreenChangeNotify events
* will be sent when the screen configuration changes, either from
* this protocol extension, or due to detected external screen
* configuration changes. ScreenChangeNotify may also be sent when
* this request executes if the screen configuration has changed since
* the client connected, to avoid race conditions.
* @ingroup Ecore_X_RandR_Group
*/
EAPI int
ecore_x_randr_events_select(Ecore_X_Window window,
int on)
{
#ifdef ECORE_XCB_RANDR
xcb_randr_select_input(_ecore_xcb_conn, window,
on ? XCB_RANDR_SCREEN_CHANGE_NOTIFY : 0);
return 1;
#else
return 0;
#endif /* ECORE_XCB_RANDR */
}
/**
* Sends the GetScreenInfo request.
* @param window Window whose properties are requested.
* @ingroup Ecore_X_RandR_Group
*/
EAPI void
ecore_x_randr_get_screen_info_prefetch(Ecore_X_Window window)
{
xcb_randr_get_screen_info_cookie_t cookie;
cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn,
_xcb_randr_root_to_screen(window));
_ecore_xcb_cookie_cache(cookie.sequence);
}
/**
* Gets the reply of the GetScreenInfo request sent by ecore_x_randr_get_screen_info_prefetch().
* @ingroup Ecore_X_RandR_Group
*/
EAPI void
ecore_x_randr_get_screen_info_fetch(void)
{
xcb_randr_get_screen_info_cookie_t cookie;
xcb_randr_get_screen_info_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply =xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
}
/**
* Get the set of rotations and reflections.
* @param root The window (Unused).
* @return The set of rotations and reflections.
*
* Get the set of rotations and reflections supported by the screen
* associated to @p window (passed to
* ecore_x_randr_get_screen_info_prefetch()).
*
* To use this function, you must call before, and in order,
* ecore_x_randr_get_screen_info_prefetch(), which sends the GetScreenInfo request,
* then ecore_x_randr_get_screen_info_fetch(), which gets the reply.
* @ingroup Ecore_X_RandR_Group
*/
EAPI Ecore_X_Randr_Rotation
ecore_x_randr_screen_rotations_get(Ecore_X_Window root __UNUSED__)
{
#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_info_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
return 0;
return reply->rotations;
#else
return 0;
#endif /* ECORE_XCB_RANDR */
}
/**
* Get the rotation.
* @param root The window (Unused).
* @return The rotation.
*
* Get the rotation supported by the screen
* associated to @p window (passed to
* ecore_x_randr_get_screen_info_prefetch()).
*
* To use this function, you must call before, and in order,
* ecore_x_randr_get_screen_info_prefetch(), which sends the GetScreenInfo request,
* then ecore_x_randr_get_screen_info_fetch(), which gets the reply.
* @ingroup Ecore_X_RandR_Group
*/
EAPI Ecore_X_Randr_Rotation
ecore_x_randr_screen_rotation_get(Ecore_X_Window root __UNUSED__)
{
#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_info_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
return 0;
return reply->rotation;
#else
return 0;
#endif /* ECORE_XCB_RANDR */
}
/**
* Get the frame buffer sizes.
* @param root The window (Unused).
* @param num The number of sizes.
* @return The sizes.
*
* Get the list of possible frame buffer sizes (at the normal
* orientation supported by the screen associated to @p window (passed
* to ecore_x_randr_get_screen_info_prefetch()). Each size indicates
* both the linear physical size of the screen and the pixel size.
*
* To use this function, you must call before, and in order,
* ecore_x_randr_get_screen_info_prefetch(), which sends the GetScreenInfo request,
* then ecore_x_randr_get_screen_info_fetch(), which gets the reply.
* @ingroup Ecore_X_RandR_Group
*/
EAPI Ecore_X_Screen_Size *
ecore_x_randr_screen_sizes_get(Ecore_X_Window root __UNUSED__,
int *num)
{
#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_info_reply_t *reply;
xcb_randr_screen_size_t *sizes;
Ecore_X_Screen_Size *ret;
int n;
int i;
if (num) *num = 0;
reply = _ecore_xcb_reply_get();
if (!reply)
return NULL;
n = xcb_randr_get_screen_info_sizes_length(reply);
ret = calloc(n, sizeof(Ecore_X_Screen_Size));
if (!ret) return NULL;
if (num) *num = n;
sizes = xcb_randr_get_screen_info_sizes(reply);
for (i = 0; i < n; i++)
{
ret[i].width = sizes[i].width;
ret[i].height = sizes[i].height;
}
return ret;
#else
if (num) *num = 0;
return NULL;
#endif /* ECORE_XCB_RANDR */
}
/**
* Get the current frame buffer size.
* @param root The window (Unused).
* @return The active size.
*
* Get the active frame buffer size supported by the screen associated
* to @p window (passed to
* ecore_x_randr_get_screen_info_prefetch()).
*
* To use this function, you must call before, and in order,
* ecore_x_randr_get_screen_info_prefetch(), which sends the GetScreenInfo request,
* then ecore_x_randr_get_screen_info_fetch(), which gets the reply.
* @ingroup Ecore_X_RandR_Group
*/
EAPI Ecore_X_Screen_Size
ecore_x_randr_current_screen_size_get(Ecore_X_Window root __UNUSED__)
{
Ecore_X_Screen_Size ret = { -1, -1 };
#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_info_reply_t *reply;
xcb_randr_screen_size_t *sizes;
uint16_t size_index;
reply = _ecore_xcb_reply_get();
if (!reply)
return ret;
size_index = reply->sizeID;
sizes = xcb_randr_get_screen_info_sizes(reply);
if (size_index < reply->nSizes)
{
ret.width = sizes[size_index].mwidth;
ret.height = sizes[size_index].mheight;
}
#endif /* ECORE_XCB_RANDR */
return ret;
}
/**
* Get the current refresh rate.
* @param root The window (Unused).
* @return The current refresh rate.
*
* Get the current refresh rate supported by the screen associated
* to @p window (passed to
* ecore_x_randr_get_screen_info_prefetch()).
*
* To use this function, you must call before, and in order,
* ecore_x_randr_get_screen_info_prefetch(), which sends the GetScreenInfo request,
* then ecore_x_randr_get_screen_info_fetch(), which gets the reply.
* @ingroup Ecore_X_RandR_Group
*/
EAPI Ecore_X_Screen_Refresh_Rate
ecore_x_randr_current_screen_refresh_rate_get(Ecore_X_Window root __UNUSED__)
{
Ecore_X_Screen_Refresh_Rate ret = { -1 };
#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_info_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
return ret;
ret.rate = reply->rate;
#endif /* ECORE_XCB_RANDR */
return ret;
}
/**
* Get the refresh rates.
* @param root The window (Unused).
* @param num The number of refresh rates.
* @return The refresh rates.
*
* Get the list of refresh rates for each size supported by the screen
* associated to @p window (passed to
* ecore_x_randr_get_screen_info_prefetch()). Each element
* of 'sizes' has a corresponding element in 'refresh'. An empty list
* indicates no known rates, or a device for which refresh is not
* relevant.
*
* To use this function, you must call before, and in order,
* ecore_x_randr_get_screen_info_prefetch(), which sends the GetScreenInfo request,
* then ecore_x_randr_get_screen_info_fetch(), which gets the reply.
* @ingroup Ecore_X_RandR_Group
*/
EAPI Ecore_X_Screen_Refresh_Rate *
ecore_x_randr_screen_refresh_rates_get(Ecore_X_Window root __UNUSED__,
int size_id __UNUSED__,
int *num)
{
#ifdef ECORE_XCB_RANDR
xcb_randr_get_screen_info_reply_t *reply;
Ecore_X_Screen_Refresh_Rate *ret;
Ecore_X_Screen_Refresh_Rate *tmp;
xcb_randr_refresh_rates_iterator_t iter;
uint16_t n;
if (num) *num = 0;
reply = _ecore_xcb_reply_get();
if (!reply)
return NULL;
n = reply->nSizes;
ret = calloc(n, sizeof(Ecore_X_Screen_Refresh_Rate));
if (!ret)
return NULL;
if (num) *num = n;
/* FIXME: maybe there's a missing function in xcb randr implementation */
iter = xcb_randr_get_screen_info_rates_iterator(reply);
tmp = ret;
for (; iter.rem; xcb_randr_refresh_rates_next(&iter), tmp++)
{
tmp->rate = iter.data->nRates;;
}
return ret;
#else
if (num) *num = 0;
return NULL;
#endif /* ECORE_XCB_RANDR */
}
/* FIXME: round trip. Should we remove it ? */
/**
* Set the screen rotation.
* @param root The root window.
* @param rot The rotation.
*
* Set the rotation of the screen associated to @p root.
*
* Note that that function is blocking.
* @ingroup Ecore_X_RandR_Group
*/
EAPI void
ecore_x_randr_screen_rotation_set(Ecore_X_Window root,
Ecore_X_Randr_Rotation rot)
{
#ifdef ECORE_XCB_RANDR
xcb_randr_set_screen_config_cookie_t cookie;
xcb_randr_set_screen_config_reply_t *reply_config;
xcb_randr_get_screen_info_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
return;
cookie = xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root,
XCB_CURRENT_TIME,
reply->config_timestamp,
reply->sizeID,
rot,
0);
reply_config = xcb_randr_set_screen_config_reply(_ecore_xcb_conn, cookie, NULL);
if (reply_config)
free(reply_config);
#endif /* ECORE_XCB_RANDR */
}
/* FIXME: round trip. Should we remove it ? */
/**
* Set the screen size.
* @param root The root window.
* @param size The size.
*
* Set the size of the screen associated to @p root.
*
* Note that that function is blocking.
* @ingroup Ecore_X_RandR_Group
*/
EAPI int
ecore_x_randr_screen_size_set(Ecore_X_Window root,
Ecore_X_Screen_Size size)
{
#ifdef ECORE_XCB_RANDR
xcb_randr_set_screen_config_cookie_t cookie;
xcb_randr_set_screen_config_reply_t *reply_config;
xcb_randr_get_screen_info_reply_t *reply;
xcb_randr_screen_size_iterator_t iter;
int size_index = -1;
int i;
reply = _ecore_xcb_reply_get();
if (!reply)
return 0;
iter = xcb_randr_get_screen_info_sizes_iterator(reply);
for (i = 0; iter.rem; xcb_randr_screen_size_next(&iter), i++)
{
if ((iter.data->width = size.width) &&
(iter.data->height = size.height) &&
(iter.data->mwidth = size.width) &&
(iter.data->mheight = size.height))
{
size_index = i;
break;
}
}
if (size_index == -1) return 0;
cookie = xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root,
XCB_CURRENT_TIME,
reply->config_timestamp,
size_index,
XCB_RANDR_ROTATION_ROTATE_0,
0);
reply_config = xcb_randr_set_screen_config_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply_config)
return 0;
free(reply_config);
return 1;
#else
return 0;
#endif /* ECORE_XCB_RANDR */
}
/* FIXME: round trip. Should we remove it ? */
/**
* Set the screen refresh rate.
* @param root The root window.
* @param size The size.
* @param rate The refresh rate.
*
* Set the size and the refresh rate of the screen associated to
* @p root.
*
* Note that that function is blocking.
* @ingroup Ecore_X_RandR_Group
*/
EAPI int
ecore_x_randr_screen_refresh_rate_set(Ecore_X_Window root,
Ecore_X_Screen_Size size,
Ecore_X_Screen_Refresh_Rate rate)
{
#ifdef ECORE_XCB_RANDR
xcb_randr_set_screen_config_cookie_t cookie;
xcb_randr_set_screen_config_reply_t *reply_config;
xcb_randr_get_screen_info_reply_t *reply;
xcb_randr_screen_size_iterator_t iter;
int size_index = -1;
int i;
reply = _ecore_xcb_reply_get();
if (!reply)
return 0;
iter = xcb_randr_get_screen_info_sizes_iterator(reply);
for (i = 0; iter.rem; xcb_randr_screen_size_next(&iter), i++)
{
if ((iter.data->width = size.width) &&
(iter.data->height = size.height) &&
(iter.data->mwidth = size.width) &&
(iter.data->mheight = size.height))
{
size_index = i;
break;
}
}
if (size_index == -1) return 0;
cookie = xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root,
XCB_CURRENT_TIME,
reply->config_timestamp,
size_index,
XCB_RANDR_ROTATION_ROTATE_0,
rate.rate);
reply_config = xcb_randr_set_screen_config_reply(_ecore_xcb_conn, cookie, NULL);
if (!reply_config)
return 0;
free(reply_config);
return 1;
#else
return 0;
#endif /* ECORE_XCB_RANDR */
}

View File

@ -0,0 +1,131 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include <stdlib.h>
#include <Ecore_Data.h>
/*
* FIXME:
* - in ecore_xcb_cookie_cache, should provide better error management
* when memory allocation fails
* - Use an array instead of a list
* - Is ecore_xcb_reply_free really needed ?
* _ecore_xcb_reply_cache frees the current reply and
* _ecore_x_reply_shutdown frees the last reply to free.
* I keep it in case it is need for memory improvements,
* but its code is commented.
*/
static Ecore_List *_ecore_xcb_cookies = NULL;
static void *_ecore_xcb_reply = NULL;
typedef struct _Ecore_Xcb_Data Ecore_Xcb_Data;
struct _Ecore_Xcb_Data
{
unsigned int cookie;
};
int
_ecore_x_reply_init ()
{
_ecore_xcb_cookies = ecore_list_new();
if (!_ecore_xcb_cookies)
return 0;
if (!ecore_list_init(_ecore_xcb_cookies))
{
ecore_list_destroy(_ecore_xcb_cookies);
return 0;
}
if (!ecore_list_set_free_cb(_ecore_xcb_cookies, ECORE_FREE_CB(free)))
{
ecore_list_destroy(_ecore_xcb_cookies);
return 0;
}
return 1;
}
void
_ecore_x_reply_shutdown ()
{
if (_ecore_xcb_reply)
free(_ecore_xcb_reply);
if (!_ecore_xcb_cookies)
return;
ecore_list_destroy(_ecore_xcb_cookies);
}
void
_ecore_xcb_cookie_cache (unsigned int cookie)
{
Ecore_Xcb_Data *data;
if (!_ecore_xcb_cookies)
return;
data = (Ecore_Xcb_Data *)malloc(sizeof(Ecore_Xcb_Data));
if (!data)
return;
data->cookie = cookie;
if (!ecore_list_append(_ecore_xcb_cookies, data))
{
free(data);
return;
}
}
unsigned int
_ecore_xcb_cookie_get (void)
{
Ecore_Xcb_Data *data;
unsigned int cookie;
if (!_ecore_xcb_cookies)
return 0;
data = ecore_list_remove_first(_ecore_xcb_cookies);
if (data)
{
cookie = data->cookie;
free(data);
return cookie;
}
return 0;
}
void
_ecore_xcb_reply_cache (void *reply)
{
if (_ecore_xcb_reply)
free(_ecore_xcb_reply);
_ecore_xcb_reply = reply;
}
void *
_ecore_xcb_reply_get (void)
{
return _ecore_xcb_reply;
}
EAPI void
ecore_xcb_reply_free()
{
/* if (_ecore_xcb_reply) */
/* { */
/* free(_ecore_xcb_reply); */
/* _ecore_xcb_reply = NULL; */
/* } */
}

View File

@ -0,0 +1,372 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_xcb_private.h"
/**
* @defgroup Ecore_X_ScrenSaver_Group X Shape extension
*
* These functions use the shape extension of the X server to change
* shape of given windows.
*/
/**
* Return whether the X server supports the ScrenSaver Extension.
* @return 1 if the X ScrenSaver Extension is available, 0 otherwise.
*
* Return 1 if the X server supports the ScrenSaver Extension version 1.0,
* 0 otherwise.
* @ingroup Ecore_X_ScrenSaver_Group
*/
EAPI int
ecore_x_screensaver_event_available_get(void)
{
return 1;
}
/**
* Sends the QueryInfo request.
* @ingroup Ecore_X_ScrenSaver_Group
*/
EAPI void
ecore_x_screensaver_idle_time_prefetch(void)
{
#ifdef ECORE_XCB_SCREENSAVER
xcb_screensaver_query_info_cookie_t cookie;
cookie = xcb_screensaver_query_info_unchecked(_ecore_xcb_conn, ((xcb_screen_t *)_ecore_xcb_screen)->root);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_SCREENSAVER */
}
/**
* Gets the reply of the QueryInfo request sent by ecore_x_get_screensaver_prefetch().
* @ingroup Ecore_X_ScrenSaver_Group
*/
EAPI void
ecore_x_screensaver_idle_time_fetch(void)
{
#ifdef ECORE_XCB_SCREENSAVER
xcb_screensaver_query_info_cookie_t cookie;
xcb_screensaver_query_info_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_screensaver_query_info_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_SCREENSAVER */
}
/**
* Get the number of seconds since the last input was received.
* @return The number of seconds.
*
* Get the number of milliseconds since the last input was received
* from the user on any of the input devices.
*
* To use this function, you must call before, and in order,
* ecore_x_get_screensaver_prefetch(), which sends the GetScreenSaver request,
* then ecore_x_get_screensaver_fetch(), which gets the reply.
* @ingroup Ecore_X_ScrenSaver_Group
*/
EAPI int
ecore_x_screensaver_idle_time_get(void)
{
int idle = 0;
#ifdef ECORE_XCB_SCREENSAVER
xcb_screensaver_query_info_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return 0;
/* FIXME: check if it is ms_since_user_input or ms_until_server */
idle = reply->ms_since_user_input / 1000;
#endif /* ECORE_XCB_SCREENSAVER */
return idle;
}
/**
* Set the parameters of the screen saver.
* @param timeout The timeout, in second.
* @param interval The interval, in seconds.
* @param blank 0 to disable screen blanking, otherwise enable it.
* @param expose Allow Expose generation event or not.
*
* Set the parameters of the screen saver. @p timeout is the timeout,
* in seconds, until the screen saver turns on. @p interval is the
* interval, in seconds, between screen saver alterations. @p blank
* specifies how to enable screen blanking. @p expose specifies the
* screen save control values.
* @ingroup Ecore_X_ScrenSaver_Group
*/
EAPI void
ecore_x_screensaver_set(int timeout,
int interval,
int blank,
int expose)
{
xcb_set_screen_saver(_ecore_xcb_conn,
(int16_t)timeout,
(int16_t)interval,
(uint8_t)blank,
(uint8_t)expose);
}
/**
* Sends the GetScreenSaver request.
* @ingroup Ecore_X_ScrenSaver_Group
*/
EAPI void
ecore_x_get_screensaver_prefetch(void)
{
xcb_get_screen_saver_cookie_t cookie;
cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
}
/**
* Gets the reply of the GetScreenSaver request sent by ecore_x_get_screensaver_prefetch().
* @ingroup Ecore_X_ScrenSaver_Group
*/
EAPI void
ecore_x_get_screensaver_fetch(void)
{
xcb_get_screen_saver_cookie_t cookie;
xcb_get_screen_saver_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
}
/**
* Set the timeout of the screen saver.
* @param timeout The timeout to set.
*
* Set the @p timeout, in seconds, until the screen saver turns on.
*
* To use this function, you must call before, and in order,
* ecore_x_get_screensaver_prefetch(), which sends the GetScreenSaver request,
* then ecore_x_get_screensaver_fetch(), which gets the reply.
* @ingroup Ecore_X_ScrenSaver_Group
*/
EAPI void
ecore_x_screensaver_timeout_set(double timeout)
{
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return;
xcb_set_screen_saver(_ecore_xcb_conn,
(int16_t)timeout,
reply->interval,
reply->prefer_blanking,
reply->allow_exposures);
}
/**
* Get the timeout of the screen saver.
* @return The timeout.
*
* Get the @p timeout, in seconds, until the screen saver turns on.
*
* To use this function, you must call before, and in order,
* ecore_x_get_screensaver_prefetch(), which sends the GetScreenSaver request,
* then ecore_x_get_screensaver_fetch(), which gets the reply.
* @ingroup Ecore_X_ScrenSaver_Group
*/
EAPI double
ecore_x_screensaver_timeout_get(void)
{
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return 0.0;
return (double)reply->timeout;
}
/**
* Set the interval of the screen saver.
* @param interval The interval to set.
*
* Set the @p interval, in seconds, between screen saver alterations.
*
* To use this function, you must call before, and in order,
* ecore_x_get_screensaver_prefetch(), which sends the GetScreenSaver request,
* then ecore_x_get_screensaver_fetch(), which gets the reply.
* @ingroup Ecore_X_ScrenSaver_Group
*/
EAPI void
ecore_x_screensaver_interval_set(double interval)
{
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return;
xcb_set_screen_saver(_ecore_xcb_conn,
reply->timeout,
(int16_t)interval,
reply->prefer_blanking,
reply->allow_exposures);
}
/**
* Get the interval of the screen saver.
* @return The interval.
*
* Get the @p interval, in seconds, between screen saver alterations.
*
* To use this function, you must call before, and in order,
* ecore_x_get_screensaver_prefetch(), which sends the GetScreenSaver request,
* then ecore_x_get_screensaver_fetch(), which gets the reply.
* @ingroup Ecore_X_ScrenSaver_Group
*/
EAPI double
ecore_x_screensaver_interval_get(void)
{
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return 0.0;
return (double)reply->interval;
}
/**
* Set the screen blanking.
* @param blank The blank to set.
*
* @p blank specifies how to enable screen blanking.
*
* To use this function, you must call before, and in order,
* ecore_x_get_screensaver_prefetch(), which sends the GetScreenSaver request,
* then ecore_x_get_screensaver_fetch(), which gets the reply.
* @ingroup Ecore_X_ScrenSaver_Group
*/
EAPI void
ecore_x_screensaver_blank_set(double blank)
{
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return;
xcb_set_screen_saver(_ecore_xcb_conn,
reply->timeout,
reply->interval,
(uint8_t)blank,
reply->allow_exposures);
}
/**
* Get the screen blanking.
* @return The blanking.
*
* Get the screen blanking.
*
* To use this function, you must call before, and in order,
* ecore_x_get_screensaver_prefetch(), which sends the GetScreenSaver request,
* then ecore_x_get_screensaver_fetch(), which gets the reply.
* @ingroup Ecore_X_ScrenSaver_Group
*/
EAPI double
ecore_x_screensaver_blank_get(void)
{
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return 0.0;
return (double)reply->prefer_blanking;
}
/**
* Set the screen save control values.
* @param expose The expose to set.
*
* Set the screen save control values.
*
* To use this function, you must call before, and in order,
* ecore_x_get_screensaver_prefetch(), which sends the GetScreenSaver request,
* then ecore_x_get_screensaver_fetch(), which gets the reply.
* @ingroup Ecore_X_ScrenSaver_Group
*/
EAPI void
ecore_x_screensaver_expose_set(double expose)
{
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return;
xcb_set_screen_saver(_ecore_xcb_conn,
reply->timeout,
reply->interval,
reply->prefer_blanking,
(uint8_t)expose);
}
/**
* Get the screen save control values.
* @return The expose.
*
* Get the screen save control values.
*
* To use this function, you must call before, and in order,
* ecore_x_get_screensaver_prefetch(), which sends the GetScreenSaver request,
* then ecore_x_get_screensaver_fetch(), which gets the reply.
* @ingroup Ecore_X_ScrenSaver_Group
*/
EAPI double
ecore_x_screensaver_expose_get(void)
{
xcb_get_screen_saver_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return 0.0;
return (double)reply->allow_exposures;
}
/**
* Specifies if the Screen Saver NotifyMask event should be generated.
* @param on 0 to disable the generation of the event, otherwise enable it.
*
* Specifies if the Screen Saver NotifyMask event on the screen
* associated with drawable should be generated for this client. If
* @p on is set to @c 0, the generation is disabled, otherwise, it is
* enabled.
* @ingroup Ecore_X_ScrenSaver_Group
*/
EAPI void
ecore_x_screensaver_event_listen_set(int on)
{
#ifdef ECORE_XCB_SCREENSAVER
xcb_screensaver_select_input(_ecore_xcb_conn,
((xcb_screen_t *)_ecore_xcb_screen)->root,
on ? XCB_SCREENSAVER_EVENT_NOTIFY_MASK : 0);
#endif /* ECORE_XCB_SCREENSAVER */
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,290 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_xcb_private.h"
/**
* @defgroup Ecore_X_Shape_Group X Shape extension
*
* Functions that use the shape extension of the X server to change shape of given windows.
*/
#ifdef ECORE_XCB_SHAPE
static int _shape_available = 0;
static xcb_shape_query_version_cookie_t _ecore_xcb_shape_init_cookie;
#endif /* ECORE_XCB_SHAPE */
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_shape_init and
_ecore_xcb_shape_init_finalize. The first one gets the cookies and
the second one gets the replies. */
void
_ecore_x_shape_init(const xcb_query_extension_reply_t *reply)
{
#ifdef ECORE_XCB_SHAPE
if (reply && (reply->present))
_ecore_xcb_shape_init_cookie = xcb_shape_query_version_unchecked(_ecore_xcb_conn);
#endif /* ECORE_XCB_SHAPE */
}
void
_ecore_x_shape_init_finalize(void)
{
#ifdef ECORE_XCB_SHAPE
xcb_shape_query_version_reply_t *reply;
reply = xcb_shape_query_version_reply(_ecore_xcb_conn,
_ecore_xcb_shape_init_cookie,
NULL);
if (reply)
{
_shape_available = 1;
free(reply);
}
#endif /* ECORE_XCB_SHAPE */
}
/**
* Sets the shape of the given window to the given pixmap.
* @param dest_win The given window.
* @param source_mask A 2-bit depth pixmap that provides the new shape of the window.
*
* Sets the shape of the window @p dest_win to the pixmap @p source_mask.
* @ingroup Ecore_X_Shape_Group
*/
EAPI void
ecore_x_window_shape_mask_set(Ecore_X_Window dest_win,
Ecore_X_Pixmap source_mask)
{
#ifdef ECORE_XCB_SHAPE
xcb_shape_mask(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, dest_win, 0, 0, source_mask);
#endif /* ECORE_XCB_SHAPE */
}
EAPI void
ecore_x_window_shape_window_set(Ecore_X_Window dest_win,
Ecore_X_Window shape_win)
{
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, dest_win, 0, 0, shape_win);
#endif /* ECORE_XCB_SHAPE */
}
EAPI void
ecore_x_window_shape_window_set_xy(Ecore_X_Window dest_win,
Ecore_X_Window shape_win,
int x,
int y)
{
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, dest_win, x, y, shape_win);
#endif /* ECORE_XCB_SHAPE */
}
/**
* Sets the shape of the given window to a rectangle.
* @param dest_win The given window.
* @param x The X coordinate of the top left corner of the rectangle.
* @param y The Y coordinate of the top left corner of the rectangle.
* @param width The width of the rectangle.
* @param height The height of the rectangle.
*
* Sets the shape of the window @p dest_win to a rectangle defined by
* @p x, @p y, @p width and @p height.
* @ingroup Ecore_X_Shape_Group
*/
EAPI void
ecore_x_window_shape_rectangle_set(Ecore_X_Window dest_win,
int x,
int y,
int width,
int height)
{
#ifdef ECORE_XCB_SHAPE
xcb_rectangle_t rect;
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 1, &rect);
#endif /* ECORE_XCB_SHAPE */
}
EAPI void
ecore_x_window_shape_rectangles_set(Ecore_X_Window dest_win,
Ecore_X_Rectangle *rects,
int num)
{
#ifdef ECORE_XCB_SHAPE
if (num > 0)
xcb_shape_rectangles(_ecore_xcb_conn,
XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
0, dest_win, 0, 0, num, (xcb_rectangle_t *)rects);
else
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 0, NULL);
#endif /* ECORE_XCB_SHAPE */
}
EAPI void
ecore_x_window_shape_window_add(Ecore_X_Window dest_win,
Ecore_X_Window shape_win)
{
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, dest_win, 0, 0, shape_win);
#endif /* ECORE_XCB_SHAPE */
}
EAPI void
ecore_x_window_shape_window_add_xy(Ecore_X_Window dest_win,
Ecore_X_Window shape_win,
int x,
int y)
{
#ifdef ECORE_XCB_SHAPE
xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, dest_win, x, y, shape_win);
#endif /* ECORE_XCB_SHAPE */
}
EAPI void
ecore_x_window_shape_rectangle_add(Ecore_X_Window dest_win,
int x,
int y,
int width,
int height)
{
#ifdef ECORE_XCB_SHAPE
xcb_rectangle_t rect;
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 1, &rect);
#endif /* ECORE_XCB_SHAPE */
}
EAPI void
ecore_x_window_shape_rectangle_clip(Ecore_X_Window dest_win,
int x,
int y,
int width,
int height)
{
xcb_rectangle_t rect;
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
xcb_shape_rectangles(_ecore_xcb_conn,
XCB_SHAPE_SO_INTERSECT, XCB_SHAPE_SK_BOUNDING,
0, dest_win, 0, 0, 1, &rect);
}
EAPI void
ecore_x_window_shape_rectangles_add(Ecore_X_Window dest_win,
Ecore_X_Rectangle *rects,
int num)
{
#ifdef ECORE_XCB_SHAPE
if (num > 0)
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, num, (const xcb_rectangle_t *)rects);
else
xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 0, NULL);
#endif /* ECORE_XCB_SHAPE */
}
/**
* Sends the ShapeGetRectangles request.
* @param window Requested window.
* @ingroup Ecore_X_Shape_Group
*/
EAPI void
ecore_x_window_shape_rectangles_get_prefetch(Ecore_X_Window window)
{
#ifdef ECORE_XCB_SHAPE
xcb_shape_get_rectangles_cookie_t cookie;
cookie = xcb_shape_get_rectangles_unchecked(_ecore_xcb_conn, window, XCB_SHAPE_SK_BOUNDING);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_SHAPE */
}
/**
* Gets the reply of the ShapeGetRectangles request sent by ecore_x_window_shape_rectangles_get_prefetch().
* @ingroup Ecore_X_Shape_Group
*/
EAPI void
ecore_x_window_shape_rectangles_get_fetch(void)
{
#ifdef ECORE_XCB_SHAPE
xcb_shape_get_rectangles_cookie_t cookie;
xcb_shape_get_rectangles_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_shape_get_rectangles_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_SHAPE */
}
/**
* To document.
* @param window Unused.
* @param num_ret To document.
* @return To document.
*
* To use this function, you must call before, and in order,
* ecore_x_window_shape_rectangles_get_prefetch(), which sends the ShapeGetRectangles request,
* then ecore_x_window_shape_rectangles_get_fetch(), which gets the reply.
* @ingroup Ecore_X_Shape_Group
*/
EAPI Ecore_X_Rectangle *
ecore_x_window_shape_rectangles_get(Ecore_X_Window window __UNUSED__,
int *num_ret)
{
Ecore_X_Rectangle *rects = NULL;
uint32_t num = 0;
#ifdef ECORE_XCB_SHAPE
xcb_shape_get_rectangles_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
{
if (num_ret) *num_ret = 0;
return NULL;
}
num = reply->rectangles_len;
rects = malloc(sizeof(Ecore_X_Rectangle) * num);
if (rects)
memcpy (rects,
xcb_shape_get_rectangles_rectangles(reply),
num * sizeof (Ecore_X_Rectangle));
else
num = 0;
#endif /* ECORE_XCB_SHAPE */
if (num_ret) *num_ret = num;
return rects;
}
EAPI void
ecore_x_window_shape_events_select(Ecore_X_Window dest_win,
int on)
{
#ifdef ECORE_XCB_SHAPE
xcb_shape_select_input(_ecore_xcb_conn, dest_win, on ? 1 : 0);
#endif /* ECORE_XCB_SHAPE */
}

View File

@ -0,0 +1,135 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_xcb_private.h"
/**
* @defgroup Ecore_X_Sync_Group X Sync Extension Functions
*
* Functions related to the X Sync extension.
*/
#ifdef ECORE_XCB_SYNC
static int _sync_available = 0;
static xcb_sync_initialize_cookie_t _ecore_xcb_sync_init_cookie;
#endif /* ECORE_XCB_SYNC */
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_sync_init and
_ecore_xcb_sync_init_finalize. The first one gets the cookies and
the second one gets the replies and set the atoms. */
void
_ecore_x_sync_init(const xcb_query_extension_reply_t *reply)
{
#ifdef ECORE_XCB_SYNC
if (reply && (reply->present))
_ecore_xcb_sync_init_cookie = xcb_sync_initialize_unchecked(_ecore_xcb_conn);
#endif /* ECORE_XCB_SYNC */
}
void
_ecore_x_sync_init_finalize(void)
{
#ifdef ECORE_XCB_SYNC
xcb_sync_initialize_reply_t *reply;
reply = xcb_sync_initialize_reply(_ecore_xcb_conn,
_ecore_xcb_sync_init_cookie, NULL);
if (reply)
{
if (reply->major_version >= 3)
_sync_available = 1;
free(reply);
}
#endif /* ECORE_XCB_SYNC */
}
/**
* Return whether the X server supports the Sync Extension.
* @return 1 if the X Sync Extension is available, 0 otherwise.
*
* Return 1 if the X server supports the Sync Extension version 3.0,
* 0 otherwise.
* @ingroup Ecore_X_Sync_Group
*/
EAPI int
ecore_x_sync_query(void)
{
#ifdef ECORE_XCB_SYNC
return _sync_available;
#else
return 0;
#endif /* ECORE_XCB_SYNC */
}
/**
* Create a new alarm.
* @param counter A counter.
* @return A newly created alarm.
*
* Create a new alarm.
* @ingroup Ecore_X_Sync_Group
*/
EAPI Ecore_X_Sync_Alarm
ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter)
{
#ifdef ECORE_XCB_SYNC
uint32_t value_list[6];
xcb_sync_int64_t init;
Ecore_X_Sync_Alarm alarm;
uint32_t value_mask;
init.lo = 0;
init.hi = 0;
xcb_sync_set_counter(_ecore_xcb_conn, counter, init);
value_mask =
XCB_SYNC_CA_COUNTER | XCB_SYNC_CA_VALUE_TYPE |
XCB_SYNC_CA_VALUE | XCB_SYNC_CA_TEST_TYPE |
XCB_SYNC_CA_DELTA | XCB_SYNC_CA_EVENTS;
value_list[0] = counter;
value_list[1] = XCB_SYNC_VALUETYPE_ABSOLUTE;
value_list[2] = 1;
value_list[3] = XCB_SYNC_TESTTYPE_POSITIVE_COMPARISON;
value_list[4] = 1;
value_list[5] = 1;
alarm = xcb_generate_id(_ecore_xcb_conn);
xcb_sync_create_alarm(_ecore_xcb_conn,
alarm,
value_mask,
(const uint32_t *)value_list);
ecore_x_sync();
return alarm;
#else
return 0;
#endif /* ECORE_XCB_SYNC */
}
/**
* Delete an alarm.
* @param alarm The alarm to delete.
* @return 1 on success, 0 otherwise.
*
* Delete the @p alarm. Returns 1 on success, 0 otherwise.
* @ingroup Ecore_X_Sync_Group
*/
EAPI int
ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm)
{
#ifdef ECORE_XCB_SYNC
xcb_sync_destroy_alarm(_ecore_xcb_conn, alarm);
return 1;
#else
return 0;
#endif /* ECORE_XCB_SYNC */
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,871 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_xcb_private.h"
#include "Ecore_X_Atoms.h"
/*
* Set CARD32 (array) property
*/
EAPI void
ecore_x_window_prop_card32_set(Ecore_X_Window win,
Ecore_X_Atom atom,
unsigned int *val,
unsigned int num)
{
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
atom, ECORE_X_ATOM_CARDINAL, 32, num, (const void *)val);
}
/**
* Sends the GetProperty request.
* @param window Window whose properties are requested.
* @param atom The atom.
*/
EAPI void
ecore_x_window_prop_card32_get_prefetch(Ecore_X_Window window,
Ecore_X_Atom atom)
{
xcb_get_property_cookie_t cookie;
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0,
window,
atom,
ECORE_X_ATOM_CARDINAL,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
}
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_card32_get_prefetch().
*/
EAPI void
ecore_x_window_prop_card32_get_fetch(void)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
}
/*
* Get CARD32 (array) property
*
* At most len items are returned in val.
* If the property was successfully fetched the number of items stored in
* val is returned, otherwise -1 is returned.
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
ecore_x_window_prop_card32_get(Ecore_X_Window win __UNUSED__,
Ecore_X_Atom atom __UNUSED__,
unsigned int *val,
unsigned int len)
{
xcb_get_property_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply ||
(reply->type != ECORE_X_ATOM_CARDINAL) ||
(reply->format != 32))
return -1;
if (reply->value_len < len)
len = xcb_get_property_value_length(reply);
if (val)
memcpy(val, xcb_get_property_value(reply), len);
return (int)len;
}
/*
* Get CARD32 (array) property of any length
*
* If the property was successfully fetched the number of items stored in
* val is returned, otherwise -1 is returned.
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
ecore_x_window_prop_card32_list_get(Ecore_X_Window win __UNUSED__,
Ecore_X_Atom atom __UNUSED__,
unsigned int **plist)
{
xcb_get_property_reply_t *reply;
int num = -1;
if (plist)
*plist = NULL;
reply = _ecore_xcb_reply_get();
if (!reply)
return -1;
if ((reply->type == XCB_NONE) ||
(reply->value_len == 0))
num = 0;
else if ((reply->type == ECORE_X_ATOM_CARDINAL) &&
(reply->format == 32))
{
uint32_t *val;
num = xcb_get_property_value_length(reply);
if (plist)
{
val = (uint32_t *)malloc (num);
if (!val)
goto error;
memcpy(val, xcb_get_property_value(reply), num);
*plist = val;
}
}
error:
return num;
}
/*
* Set X ID (array) property
*/
EAPI void
ecore_x_window_prop_xid_set(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom type,
Ecore_X_ID *xids,
unsigned int num)
{
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
atom, type, 32, num, xids);
}
/**
* Sends the GetProperty request.
* @param window Window whose properties are requested.
* @param atom The atom.
* @param type The atom type.
*/
EAPI void
ecore_x_window_prop_xid_get_prefetch(Ecore_X_Window window,
Ecore_X_Atom atom,
Ecore_X_Atom type)
{
xcb_get_property_cookie_t cookie;
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0,
window,
atom,
type,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
}
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_xid_get_prefetch().
*/
EAPI void
ecore_x_window_prop_xid_get_fetch(void)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
}
/*
* Get X ID (array) property
*
* At most len items are returned in val.
* If the property was successfully fetched the number of items stored in
* val is returned, otherwise -1 is returned.
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
ecore_x_window_prop_xid_get(Ecore_X_Window win __UNUSED__,
Ecore_X_Atom atom __UNUSED__,
Ecore_X_Atom type __UNUSED__,
Ecore_X_ID *xids,
unsigned int len)
{
xcb_get_property_reply_t *reply;
int num = len;
reply = _ecore_xcb_reply_get();
if (!reply)
return -1;
if (reply->type == XCB_NONE)
num = 0;
else if (reply->format == 32)
{
if (reply->value_len < len)
num = xcb_get_property_value_length(reply);
if (xids)
memcpy(xids, xcb_get_property_value(reply), num);
}
return num;
}
/*
* Get X ID (array) property
*
* If the property was successfully fetched the number of items stored in
* val is returned, otherwise -1 is returned.
* The returned array must be freed with free().
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
ecore_x_window_prop_xid_list_get(Ecore_X_Window win __UNUSED__,
Ecore_X_Atom atom __UNUSED__,
Ecore_X_Atom type __UNUSED__,
Ecore_X_ID **pxids)
{
xcb_get_property_reply_t *reply;
int num = -1;
if (pxids)
*pxids = NULL;
reply = _ecore_xcb_reply_get();
if (!reply)
return -1;
if ((reply->type == XCB_NONE) ||
(reply->value_len == 0))
num = 0;
else if ((reply->type == ECORE_X_ATOM_CARDINAL) &&
(reply->format == 32))
{
uint32_t *val;
num = xcb_get_property_value_length(reply);
if (pxids)
{
val = (uint32_t *)malloc (num);
if (!val)
return -1;
memcpy(val, xcb_get_property_value(reply), num);
*pxids = val;
}
}
return num;
}
/*
* Remove/add/toggle X ID list item.
*/
EAPI void
ecore_x_window_prop_xid_list_change(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom type,
Ecore_X_ID item,
int op)
{
Ecore_X_ID *lst;
int i;
int num;
num = ecore_x_window_prop_xid_list_get(win, atom, type, &lst);
if (num < 0)
return; /* Error - assuming invalid window */
/* Is it there? */
for (i = 0; i < num; i++)
{
if (lst[i] == item)
break;
}
if (i < num)
{
/* Was in list */
if (op == ECORE_X_PROP_LIST_ADD)
goto done;
/* Remove it */
num--;
for (; i < num; i++)
lst[i] = lst[i + 1];
}
else
{
/* Was not in list */
if (op == ECORE_X_PROP_LIST_REMOVE)
goto done;
/* Add it */
num++;
lst = realloc(lst, num * sizeof(Ecore_X_ID));
lst[i] = item;
}
ecore_x_window_prop_xid_set(win, atom, type, lst, num);
done:
if (lst)
free(lst);
}
/*
* Set Atom (array) property
*/
EAPI void
ecore_x_window_prop_atom_set(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom *list,
unsigned int num)
{
ecore_x_window_prop_xid_set(win, atom, ECORE_X_ATOM_ATOM, list, num);
}
/**
* Sends the GetProperty request.
* @param window Window whose properties are requested.
* @param atom Property atom.
*/
EAPI void
ecore_x_window_prop_atom_get_prefetch(Ecore_X_Window window,
Ecore_X_Atom atom)
{
xcb_get_property_cookie_t cookie;
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0,
window,
atom,
ECORE_X_ATOM_ATOM,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
}
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_atom_get_prefetch().
*/
EAPI void
ecore_x_window_prop_atom_get_fetch(void)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
}
/*
* Get Atom (array) property
*
* At most len items are returned in val.
* If the property was successfully fetched the number of items stored in
* val is returned, otherwise -1 is returned.
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
ecore_x_window_prop_atom_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom *list,
unsigned int len)
{
return ecore_x_window_prop_xid_get(win, atom, ECORE_X_ATOM_ATOM, list, len);
}
/*
* Get Atom (array) property
*
* If the property was successfully fetched the number of items stored in
* val is returned, otherwise -1 is returned.
* The returned array must be freed with free().
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
ecore_x_window_prop_atom_list_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom **plist)
{
return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_ATOM, plist);
}
/*
* Remove/add/toggle atom list item.
*/
EAPI void
ecore_x_window_prop_atom_list_change(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Atom item,
int op)
{
ecore_x_window_prop_xid_list_change(win, atom, ECORE_X_ATOM_ATOM, item, op);
}
/*
* Set Window (array) property
*/
EAPI void
ecore_x_window_prop_window_set(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Window *list,
unsigned int num)
{
ecore_x_window_prop_xid_set(win, atom, ECORE_X_ATOM_WINDOW, list, num);
}
/**
* Sends the GetProperty request.
* @param window Window whose properties are requested.
* @param atom The atom.
*/
EAPI void
ecore_x_window_prop_window_get_prefetch(Ecore_X_Window window,
Ecore_X_Atom atom)
{
xcb_get_property_cookie_t cookie;
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0,
window,
atom,
ECORE_X_ATOM_WINDOW,
0, 0x7fffffff);
_ecore_xcb_cookie_cache(cookie.sequence);
}
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_window_get_prefetch().
*/
EAPI void
ecore_x_window_prop_window_get_fetch(void)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
}
/*
* Get Window (array) property
*
* At most len items are returned in val.
* If the property was successfully fetched the number of items stored in
* val is returned, otherwise -1 is returned.
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
ecore_x_window_prop_window_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Window *list,
unsigned int len)
{
return ecore_x_window_prop_xid_get(win, atom, ECORE_X_ATOM_WINDOW, list, len);
}
/*
* Get Window (array) property
*
* If the property was successfully fetched the number of items stored in
* val is returned, otherwise -1 is returned.
* The returned array must be freed with free().
* Note: Return value 0 means that the property exists but has no elements.
*/
EAPI int
ecore_x_window_prop_window_list_get(Ecore_X_Window win,
Ecore_X_Atom atom,
Ecore_X_Window **plist)
{
return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_WINDOW, plist);
}
/**
* To be documented.
*
* FIXME: To be fixed.
*/
EAPI Ecore_X_Atom
ecore_x_window_prop_any_type(void)
{
return XCB_GET_PROPERTY_TYPE_ANY;
}
/**
* To be documented.
* @param window The window.
* @param property The property atom.
* @param type The type atom.
* @param size The size.
* @param data The data.
* @param number The size of the data.
*
* FIXME: To be fixed.
*/
EAPI void
ecore_x_window_prop_property_set(Ecore_X_Window window,
Ecore_X_Atom property,
Ecore_X_Atom type,
int size,
void *data,
int number)
{
if (window == 0) window = ((xcb_screen_t *)_ecore_xcb_screen)->root;
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
property, type,
size, number, data);
}
/**
* Sends the GetProperty request.
* @param window Window whose properties are requested.
* @param property Property atom.
* @param type Type atom.
*/
EAPI void
ecore_x_window_prop_property_get_prefetch(Ecore_X_Window window,
Ecore_X_Atom property,
Ecore_X_Atom type)
{
xcb_get_property_cookie_t cookie;
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0,
window ? window : ((xcb_screen_t *)_ecore_xcb_screen)->root,
property, type, 0, LONG_MAX);
_ecore_xcb_cookie_cache(cookie.sequence);
}
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_property_get_prefetch().
*/
EAPI void
ecore_x_window_prop_property_get_fetch(void)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
}
/**
* To be documented.
* @param window The window (Unused).
* @param property The property atom (Unused).
* @param type The type atom (Unused).
* @param size The size (Unused).
* @param data The returned data.
* @param num The size of the data.
* @return 1 on success, 0 otherwise.
*
* FIXME: To be fixed.
*/
EAPI int
ecore_x_window_prop_property_get(Ecore_X_Window window __UNUSED__,
Ecore_X_Atom property __UNUSED__,
Ecore_X_Atom type __UNUSED__,
int size __UNUSED__,
unsigned char **data,
int *num)
{
xcb_get_property_reply_t *reply;
/* make sure these are initialized */
if (num) *num = 0L;
if (data)
*data = NULL;
else /* we can't store the retrieved data, so just return */
return 0;
reply = _ecore_xcb_reply_get();
if (!reply)
return 0;
if ((reply->format != size) ||
(reply->value_len == 0))
return 0;
*data = malloc(reply->value_len);
if (!*data)
return 0;
memcpy(*data, xcb_get_property_value(reply),
xcb_get_property_value_length(reply));
if (num)
*num = reply->value_len;
return reply->format;
}
EAPI void
ecore_x_window_prop_property_del(Ecore_X_Window window,
Ecore_X_Atom property)
{
xcb_delete_property(_ecore_xcb_conn, window, property);
}
/**
* Sends the ListProperties request.
* @param window Window whose properties are requested.
*/
EAPI void
ecore_x_window_prop_list_prefetch(Ecore_X_Window window)
{
xcb_list_properties_cookie_t cookie;
cookie = xcb_list_properties_unchecked(_ecore_xcb_conn, window);
_ecore_xcb_cookie_cache(cookie.sequence);
}
/**
* Gets the reply of the ListProperties request sent by ecore_x_window_prop_list_prefetch().
*/
EAPI void
ecore_x_window_prop_list_fetch(void)
{
xcb_list_properties_cookie_t cookie;
xcb_list_properties_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_list_properties_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
}
/**
* To be documented.
* @param window The window (Unused).
* @param num_ret The number of atoms.
* @return The returned atoms.
*
* FIXME: To be fixed.
*/
EAPI Ecore_X_Atom *
ecore_x_window_prop_list(Ecore_X_Window window __UNUSED__,
int *num_ret)
{
xcb_list_properties_reply_t *reply;
Ecore_X_Atom *atoms;
if (num_ret) *num_ret = 0;
reply = _ecore_xcb_reply_get();
if (!reply)
return NULL;
atoms = (Ecore_X_Atom *)malloc(reply->atoms_len * sizeof(Ecore_X_Atom));
if (!atoms)
return NULL;
memcpy(atoms,
xcb_list_properties_atoms(reply),
reply->atoms_len * sizeof(Ecore_X_Atom));
if(num_ret)
*num_ret = reply->atoms_len;
return atoms;
}
/**
* Set a window string property.
* @param win The window
* @param type The property
* @param str The string
*
* Set a window string property
*/
EAPI void
ecore_x_window_prop_string_set(Ecore_X_Window win,
Ecore_X_Atom type,
const char *str)
{
if (win == 0) win = ((xcb_screen_t *)_ecore_xcb_screen)->root;
xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win,
type, ECORE_X_ATOM_UTF8_STRING,
8, strlen(str), str);
}
/**
* Sends the GetProperty request.
* @param window Window whose properties are requested.
* @param type The atom.
*/
EAPI void
ecore_x_window_prop_string_get_prefetch(Ecore_X_Window window,
Ecore_X_Atom type)
{
xcb_get_property_cookie_t cookie;
cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0,
window ? window : ((xcb_screen_t *)_ecore_xcb_screen)->root,
type, XCB_GET_PROPERTY_TYPE_ANY, 0L, 1000000L);
_ecore_xcb_cookie_cache(cookie.sequence);
}
/**
* Gets the reply of the GetProperty request sent by ecore_x_window_prop_string_get_prefetch().
*/
EAPI void
ecore_x_window_prop_string_get_fetch(void)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
}
/**
* Get a window string property.
* @param window The window
* @param type The property
*
* Return window string property of a window. String must be free'd when done.
*
* To use this function, you must call before, and in order,
* ecore_x_window_prop_string_get_prefetch(), which sends the GetProperty request,
* then ecore_x_window_prop_string_get_fetch(), which gets the reply.
*/
EAPI char *
ecore_x_window_prop_string_get(Ecore_X_Window window __UNUSED__,
Ecore_X_Atom type __UNUSED__)
{
xcb_get_property_reply_t *reply;
char *str = NULL;
reply = _ecore_xcb_reply_get();
if (!reply)
return NULL;
if (reply->type == ECORE_X_ATOM_UTF8_STRING)
{
int length;
length = reply->value_len;
str = (char *)malloc(length + 1);
memcpy(str,
xcb_get_property_value(reply),
length);
str[length] = '\0';
}
else
{
/* FIXME: to be done... */
/* #ifdef X_HAVE_UTF8_STRING */
/* s = Xutf8TextPropertyToTextList(_ecore_xcb_conn, &xtp, */
/* &list, &items); */
/* #else */
/* s = XmbTextPropertyToTextList(_ecore_xcb_conn, &xtp, */
/* &list, &items); */
/* #endif */
/* if ((s == XLocaleNotSupported) || */
/* (s == XNoMemory) || (s == XConverterNotFound)) */
/* { */
/* str = strdup((char *)xtp.value); */
/* } */
/* else if ((s >= Success) && (items > 0)) */
/* { */
/* str = strdup(list[0]); */
/* } */
/* if (list) */
/* XFreeStringList(list); */
}
return str;
}
/* FIXME : round trips because of GetWMProtocols */
/* should we rewrite its code ? */
EAPI int
ecore_x_window_prop_protocol_isset(Ecore_X_Window window,
Ecore_X_WM_Protocol protocol)
{
Ecore_X_Atom *protos;
Ecore_X_Atom proto;
uint32_t protos_count;
uint32_t i;
uint8_t ret = 0;
/* check for invalid values */
if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
return ret;
proto = _ecore_xcb_atoms_wm_protocols[protocol];
if (!xcb_get_wm_protocols(_ecore_xcb_conn, window, &protos_count, &protos))
return ret;
for (i = 0; i < protos_count; i++)
if (protos[i] == proto)
{
ret = 1;
break;
}
free(protos);
return ret;
}
/**
* To be documented.
* @param window The window.
* @param num_ret The number of WM protocols.
* @return The returned WM protocols.
*
* FIXME: To be fixed.
*/
/* FIXME : round trips because of get_wm_protocols */
/* should we rewrite its code ? */
EAPI Ecore_X_WM_Protocol *
ecore_x_window_prop_protocol_list_get(Ecore_X_Window window,
int *num_ret)
{
Ecore_X_WM_Protocol *prot_ret = NULL;
Ecore_X_Atom *protos;
uint32_t protos_count;
uint32_t i;
if (!xcb_get_wm_protocols(_ecore_xcb_conn, window, &protos_count, &protos))
return NULL;
if ((!protos) || (protos_count <= 0)) return NULL;
prot_ret = calloc(1, protos_count * sizeof(Ecore_X_WM_Protocol));
if (!prot_ret)
{
free(protos);
return NULL;
}
for (i = 0; i < protos_count; i++)
{
Ecore_X_WM_Protocol j;
prot_ret[i] = -1;
for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++)
{
if (_ecore_xcb_atoms_wm_protocols[j] == protos[i])
prot_ret[i] = j;
}
}
free(protos);
*num_ret = protos_count;
return prot_ret;
}

View File

@ -0,0 +1,197 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "ecore_xcb_private.h"
/**
* @defgroup Ecore_X_Xinerama_Group X Xinerama Extension Functions
*
* Functions related to the X Xinerama extension.
*/
#ifdef ECORE_XCB_XINERAMA
static int _xinerama_available = 0;
static xcb_xinerama_query_version_cookie_t _ecore_xcb_xinerama_init_cookie;
#endif /* ECORE_XCB_XINERAMA */
/* To avoid round trips, the initialization is separated in 2
functions: _ecore_xcb_xinerama_init and
_ecore_xcb_xinerama_init_finalize. The first one gets the cookies and
the second one gets the replies. */
void
_ecore_x_xinerama_init(const xcb_query_extension_reply_t *reply)
{
#ifdef ECORE_XCB_XINERAMA
if (reply && (reply->present))
_ecore_xcb_xinerama_init_cookie = xcb_xinerama_query_version_unchecked(_ecore_xcb_conn, 1, 2);
#endif /* ECORE_XCB_XINERAMA */
}
void
_ecore_x_xinerama_init_finalize(void)
{
#ifdef ECORE_XCB_XINERAMA
xcb_xinerama_query_version_reply_t *reply;
reply = xcb_xinerama_query_version_reply(_ecore_xcb_conn,
_ecore_xcb_xinerama_init_cookie, NULL);
if (reply)
{
if ((reply->major >= 1) &&
(reply->minor >= 1))
_xinerama_available = 1;
free(reply);
}
#endif /* ECORE_XCB_XINERAMA */
}
/**
* Return whether the X server supports the Xinerama Extension.
* @return 1 if the X Xinerama Extension is available, 0 otherwise.
*
* Return 1 if the X server supports the Fixes Xinerama version 1.1,
* 0 otherwise.
* @ingroup Ecore_X_Xinerama_Group
*/
EAPI int
ecore_x_xinerama_query(void)
{
#ifdef ECORE_XCB_XINERAMA
return _xinerama_available;
#else
return 0;
#endif /* ECORE_XCB_XINERAMA */
}
/**
* Sends the XineramaQueryScreens request.
* @ingroup Ecore_X_Xinerama_Group
*/
EAPI void
ecore_x_xinerama_query_screens_prefetch(void)
{
#ifdef ECORE_XCB_XINERAMA
xcb_xinerama_query_screens_cookie_t cookie;
cookie = xcb_xinerama_query_screens_unchecked(_ecore_xcb_conn);
_ecore_xcb_cookie_cache(cookie.sequence);
#endif /* ECORE_XCB_XINERAMA */
}
/**
* Gets the reply of the XineramaQueryScreens request sent by ecore_x_xinerama_query_screens_prefetch().
* @ingroup Ecore_X_Xinerama_Group
*/
EAPI void
ecore_x_xinerama_query_screens_fetch(void)
{
#ifdef ECORE_XCB_XINERAMA
xcb_xinerama_query_screens_cookie_t cookie;
xcb_xinerama_query_screens_reply_t *reply;
cookie.sequence = _ecore_xcb_cookie_get();
reply = xcb_xinerama_query_screens_reply(_ecore_xcb_conn, cookie, NULL);
_ecore_xcb_reply_cache(reply);
#endif /* ECORE_XCB_XINERAMA */
}
/**
* Return the number of screens.
* @return The screen count.
*
* Return the number of screens.
*
* To use this function, you must call before, and in order,
* ecore_x_xinerama_query_screens_prefetch(), which sends the XineramaQueryScreens request,
* then ecore_x_xinerama_query_screens_fetch(), which gets the reply.
* @ingroup Ecore_X_Xinerama_Group
*/
EAPI int
ecore_x_xinerama_screen_count_get(void)
{
int screen_count = 0;
#ifdef ECORE_XCB_XINERAMA
xcb_xinerama_screen_info_iterator_t iter;
xcb_xinerama_query_screens_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply) return 0;
iter = xcb_xinerama_query_screens_screen_info_iterator(reply);
screen_count = iter.rem;
#endif /* ECORE_XCB_XINERAMA */
return screen_count;
}
/**
* Get the geometry of the screen.
* @param screen The screen (Unused).
* @param x The X coordinate of the screen.
* @param y The Y coordinate of the screen
* @param width The width of the screen
* @param height The height of the screen
* @return 1 on success, 0 otherwise.
*
* Get the geometry of the screen whose number is @p screen. The
* returned values are stored in @p x, @p y, @p width and @p height.
*
* To use this function, you must call before, and in order,
* ecore_x_xinerama_query_screens_prefetch(), which sends the XineramaQueryScreens request,
* then ecore_x_xinerama_query_screens_fetch(), which gets the reply.
* @ingroup Ecore_X_Xinerama_Group
*/
EAPI int
ecore_x_xinerama_screen_geometry_get(int screen,
int *x,
int *y,
int *width,
int *height)
{
#ifdef ECORE_XCB_XINERAMA
xcb_xinerama_screen_info_iterator_t iter;
xcb_xinerama_query_screens_reply_t *reply;
reply = _ecore_xcb_reply_get();
if (!reply)
{
if (x) *x = 0;
if (y) *y = 0;
if (width) *width = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
if (height) *height = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
return 0;
}
iter = xcb_xinerama_query_screens_screen_info_iterator(reply);
for (; iter.rem; screen--, xcb_xinerama_screen_info_next(&iter))
{
if (screen == 0)
{
if (x) *x = iter.data->x_org;
if (y) *y = iter.data->y_org;
if (width) *width = iter.data->width;
if (height) *height = iter.data->height;
return 1;
}
}
#endif /* ECORE_XCB_XINERAMA */
if (x) *x = 0;
if (y) *y = 0;
if (width) *width = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels;
if (height) *height = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels;
return 0;
}