Commit 96596596 authored by Sam Lantinga's avatar Sam Lantinga

Added David Hedbor's Qtopia patches

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40372
parent 4c4f326a
......@@ -322,15 +322,15 @@ CheckESD()
[ --enable-esd support the Enlightened Sound Daemon [default=yes]],
, enable_esd=yes)
if test x$enable_audio = xyes -a x$enable_esd = xyes; then
use_esd=no
use_esd=no
AM_PATH_ESD(0.2.8, use_esd=yes)
if test x$use_esd = xyes; then
if test x$use_esd = xyes; then
AC_ARG_ENABLE(esd-shared,
[ --enable-esd-shared dynamically load ESD audio support [default=no]],
, enable_esd_shared=no)
esd_lib_spec=`echo $ESD_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libesd.so.*/'`
esd_lib=`ls $esd_lib_spec | head -1 | sed 's/.*\/\(.*\)/\1/'`
echo "-- $esd_lib_spec -> $esd_lib"
esd_lib=`ls $esd_lib_spec | head -1 | sed 's/.*\/\(.*\)/\1/'`
echo "-- $esd_lib_spec -> $esd_lib"
if test x$enable_dlopen != xyes && \
test x$enable_esd_shared = xyes; then
AC_MSG_ERROR([You must have dlopen() support and use the --enable-dlopen option])
......@@ -338,7 +338,7 @@ CheckESD()
if test x$enable_dlopen = xyes && \
test x$enable_esd_shared = xyes && test x$esd_lib != x; then
CFLAGS="$CFLAGS -DESD_SUPPORT -DESD_DYNAMIC=\$(esd_lib) $ESD_CFLAGS"
AC_SUBST(esd_lib)
AC_SUBST(esd_lib)
else
CFLAGS="$CFLAGS -DESD_SUPPORT $ESD_CFLAGS"
SYSTEM_LIBS="$SYSTEM_LIBS $ESD_LIBS"
......@@ -379,8 +379,8 @@ CheckARTSC()
[ --enable-arts-shared dynamically load aRts audio support [default=no]],
, enable_arts_shared=no)
arts_lib_spec=`echo $ARTSC_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libartsc.so.*/'`
arts_lib=`ls $arts_lib_spec | head -1 | sed 's/.*\/\(.*\)/\1/'`
echo "-- $arts_lib_spec -> $arts_lib"
arts_lib=`ls $arts_lib_spec | head -1 | sed 's/.*\/\(.*\)/\1/'`
echo "-- $arts_lib_spec -> $arts_lib"
if test x$enable_dlopen != xyes && \
test x$enable_arts_shared = xyes; then
AC_MSG_ERROR([You must have dlopen() support and use the --enable-dlopen option])
......@@ -388,7 +388,7 @@ CheckARTSC()
if test x$enable_dlopen = xyes && \
test x$enable_arts_shared = xyes && test x$arts_lib != x; then
CFLAGS="$CFLAGS -DARTSC_SUPPORT -DARTSC_DYNAMIC=\$(arts_lib) $ARTSC_CFLAGS"
AC_SUBST(arts_lib)
AC_SUBST(arts_lib)
else
CFLAGS="$CFLAGS -DARTSC_SUPPORT $ARTSC_CFLAGS"
SYSTEM_LIBS="$SYSTEM_LIBS $ARTSC_LIBS"
......@@ -1165,7 +1165,7 @@ CheckPTHREAD()
#include <pthread.h>
],[
pthread_mutexattr_t attr;
#ifdef linux
#if defined(linux) && !(defined(__arm__) && defined(QWS))
pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
#else
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
......@@ -1349,6 +1349,36 @@ CheckBWINDOW()
VIDEO_DRIVERS="$VIDEO_DRIVERS bwindow/libvideo_bwindow.la"
}
dnl Set up the QTopia video driver if enabled
CheckQtopia()
{
AC_ARG_ENABLE(video-qtopia,
[ --enable-video-qtopia use Qtopia video driver [default=no]],
, enable_video_qtopia=no)
if test x$enable_video = xyes -a x$enable_video_qtopia = xyes; then
AC_MSG_CHECKING(for Qtopia support)
video_qtopia=no
AC_LANG_CPLUSPLUS
OLD_CXX="$CXXFLAGS"
CXXFLAGS="-DQT_QWS_EBX -fno-rtti -fno-exceptions -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG"
AC_TRY_COMPILE([
#include <qpe/qpeapplication.h>
],[
],[
video_qtopia=yes
])
CXXFLAGS="$OLD_CXX"
AC_MSG_RESULT($video_qtopia)
if test x$video_qtopia = xyes; then
CFLAGS="$CFLAGS -DENABLE_QTOPIA -DQT_QWS_EBX -DQT_QWS_CUSTOM -DQWS -I${QPEDIR}/include -I${QTDIR}/include/ -DNO_DEBUG -fno-rtti -fno-exceptions"
SYSTEM_LIBS="$SYSTEM_LIBS -:${QPEDIR}/lib -L${QTDIR}/lib/ -lqpe -lqte"
VIDEO_SUBDIRS="$VIDEO_SUBDIRS qtopia"
VIDEO_DRIVERS="$VIDEO_DRIVERS qtopia/libvideo_qtopia.la"
fi
AC_LANG_C
fi
}
dnl Set up the Mac toolbox video driver for Mac OS 7-9
CheckTOOLBOX()
{
......@@ -1420,7 +1450,7 @@ case "$target" in
ARCH=linux
CheckDummyVideo
CheckDiskAudio
CheckDLOPEN
CheckDLOPEN
CheckNASM
CheckOSS
CheckALSA
......@@ -1436,11 +1466,18 @@ case "$target" in
CheckGGI
CheckSVGA
CheckAAlib
CheckQtopia
CheckOpenGL
CheckInputEvents
CheckPTHREAD
# Set up files for the main() stub
COPY_ARCH_SRC(src/main, linux, SDL_main.c)
if test "x$video_qtopia" = "xyes"; then
COPY_ARCH_SRC(src/main, linux, SDL_Qtopia_main.cc)
SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
SDL_LIBS="-lSDLmain $SDL_LIBS"
else
COPY_ARCH_SRC(src/main, linux, SDL_main.c)
fi
# Set up files for the audio library
# We use the OSS and ALSA API's, not the Sun audio API
#if test x$enable_audio = xyes; then
......@@ -1479,7 +1516,11 @@ case "$target" in
else
COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c)
COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h)
COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
if test x$has_recursive_mutexes != xyes; then
COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c)
else
COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c)
fi
COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h)
fi
fi
......@@ -1492,7 +1533,7 @@ case "$target" in
ARCH=bsdi
CheckDummyVideo
CheckDiskAudio
CheckDLOPEN
CheckDLOPEN
CheckNASM
CheckOSS
CheckARTSC
......@@ -1544,7 +1585,7 @@ case "$target" in
ARCH=freebsd
CheckDummyVideo
CheckDiskAudio
CheckDLOPEN
CheckDLOPEN
CheckVGL
CheckNASM
CheckOSS
......@@ -1601,7 +1642,7 @@ case "$target" in
ARCH=netbsd
CheckDummyVideo
CheckDiskAudio
CheckDLOPEN
CheckDLOPEN
CheckNASM
CheckOSS
CheckARTSC
......@@ -1656,7 +1697,7 @@ case "$target" in
ARCH=openbsd
CheckDummyVideo
CheckDiskAudio
CheckDLOPEN
CheckDLOPEN
CheckNASM
CheckOSS
CheckARTSC
......@@ -1715,7 +1756,7 @@ case "$target" in
ARCH=sysv5
CheckDummyVideo
CheckDiskAudio
CheckDLOPEN
CheckDLOPEN
CheckNASM
CheckOSS
CheckARTSC
......@@ -1765,7 +1806,7 @@ case "$target" in
CFLAGS="$CFLAGS -D__ELF__" # Fix for nasm on Solaris x86
CheckDummyVideo
CheckDiskAudio
CheckDLOPEN
CheckDLOPEN
CheckNASM
CheckOSS
CheckARTSC
......@@ -1814,7 +1855,7 @@ case "$target" in
ARCH=irix
CheckDummyVideo
CheckDiskAudio
CheckDLOPEN
CheckDLOPEN
CheckDMEDIA
CheckESD
CheckNAS
......@@ -1877,7 +1918,7 @@ case "$target" in
ARCH=hpux
CheckDummyVideo
CheckDiskAudio
CheckDLOPEN
CheckDLOPEN
CheckOSS
CheckNAS
CheckX11
......@@ -1925,7 +1966,7 @@ case "$target" in
ARCH=aix
CheckDummyVideo
CheckDiskAudio
CheckDLOPEN
CheckDLOPEN
CheckOSS
CheckNAS
CheckX11
......@@ -1971,7 +2012,7 @@ case "$target" in
ARCH=osf
CheckDummyVideo
CheckDiskAudio
CheckDLOPEN
CheckDLOPEN
CheckNAS
CheckX11
CheckGGI
......@@ -2018,7 +2059,7 @@ case "$target" in
ARCH=qnx
CheckDummyVideo
CheckDiskAudio
CheckDLOPEN
CheckDLOPEN
CheckNAS
CheckPHOTON
CheckX11
......@@ -2330,6 +2371,7 @@ AC_SUBST(ARCH)
# Set the conditional variables for this target
AM_CONDITIONAL(TARGET_LINUX, test $ARCH = linux)
AM_CONDITIONAL(TARGET_QTOPIA, test "x$video_qtopia" = "xyes")
AM_CONDITIONAL(TARGET_SOLARIS, test $ARCH = solaris)
AM_CONDITIONAL(TARGET_IRIX, test $ARCH = irix)
AM_CONDITIONAL(TARGET_BSDI, test $ARCH = bsdi)
......@@ -2486,6 +2528,7 @@ src/video/dummy/Makefile
src/video/ataricommon/Makefile
src/video/xbios/Makefile
src/video/gem/Makefile
src/video/qtopia/Makefile
src/events/Makefile
src/joystick/Makefile
src/joystick/amigaos/Makefile
......
......@@ -31,7 +31,8 @@ static char rcsid =
/* Redefine main() on Win32 and MacOS so that it is called by winmain.c */
#if defined(WIN32) || (defined(__MWERKS__) && !defined(__BEOS__)) || \
defined(macintosh) || defined(__APPLE__) || defined(__SYMBIAN32__)
defined(macintosh) || defined(__APPLE__) || defined(__SYMBIAN32__) || \
defined(QWS)
#ifdef __cplusplus
#define C_LINKAGE "C"
......
......@@ -17,9 +17,12 @@ lib_LIBRARIES = libSDLmain.a
if TARGET_MACOSX
MAINLIB_ARCH_SRCS = SDLMain.m SDLMain.h
else
if TARGET_QTOPIA
MAINLIB_ARCH_SRCS = SDL_Qtopia_main.cc
else
MAINLIB_ARCH_SRCS = SDL_main.c
endif
endif
libSDLmain_a_SOURCES = $(MAINLIB_ARCH_SRCS)
# Build an internal library of any special app setup functions
......
/* Include the SDL main definition header */
#include "SDL_main.h"
#ifdef main
#undef main
#endif
#ifdef QWS
#include <qpe/qpeapplication.h>
#include <qapplication.h>
#endif
extern int SDL_main(int argc, char *argv[]);
int main(int argc, char *argv[])
{
#ifdef QWS
// This initializes the Qtopia application. It needs to be done here
// because it parses command line options.
QPEApplication *app = new QPEApplication(argc, argv);
QWidget dummy;
app->showMainWidget(&dummy);
#endif
return(SDL_main(argc, argv));
}
......@@ -398,6 +398,9 @@ extern VideoBootStrap XBIOS_bootstrap;
#ifdef ENABLE_GEM
extern VideoBootStrap GEM_bootstrap;
#endif
#ifdef ENABLE_QTOPIA
extern VideoBootStrap Qtopia_bootstrap;
#endif
/* This is the current video device */
extern SDL_VideoDevice *current_video;
......
......@@ -110,6 +110,9 @@ static VideoBootStrap *bootstrap[] = {
#endif
#ifdef ENABLE_GEM
&GEM_bootstrap,
#endif
#ifdef ENABLE_QTOPIA
&Qtopia_bootstrap,
#endif
NULL
};
......
Makefile.in
Makefile
.libs
*.o
*.lo
*.la
## Makefile.am for SDL using the Qtopia backend
noinst_LTLIBRARIES = libvideo_qtopia.la
libvideo_qtopia_la_SOURCES = $(QTOPIA_SRCS)
# The SDL BWindow video driver sources
QTOPIA_SRCS = \
SDL_QWin.h \
SDL_QWin.cc \
SDL_QPEApp.h \
SDL_QPEApp.cc \
SDL_lowvideo.h \
SDL_sysmouse.cc \
SDL_sysmouse_c.h \
SDL_sysvideo.cc \
SDL_syswm.cc \
SDL_syswm_c.h \
SDL_sysevents.cc \
SDL_sysevents_c.h
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#include <qpe/qpeapplication.h>
#include <qapplication.h>
#include <qevent.h>
#include "SDL_thread.h"
#include "SDL_timer.h"
#include "SDL_error.h"
/* Flag to tell whether or not the Be application is active or not */
int SDL_QPEAppActive = 0;
static QPEApplication *app;
int SDL_InitQPEApp() {
if(SDL_QPEAppActive <= 0) {
if(!qApp) {
int argc = 1;
char *argv[] = { { "SDLApp" } };
app = new QPEApplication(argc, argv);
QWidget dummy;
app->showMainWidget(&dummy);
} else {
app = (QPEApplication*)qApp;
}
SDL_QPEAppActive++;
}
return 0;
}
/* Quit the QPE Application, if there's nothing left to do */
void SDL_QuitQPEApp(void)
{
/* Decrement the application reference count */
SDL_QPEAppActive--;
/* If the reference count reached zero, clean up the app */
if ( SDL_QPEAppActive == 0 && app) {
delete app;
app = 0;
qApp = 0;
}
}
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
#endif
/* Handle the QPE application loop */
/* Initialize the QPE Application, if it's not already started */
extern int SDL_InitQPEApp(void);
/* Quit the QPE Application, if there's nothing left to do */
extern void SDL_QuitQPEApp(void);
/* Flag to tell whether the app is active or not */
extern int SDL_QPEAppActive;
This diff is collapsed.
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
#endif
#ifndef _SDL_QWin_h
#define _SDL_QWin_h
#include <stdio.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qwidget.h>
#include <qpainter.h>
#include <qdirectpainter_qws.h>
#include "SDL_events.h"
//#include "SDL_BView.h"
extern "C" {
#include "SDL_events_c.h"
};
class SDL_QWin : public QWidget
{
void QueueKey(QKeyEvent *e, int pressed);
public:
SDL_QWin(const QSize& size);
virtual ~SDL_QWin();
virtual bool shown(void) {
return isVisible();
}
/* If called, the next resize event will not be forwarded to SDL. */
virtual void inhibitResize(void) {
my_inhibit_resize = true;
}
void setImage(QImage *image);
void setOffset(int x, int y) {
my_offset = QPoint(x, y);
}
void GetXYOffset(int &x, int &y) {
x = my_offset.x();
y = my_offset.y();
}
bool beginDraw(void) {
return true;
}
void endDraw(void) {
}
QImage *image(void) {
return my_image;
}
void setWFlags(WFlags flags) {
QWidget::setWFlags(flags);
my_flags = flags;
}
const QPoint& mousePos() const { return my_mouse_pos; }
void setMousePos(const QPoint& newpos) { my_mouse_pos = newpos; }
void setFullscreen(bool);
void lockScreen() {
if(!my_painter) {
my_painter = new QDirectPainter(this);
}
my_locked++; // Increate lock refcount
}
void unlockScreen() {
if(my_locked > 0) {
my_locked--; // decrease lock refcount;
}
if(!my_locked && my_painter) {
my_painter->end();
delete my_painter;
my_painter = 0;
}
}
void repaintRect(const QRect& rect);
protected:
/* Handle resizing of the window */
virtual void resizeEvent(QResizeEvent *e);
void focusInEvent(QFocusEvent *);
void focusOutEvent(QFocusEvent *);
void closeEvent(QCloseEvent *e);
void mouseMoveEvent(QMouseEvent *e);
void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void paintEvent(QPaintEvent *ev);
void keyPressEvent(QKeyEvent *e) {
QueueKey(e, 1);
}
void keyReleaseEvent(QKeyEvent *e) {
QueueKey(e, 0);
}
private:
void enableFullscreen();
QDirectPainter *my_painter;
QImage *my_image;
bool my_inhibit_resize;
QPoint my_offset;
QPoint my_mouse_pos;
WFlags my_flags;
WFlags my_has_fullscreen;
unsigned int my_locked;
};
#endif /* _SDL_QWin_h */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
#endif
#ifndef _SDL_lowvideo_h
#define _SDL_lowvideo_h
#include "SDL_mouse.h"
#include "SDL_sysvideo.h"
/* Hidden "this" pointer for the video functions */
#define _THIS SDL_VideoDevice *_this
/* Private display data */
struct SDL_PrivateVideoData {
/* The main window */
SDL_QWin *SDL_Win;
/* The fullscreen mode list */
#define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */
int SDL_nummodes[NUM_MODELISTS];
SDL_Rect **SDL_modelist[NUM_MODELISTS];
/* A completely clear cursor */
WMcursor *BlankCursor;
/* Mouse state variables */
Uint32 last_buttons;
QPoint last_point;
/* Keyboard state variables */
int key_flip;
//struct key_info keyinfo[2];
};
/* Old variable names */
#define SDL_Win (_this->hidden->SDL_Win)
#define saved_mode (_this->hidden->saved_mode)
#define SDL_nummodes (_this->hidden->SDL_nummodes)
#define SDL_modelist (_this->hidden->SDL_modelist)
#define SDL_BlankCursor (_this->hidden->BlankCursor)
#define last_buttons (_this->hidden->last_buttons)
#define last_point (_this->hidden->last_point)
#define key_flip (_this->hidden->key_flip)
#define keyinfo (_this->hidden->keyinfo)
#endif /* _SDL_lowvideo_h */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
#endif
#include <qpe/qpeapplication.h>
#include <stdio.h>
#include <string.h>
#include "SDL_error.h"
#include "SDL_events.h"
#include "SDL_QWin.h"
#include "SDL_lowvideo.h"
#include "SDL_timer.h"
extern "C" {
#include "SDL_events_c.h"
#include "SDL_sysevents.h"
#include "SDL_sysevents_c.h"
// static SDLKey keymap[128];
/* This is special because we know it will be run in a loop in a separate
thread. Normally this function should loop as long as there are input
states changing, i.e. new events arriving.
*/
void QT_PumpEvents(_THIS)
{
if(!qApp) {
return;
}
// printf("processing events: %p\n", qApp);
//qApp->processOneEvent(); // wait for a event
qApp->processEvents(); // and process all outstanding ones
#if 0
BView *view;
BRect bounds;
BPoint point;
uint32 buttons;
const uint32 button_masks[3] = {
B_PRIMARY_MOUSE_BUTTON,
B_TERTIARY_MOUSE_BUTTON,
B_SECONDARY_MOUSE_BUTTON,
};
unsigned int i, j;
/* Check out the mouse buttons and position (slight race condition) */
if ( SDL_Win->Lock() ) {
/* Don't do anything if we have no view */
view = SDL_Win->View();
if ( ! view ) {
SDL_Win->Unlock();
return;
}
bounds = view->Bounds();
/* Get new input state, if still active */
if ( SDL_Win->IsActive() ) {
key_flip = !key_flip;
get_key_info(&keyinfo[key_flip]);
view->GetMouse(&point, &buttons, true);
} else {
key_flip = key_flip;
point = last_point;
buttons = last_buttons;
}
SDL_Win->Unlock();
} else {
return;
}
/* If our view is active, we'll find key changes here */
if ( memcmp(keyinfo[0].key_states, keyinfo[1].key_states, 16) != 0 ) {
for ( i=0; i<16; ++i ) {
Uint8 new_state, transition;
new_state = keyinfo[key_flip].key_states[i];
transition = keyinfo[!key_flip].key_states[i] ^
keyinfo[ key_flip].key_states[i];
for ( j=0; j<8; ++j ) {
if ( transition&0x80 )
QueueKey(i*8+j, new_state&0x80);
transition <<= 1;
new_state <<= 1;
}
}
}
/* We check keyboard, but not mouse if mouse isn't in window */
if ( ! bounds.Contains(point) ) {
/* Mouse moved outside our view? */
if ( SDL_GetAppState() & SDL_APPMOUSEFOCUS ) {
SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
be_app->SetCursor(B_HAND_CURSOR);
}
return;
}
/* Has the mouse moved back into our view? */
if ( ! (SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
/* Reset the B_HAND_CURSOR to our own */
SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
SDL_SetCursor(NULL);
}
/* Check for mouse motion */
if ( point != last_point ) {
int x, y;
SDL_Win->GetXYOffset(x, y);
x = (int)point.x - x;
y = (int)point.y - y;
SDL_PrivateMouseMotion(0, 0, x, y);
}
last_point = point;
/* Add any mouse button events */
for ( i=0; i<SDL_TABLESIZE(button_masks); ++i ) {
if ( (buttons ^ last_buttons) & button_masks[i] ) {
if ( buttons & button_masks[i] ) {
SDL_PrivateMouseButton(SDL_PRESSED, 1+i, 0, 0);
} else {
SDL_PrivateMouseButton(SDL_RELEASED, 1+i, 0, 0);
}
}
}
last_buttons = buttons;
#endif
}
void QT_InitOSKeymap(_THIS)
{
#if 0
unsigned int i;
/* Initialize all the key states as "up" */
key_flip = 0;
memset(keyinfo[key_flip].key_states, 0, 16);
/* Initialize the key translation table */
for ( i=0; i<SDL_TABLESIZE(keymap); ++i )
keymap[i] = SDLK_UNKNOWN;
// keymap[0x01] = SDLK_ESCAPE;
// keymap[B_F1_KEY] = SDLK_F1;
// keymap[B_F2_KEY] = SDLK_F2;
// keymap[B_F3_KEY] = SDLK_F3;
// keymap[B_F4_KEY] = SDLK_F4;
// keymap[B_F5_KEY] = SDLK_F5;
// keymap[B_F6_KEY] = SDLK_F6;
// keymap[B_F7_KEY] = SDLK_F7;
// keymap[B_F8_KEY] = SDLK_F8;
// keymap[B_F9_KEY] = SDLK_F9;
// keymap[B_F10_KEY] = SDLK_F10;
// keymap[B_F11_KEY] = SDLK_F11;
// keymap[B_F12_KEY] = SDLK_F12;
// keymap[B_PRINT_KEY] = SDLK_PRINT;
//keymap[B_SCROLL_KEY] = SDLK_SCROLLOCK;
// keymap[B_PAUSE_KEY] = SDLK_PAUSE;
keymap[0x11] = SDLK_BACKQUOTE;
keymap[0x12] = SDLK_1;
keymap[0x13] = SDLK_2;
keymap[0x14] = SDLK_3;
keymap[0x15] = SDLK_4;
keymap[0x16] = SDLK_5;
keymap[0x17] = SDLK_6;
keymap[0x18] = SDLK_7;
keymap[0x19] = SDLK_8;
keymap[0x1a] = SDLK_9;
keymap[0x1b] = SDLK_0;
keymap[0x1c] = SDLK_MINUS;
keymap[0x1d] = SDLK_EQUALS;
keymap[0x1e] = SDLK_BACKSPACE;
keymap[0x1f] = SDLK_INSERT;
keymap[0x20] = SDLK_HOME;
keymap[0x21] = SDLK_PAGEUP;
//keymap[0x22] = SDLK_NUMLOCK;
keymap[0x23] = SDLK_KP_DIVIDE;
keymap[0x24] = SDLK_KP_MULTIPLY;
keymap[0x25] = SDLK_KP_MINUS;
keymap[0x26] = SDLK_TAB;
keymap[0x27] = SDLK_q;
keymap[0x28] = SDLK_w;
keymap[0x29] = SDLK_e;
keymap[0x2a] = SDLK_r;
keymap[0x2b] = SDLK_t;
keymap[0x2c] = SDLK_y;
keymap[0x2d] = SDLK_u;
keymap[0x2e] = SDLK_i;
keymap[0x2f] = SDLK_o;
keymap[0x30] = SDLK_p;
keymap[0x31] = SDLK_LEFTBRACKET;
keymap[0x32] = SDLK_RIGHTBRACKET;
keymap[0x33] = SDLK_BACKSLASH;
keymap[0x34] = SDLK_DELETE;
keymap[0x35] = SDLK_END;
keymap[0x36] = SDLK_PAGEDOWN;
keymap[0x37] = SDLK_KP7;
keymap[0x38] = SDLK_KP8;
keymap[0x39] = SDLK_KP9;
keymap[0x3a] = SDLK_KP_PLUS;
//keymap[0x3b] = SDLK_CAPSLOCK;
keymap[0x3c] = SDLK_a;
keymap[0x3d] = SDLK_s;
keymap[0x3e] = SDLK_d;
keymap[0x3f] = SDLK_f;
keymap[0x40] = SDLK_g;
keymap[0x41] = SDLK_h;
keymap[0x42] = SDLK_j;
keymap[0x43] = SDLK_k;
keymap[0x44] = SDLK_l;
keymap[0x45] = SDLK_SEMICOLON;
keymap[0x46] = SDLK_QUOTE;
keymap[0x47] = SDLK_RETURN;
keymap[0x48] = SDLK_KP4;
keymap[0x49] = SDLK_KP5;
keymap[0x4a] = SDLK_KP6;
keymap[0x4b] = SDLK_LSHIFT;
keymap[0x4c] = SDLK_z;
keymap[0x4d] = SDLK_x;
keymap[0x4e] = SDLK_c;
keymap[0x4f] = SDLK_v;
keymap[0x50] = SDLK_b;
keymap[0x51] = SDLK_n;
keymap[0x52] = SDLK_m;
keymap[0x53] = SDLK_COMMA;
keymap[0x54] = SDLK_PERIOD;
keymap[0x55] = SDLK_SLASH;
keymap[0x56] = SDLK_RSHIFT;
keymap[0x57] = SDLK_UP;
keymap[0x58] = SDLK_KP1;
keymap[0x59] = SDLK_KP2;
keymap[0x5a] = SDLK_KP3;
keymap[0x5b] = SDLK_KP_ENTER;
//keymap[0x5c] = SDLK_LCTRL;
//keymap[0x5d] = SDLK_LALT;
keymap[0x5e] = SDLK_SPACE;
//keymap[0x5f] = SDLK_RALT;
//keymap[0x60] = SDLK_RCTRL;
keymap[0x61] = SDLK_LEFT;
keymap[0x62] = SDLK_DOWN;
keymap[0x63] = SDLK_RIGHT;
keymap[0x64] = SDLK_KP0;
keymap[0x65] = SDLK_KP_PERIOD;
//keymap[0x66] = SDLK_LMETA;
//keymap[0x67] = SDLK_RMETA;
//keymap[0x68] = SDLK_MENU;
keymap[0x69] = SDLK_EURO;
keymap[0x6a] = SDLK_KP_EQUALS;
keymap[0x6b] = SDLK_POWER;
#endif
}
}; /* Extern C */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
#endif
#include "SDL_lowvideo.h"
/* Variables and functions exported by SDL_sysevents.c to other parts
of the native video subsystem (SDL_sysvideo.c)
*/
extern void QT_InitOSKeymap(_THIS);
extern void QT_PumpEvents(_THIS);
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
#endif
#include <stdlib.h>
#include <string.h>
#include "SDL_error.h"
#include "SDL_QWin.h"
extern "C" {
#include "SDL_sysmouse_c.h"
/* The implementation dependent data for the window manager cursor */
struct WMcursor {
char *bits;
};
WMcursor *QT_CreateWMCursor(_THIS,
Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y)
{
static WMcursor dummy;
dummy.bits = 0;
return &dummy;
}
int QT_ShowWMCursor(_THIS, WMcursor *cursor)
{
return 1;
}
void QT_FreeWMCursor(_THIS, WMcursor *cursor)
{
}
void QT_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
{
SDL_Win->setMousePos(QPoint(x, y));
}
}; /* Extern C */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
#endif
#include "SDL_lowvideo.h"
/* Functions to be exported */
extern void QT_FreeWMCursor(_THIS, WMcursor *cursor);
extern WMcursor *QT_CreateWMCursor(_THIS,
Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
extern int QT_ShowWMCursor(_THIS, WMcursor *cursor);
extern void QT_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
This diff is collapsed.
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
#endif
#include "SDL_QWin.h"
extern "C" {
#include "SDL_syswm_c.h"
void QT_SetWMCaption(_THIS, const char *title, const char *icon)
{
SDL_Win->setCaption(title);
}
}; /* Extern C */
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id$";
#endif
#include "SDL_lowvideo.h"
/* Functions to be exported */
extern void QT_SetWMCaption(_THIS, const char *title, const char *icon);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment