Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
3b97514d
Commit
3b97514d
authored
Mar 11, 2011
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for the Xcursor library for color cursors
parent
d8ce454e
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
276 additions
and
31 deletions
+276
-31
configure
configure
+181
-29
configure.in
configure.in
+30
-1
SDL_config.h.in
include/SDL_config.h.in
+2
-0
SDL_x11dyn.c
src/video/x11/SDL_x11dyn.c
+4
-0
SDL_x11dyn.h
src/video/x11/SDL_x11dyn.h
+3
-0
SDL_x11mouse.c
src/video/x11/SDL_x11mouse.c
+45
-1
SDL_x11sym.h
src/video/x11/SDL_x11sym.h
+8
-0
SDL_x11video.h
src/video/x11/SDL_x11video.h
+3
-0
No files found.
configure
View file @
3b97514d
This diff is collapsed.
Click to expand it.
configure.in
View file @
3b97514d
...
...
@@ -1023,10 +1023,11 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma
, enable_x11_shared=maybe)
case "$host" in
*-*-darwin*)
# Latest Mac OS X actually ships with Xrandr/Xrender libs...
*-*-darwin*)
x11_symbols_private=yes
x11_lib='/usr/X11R6/lib/libX11.6.dylib'
x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
...
...
@@ -1037,6 +1038,7 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma
*)
x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
...
...
@@ -1082,6 +1084,33 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma
fi
have_video=yes
AC_ARG_ENABLE(video-x11-xcursor,
AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]),
, enable_video_x11_xcursor=yes)
if test x$enable_video_x11_xcursor = xyes; then
definitely_enable_video_x11_xcursor=no
AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
have_xcursor_h_hdr=yes,
have_xcursor_h_hdr=no,
[#include <X11/Xlib.h>
])
if test x$have_xcursor_h_hdr = xyes; then
if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then
echo "-- dynamic libXcursor -> $xcursor_lib"
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib")
definitely_enable_video_x11_xcursor=yes
else
AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes)
if test x$have_xcursor_lib = xyes ; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
definitely_enable_video_x11_xcursor=yes
fi
fi
fi
fi
if test x$definitely_enable_video_x11_xcursor = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR)
fi
AC_ARG_ENABLE(video-x11-xinerama,
AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
, enable_video_x11_xinerama=yes)
...
...
include/SDL_config.h.in
View file @
3b97514d
...
...
@@ -265,11 +265,13 @@
#undef SDL_VIDEO_DRIVER_X11
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE
#undef SDL_VIDEO_DRIVER_X11_XCURSOR
#undef SDL_VIDEO_DRIVER_X11_XINERAMA
#undef SDL_VIDEO_DRIVER_X11_XINPUT
#undef SDL_VIDEO_DRIVER_X11_XRANDR
...
...
src/video/x11/SDL_x11dyn.c
View file @
3b97514d
...
...
@@ -46,6 +46,9 @@ typedef struct
#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT NULL
#endif
#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR NULL
#endif
#ifndef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA NULL
#endif
...
...
@@ -65,6 +68,7 @@ typedef struct
static
x11dynlib
x11libs
[]
=
{
{
NULL
,
SDL_VIDEO_DRIVER_X11_DYNAMIC
},
{
NULL
,
SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
},
{
NULL
,
SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
},
{
NULL
,
SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA
},
{
NULL
,
SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT
},
{
NULL
,
SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
},
...
...
src/video/x11/SDL_x11dyn.h
View file @
3b97514d
...
...
@@ -44,6 +44,9 @@
#include <X11/extensions/XShm.h>
#endif
#if SDL_VIDEO_DRIVER_X11_XCURSOR
#include <X11/Xcursor/Xcursor.h>
#endif
#if SDL_VIDEO_DRIVER_X11_XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
...
...
src/video/x11/SDL_x11mouse.c
View file @
3b97514d
...
...
@@ -20,6 +20,8 @@
slouken@libsdl.org
*/
#include "SDL_config.h"
#include "SDL_assert.h"
#include "SDL_x11video.h"
#include "SDL_x11mouse.h"
#include "../../events/SDL_mouse_c.h"
...
...
@@ -81,6 +83,35 @@ X11_CreateDefaultCursor()
return
cursor
;
}
#if SDL_VIDEO_DRIVER_X11_XCURSOR
static
Cursor
X11_CreateXCursorCursor
(
SDL_Surface
*
surface
,
int
hot_x
,
int
hot_y
)
{
Display
*
display
=
GetDisplay
();
Cursor
cursor
=
None
;
XcursorImage
*
image
;
image
=
XcursorImageCreate
(
surface
->
w
,
surface
->
h
);
if
(
!
image
)
{
SDL_OutOfMemory
();
return
None
;
}
image
->
xhot
=
hot_x
;
image
->
yhot
=
hot_y
;
image
->
delay
=
0
;
SDL_assert
(
surface
->
format
->
format
==
SDL_PIXELFORMAT_ARGB8888
);
SDL_assert
(
surface
->
pitch
==
surface
->
w
*
4
);
SDL_memcpy
(
image
->
pixels
,
surface
->
pixels
,
surface
->
h
*
surface
->
pitch
);
cursor
=
XcursorImageLoadCursor
(
display
,
image
);
XcursorImageDestroy
(
image
);
return
cursor
;
}
#endif
/* SDL_VIDEO_DRIVER_X11_XCURSOR */
static
Cursor
X11_CreatePixmapCursor
(
SDL_Surface
*
surface
,
int
hot_x
,
int
hot_y
)
{
...
...
@@ -101,6 +132,9 @@ X11_CreatePixmapCursor(SDL_Surface * surface, int hot_x, int hot_y)
return
None
;
}
/* Code below assumes ARGB pixel format */
SDL_assert
(
surface
->
format
->
format
==
SDL_PIXELFORMAT_ARGB8888
);
rfg
=
gfg
=
bfg
=
rbg
=
gbg
=
bbg
=
fgBits
=
0
;
for
(
y
=
0
;
y
<
surface
->
h
;
++
y
)
{
ptr
=
(
Uint32
*
)((
Uint8
*
)
surface
->
pixels
+
y
*
surface
->
pitch
);
...
...
@@ -162,7 +196,17 @@ X11_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
cursor
=
SDL_calloc
(
1
,
sizeof
(
*
cursor
));
if
(
cursor
)
{
cursor
->
driverdata
=
(
void
*
)
X11_CreatePixmapCursor
(
surface
,
hot_x
,
hot_y
);
Cursor
x11_cursor
=
None
;
#if SDL_VIDEO_DRIVER_X11_XCURSOR
if
(
SDL_X11_HAVE_XCURSOR
)
{
x11_cursor
=
X11_CreateXCursorCursor
(
surface
,
hot_x
,
hot_y
);
}
#endif
if
(
x11_cursor
==
None
)
{
x11_cursor
=
X11_CreatePixmapCursor
(
surface
,
hot_x
,
hot_y
);
}
cursor
->
driverdata
=
(
void
*
)
x11_cursor
;
}
else
{
SDL_OutOfMemory
();
}
...
...
src/video/x11/SDL_x11sym.h
View file @
3b97514d
...
...
@@ -175,6 +175,14 @@ SDL_X11_SYM(int,ipAllocateData,(ChannelPtr a,IPCard b,IPDataPtr * c),(a,b,c),ret
SDL_X11_SYM
(
int
,
ipUnallocateAndSendData
,(
ChannelPtr
a
,
IPCard
b
),(
a
,
b
),
return
)
#endif
/* XCursor support */
#if SDL_VIDEO_DRIVER_X11_XCURSOR
SDL_X11_MODULE
(
XCURSOR
)
SDL_X11_SYM
(
XcursorImage
*
,
XcursorImageCreate
,(
int
a
,
int
b
),(
a
,
b
),)
SDL_X11_SYM
(
void
,
XcursorImageDestroy
,(
XcursorImage
*
a
),(
a
),)
SDL_X11_SYM
(
Cursor
,
XcursorImageLoadCursor
,(
Display
*
a
,
const
XcursorImage
*
b
),(
a
,
b
),)
#endif
/* Xinerama support */
#if SDL_VIDEO_DRIVER_X11_XINERAMA
SDL_X11_MODULE
(
XINERAMA
)
...
...
src/video/x11/SDL_x11video.h
View file @
3b97514d
...
...
@@ -32,6 +32,9 @@
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#if SDL_VIDEO_DRIVER_X11_XCURSOR
#include <X11/Xcursor/Xcursor.h>
#endif
#if SDL_VIDEO_DRIVER_X11_XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment