xcursor support... note the comment in the Makefile.am.

i dont have enough expletives to describe what i think of libtool....


SVN revision: 12733
This commit is contained in:
Carsten Haitzler 2005-01-04 10:26:17 +00:00
parent e3e9a48c9a
commit c15b8941e3
5 changed files with 228 additions and 134 deletions

View File

@ -242,9 +242,9 @@ if test "x$have_ecore_x" = "xyes"; then
BUILD_ECORE_X=1
x_dir="/usr/X11R6";
x_includes="";
x_cflags="-I"$x_dir"/include"
x_libs="-L"$x_dir"/lib -lX11 -lXext"
x_ldflags="";
x_cflags="-I"$x_dir"/include";
x_libs="-L"$x_dir"/lib -lX11 -lXext";
x_ldflags=" "$ecore_x_libs;
ecore_x_libs="-lecore_x";
else
AM_CONDITIONAL(BUILD_ECORE_X, false)
@ -258,6 +258,33 @@ AC_SUBST(x_includes)
AC_SUBST(x_ldflags)
AC_SUBST(x_libs)
Xcursor_libs=""
Xcursor_cflags=""
use_Xcursor="no"
AC_CHECK_HEADER(X11/Xcursor/Xcursor.h, [
AC_CHECK_LIB(Xcursor, XcursorImageLoadCursor, [
AC_DEFINE(ECORE_XCURSOR, 1, [Build support for Xcursor])
Xcursor_cflags=""
Xcursor_libs="-IXcursor"
use_Xcursor="yes"
], [
Xcursor_cflags=""
Xcursor_libs=""
use_Xcursor="no"
]
)
], [
Xcursor_cflags=""
Xcursor_libs=""
use_Xcursor="no"
], [
#include <X11/Xlib.h>
]
)
AC_SUBST(Xcursor_cflags)
AC_SUBST(Xcursor_libs)
AC_SUBST(ecore_x_cflags)
AC_SUBST(ecore_x_libs)
@ -684,7 +711,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"
echo " Ecore_X.................: $have_ecore_x (Xcursor: $use_Xcursor)"
echo " Ecore_FB................: $have_ecore_fb"
echo " Ecore_Evas..............: $have_ecore_evas"
echo " Ecore_Evas GL Support...: $have_ecore_evas_gl"

View File

@ -80,13 +80,13 @@ ecore_test.c
ecore_test_LDADD = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(ECORE_X_LIB) \
$(ECORE_TXT_LIB) \
$(ECORE_JOB_LIB) \
$(ECORE_FB_LIB) \
$(ECORE_X_LIB) \
$(ECORE_EVAS_LIB) \
$(ECORE_CON_LIB) \
$(ECORE_IPC_LIB) \
$(ECORE_TXT_LIB) \
-lm @iconv_libs@
ecore_test_CFLAGS = \
@ -95,13 +95,13 @@ $(INCLUDES)
ecore_test_DEPENDENCIES = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(ECORE_X_LIB) \
$(ECORE_TXT_LIB) \
$(ECORE_JOB_LIB) \
$(ECORE_FB_LIB) \
$(ECORE_X_LIB) \
$(ECORE_EVAS_LIB) \
$(ECORE_CON_LIB) \
$(ECORE_IPC_LIB) \
$(ECORE_TXT_LIB)
$(ECORE_IPC_LIB)
ecore_evas_test_SOURCES = \
ecore_evas_test.c \
@ -112,13 +112,13 @@ ecore_evas_test.h
ecore_evas_test_LDADD = \
$(top_builddir)/src/lib/ecore/libecore.la \
$(ECORE_X_LIB) \
$(ECORE_TXT_LIB) \
$(ECORE_JOB_LIB) \
$(ECORE_FB_LIB) \
$(ECORE_X_LIB) \
$(ECORE_EVAS_LIB) \
$(ECORE_CON_LIB) \
$(ECORE_IPC_LIB) \
$(ECORE_TXT_LIB) \
-lm @iconv_libs@
ecore_evas_test_CFLAGS = \

View File

