From 4f00524964e5927d17a2330389ac69d8b148b07a Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Wed, 23 Mar 2005 11:49:48 +0000 Subject: [PATCH] xprint support to weed out xprint screens from the root list - they arent real roots - they are special... :) SVN revision: 13873 --- legacy/ecore/configure.in | 34 +++++++++- legacy/ecore/src/lib/ecore_x/Makefile.am | 2 + legacy/ecore/src/lib/ecore_x/ecore_x.c | 63 ++++++++++++++++++- .../ecore/src/lib/ecore_x/ecore_x_private.h | 3 + 4 files changed, 100 insertions(+), 2 deletions(-) diff --git a/legacy/ecore/configure.in b/legacy/ecore/configure.in index 02383461e0..b34a3679b0 100644 --- a/legacy/ecore/configure.in +++ b/legacy/ecore/configure.in @@ -295,6 +295,38 @@ CFLAGS=$PCFLAGS AC_SUBST(Xcursor_cflags) AC_SUBST(Xcursor_libs) +Xprint_libs="" +Xprint_cflags="" +use_Xprint="no" +PCFLAGS=$CFLAGS +CFLAGS=$x_cflags" "$x_includes +AC_CHECK_HEADER(X11/extensions/Print.h, [ + AC_CHECK_LIB(Xp, XpQueryScreens, [ + AC_DEFINE(ECORE_XPRINT, 1, [Build support for Xprint]) + Xprint_cflags="" + Xprint_libs="-lXp" + use_Xprint="yes" + ], [ + Xprint_cflags="" + Xprint_libs="" + use_Xprint="no" + ], [ + $x_libs $x_ldflags + ] + ) + ], [ + Xprint_cflags="" + Xprint_libs="" + use_Xprint="no" + ], [ + #include + ] +) +CFLAGS=$PCFLAGS + +AC_SUBST(Xprint_cflags) +AC_SUBST(Xprint_libs) + Xinerama_libs="" Xinerama_cflags="" use_Xinerama="no" @@ -844,7 +876,7 @@ 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) (Xinerama: $use_Xinerama)" +echo " Ecore_X.................: $have_ecore_x (Xcursor: $use_Xcursor) (Xprint: $use_Xprint) (Xinerama: $use_Xinerama)" echo " Ecore_FB................: $have_ecore_fb" echo " Ecore_Evas..............: $have_ecore_evas" echo " Ecore_Evas GL Support...: $have_ecore_evas_gl" diff --git a/legacy/ecore/src/lib/ecore_x/Makefile.am b/legacy/ecore/src/lib/ecore_x/Makefile.am index 6f2e265063..cbae57ddfb 100644 --- a/legacy/ecore/src/lib/ecore_x/Makefile.am +++ b/legacy/ecore/src/lib/ecore_x/Makefile.am @@ -2,6 +2,7 @@ MAINTAINERCLEANFILES = Makefile.in INCLUDES = \ @Xcursor_cflags@ \ +@Xprint_cflags@ \ @Xinerama_cflags@ \ @x_cflags@ \ -I$(top_srcdir)/src/lib/ecore \ @@ -44,6 +45,7 @@ ecore_x_private.h libecore_x_la_LIBADD = \ @Xcursor_libs@ \ +@Xprint_libs@ \ @Xinerama_libs@ \ @x_ldflags@ \ @x_libs@ \ diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x.c b/legacy/ecore/src/lib/ecore_x/ecore_x.c index a540645c9a..169ea44864 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x.c @@ -788,11 +788,72 @@ ecore_x_window_root_list(int *num_ret) if (!num_ret) return NULL; *num_ret = 0; +#ifdef ECORE_XPRINT + { + Screen **ps = NULL; + int psnum = 0; + + num = ScreenCount(_ecore_x_disp); + ps = XpQueryScreens(_ecore_x_disp, &psnum); + if (ps) + { + int overlap, j; + + overlap = 0; + for (i = 0; i < num; i++) + { + for (j = 0; j < psnum; j++) + { + if (ScreenOfDisplay(_ecore_x_disp, i) == ps[j]) + overlap++; + } + } + roots = malloc((num - overlap) * sizeof(Window)); + if (roots) + { + int k; + + k = 0; + for (i = 0; i < num; i++) + { + int is_print; + + is_print = 0; + for (j = 0; j < psnum; j++) + { + if (ScreenOfDisplay(_ecore_x_disp, i) == ps[j]) + { + is_print = 1; + break; + } + } + if (!is_print) + { + roots[k] = RootWindow(_ecore_x_disp, i); + k++; + } + } + *num_ret = k; + } + XFree(ps); + } + else + { + roots = malloc(num * sizeof(Window)); + if (!roots) return NULL; + *num_ret = num; + for (i = 0; i < num; i++) + roots[i] = RootWindow(_ecore_x_disp, i); + } + } +#else num = ScreenCount(_ecore_x_disp); roots = malloc(num * sizeof(Window)); if (!roots) return NULL; *num_ret = num; - for (i = 0; i < num; i++) roots[i] = RootWindow(_ecore_x_disp, i); + for (i = 0; i < num; i++) + roots[i] = RootWindow(_ecore_x_disp, i); +#endif return roots; } diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_private.h b/legacy/ecore/src/lib/ecore_x/ecore_x_private.h index 1db026f267..e664230fc8 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_private.h +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_private.h @@ -20,6 +20,9 @@ #ifdef ECORE_XCURSOR #include #endif +#ifdef ECORE_XPRINT +#include +#endif #ifdef ECORE_XINERAMA #include #endif