@ -1,19 +1,22 @@
## Process this file with automake to produce Makefile.in
INCLUDES = \
@Xcursor_cflags@ \
@x_cflags@ \
-I$(top_srcdir)/src/lib/ecore \
-I$(top_srcdir)/src/lib/ecore_txt \
-I$(top_srcdir)/src/lib/ecore_job \
-I$(top_builddir)/src/lib/ecore \
-I$(top_builddir)/src/lib/ecore_txt \
-I$(top_builddir)/src/lib/ecore_job \
@x_cflags@
-I$(top_builddir)/src/lib/ecore_job
libecore_x_la_LDFLAGS = -version-info 1:0:0 \
-L$(top_builddir)/src/lib/ecore/.libs \
-L$(top_builddir)/src/lib/ecore_txt/.libs \
-L$(top_builddir)/src/lib/ecore_job/.libs
XCURSOR_LIBS=@Xcursor_libs@
if BUILD_ECORE_X
lib_LTLIBRARIES = libecore_x.la
@ -38,12 +41,32 @@ ecore_x_pixmap.c \
ecore_x_gc.c \
ecore_x_private.h
### FUCK FUCK FIXME:
# This line:
###@Xcursor_libs@ \
# has been replaced by
###-lXcursor
# because -f or some unknonw reason libtool REFUSES to put -lXcursor into the
# .la file for libecore_x in the dependency libs UNLESS this is explicitly
# states and not used as a replace term. if someone knows why... let me know
# and send patches... but i'm fresh out of ideas.
#
# After trying to get this working for the last 2+ hours... i only have one
# thing to say... FUCK YOU LIBSPLEEN! FUCK YOU!
#
# GRRRR... (this is just an example of what shits developers off about auto
# foo - somehting that should obviously "just work" and if i make my own
# Makefiles it works. its happy. but once you go through the 368 layers of
# autofuck things mysteriously stop working and if you're lucky you may just
# run across a workaround as I have here... ARGH!)
libecore_x_la_LIBADD = \
-lXcursor \
@x_ldflags@ \
@x_libs@ \
$(top_builddir)/src/lib/ecore/libecore.la \
$(top_builddir)/src/lib/ecore_txt/libecore_txt.la \
$(top_builddir)/src/lib/ecore_job/libecore_job.la \
@x_ldflags@ \
@x_libs@
$(top_builddir)/src/lib/ecore_job/libecore_job.la
libecore_x_la_DEPENDENCIES = \
$(top_builddir)/src/lib/ecore/libecore.la \

View File

@ -25,6 +25,7 @@ Time _ecore_x_event_last_time = 0;
Window _ecore_x_event_last_win = 0;
int _ecore_x_event_last_root_x = 0;
int _ecore_x_event_last_root_y = 0;
int _ecore_x_xcursor = 0;
/* FIXME - These are duplicates after making ecore atoms public */
Ecore_X_Atom ECORE_X_ATOM_FILE_NAME = 0;
@ -178,6 +179,9 @@ ecore_x_init(const char *name)
_ecore_x_disp = NULL;
return 0;
}
#ifdef ECORE_XCURSOR
_ecore_x_xcursor = XcursorSupportsARGB(_ecore_x_disp);
#endif
_ecore_x_event_handlers[KeyPress] = _ecore_x_event_handle_key_press;
_ecore_x_event_handlers[KeyRelease] = _ecore_x_event_handle_key_release;
_ecore_x_event_handlers[ButtonPress] = _ecore_x_event_handle_button_press;
@ -985,6 +989,38 @@ ecore_x_window_children_get(Ecore_X_Window win, int *num)
Ecore_X_Cursor
ecore_x_cursor_new(Ecore_X_Window win, int *pixels, int w, int h, int hot_x, int hot_y)
{
#ifdef ECORE_XCURSOR
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] = (a << 24) | (r << 16) | (g << 8) | (b);
}
c = XcursorImageLoadCursor(_ecore_x_disp, xci);
XcursorImageDestroy(xci);
return c;
}
}
else
#endif
{
XColor c1, c2;
Cursor c;
Pixmap pmap, mask;
@ -1116,6 +1152,8 @@ ecore_x_cursor_new(Ecore_X_Window win, int *pixels, int w, int h, int hot_x, int
XFreePixmap(_ecore_x_disp, pmap);
XFreePixmap(_ecore_x_disp, mask);
return c;
}
return 0;
}
void

View File

@ -1,6 +1,8 @@
#ifndef _ECORE_X_PRIVATE_H
#define _ECORE_X_PRIVATE_H
#include "config.h"
#include <sys/param.h>
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 256
@ -15,6 +17,9 @@
#include <X11/keysymdef.h>
#include <X11/extensions/XShm.h>
#include <X11/extensions/shape.h>
#ifdef ECORE_XCURSOR
#include <X11/Xcursor/Xcursor.h>
#endif
#include "Ecore_X.h"
@ -106,6 +111,7 @@ extern Time _ecore_x_event_last_time;
extern Window _ecore_x_event_last_win;
extern int _ecore_x_event_last_root_x;
extern int _ecore_x_event_last_root_y;
extern int _ecore_x_xcursor;
extern Ecore_X_Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM];