[SCM] Simple and fast multimedia library for C++ branch, debian/repacking, updated. upstream/1.4-115-g2695cc8
Christoph Egger
Christoph.Egger at gmx.de
Sun Jun 14 22:42:15 UTC 2009
The following commit has been merged in the debian/repacking branch:
commit e1960e89b8105cd81aa40f39eac4fc4287e1e71f
Merge: 2cde0705559390bc06c36b23c3c0b6115c0d4adf ecffd8cf98410c68c2a1c5257a7d82cb32e48e95
Author: Christoph Egger <Christoph.Egger at gmx.de>
Date: Sun Jun 14 23:32:42 2009 +0200
Merge commit 'refs/top-bases/debian/repacking' into debian/repacking
diff --combined src/SFML/Graphics/GraphicsContext.hpp
index fdfdb4b,2fa77a3..aebfe1f
--- a/src/SFML/Graphics/GraphicsContext.hpp
+++ b/src/SFML/Graphics/GraphicsContext.hpp
@@@ -1,7 -1,7 +1,7 @@@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
- // Copyright (C) 2007-2008 Laurent Gomila (laurent.gom at gmail.com)
+ // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom at gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@@ -30,7 -30,7 +30,7 @@@
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>
#include <SFML/System/NonCopyable.hpp>
-#include <SFML/Graphics/GLEW/glew.h>
+#include <GL/glew.h>
#include <iostream>
#include <string>
diff --combined src/SFML/Graphics/ImageLoader.cpp
index 91d4362,a3f83bf..e6ceacd
--- a/src/SFML/Graphics/ImageLoader.cpp
+++ b/src/SFML/Graphics/ImageLoader.cpp
@@@ -1,7 -1,7 +1,7 @@@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
- // Copyright (C) 2007-2008 Laurent Gomila (laurent.gom at gmail.com)
+ // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom at gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@@ -28,11 -28,11 +28,11 @@@
#include <SFML/Graphics/ImageLoader.hpp>
extern "C"
{
- #include <SFML/Graphics/libjpeg/jpeglib.h>
- #include <SFML/Graphics/libjpeg/jerror.h>
+ #include <jpeglib.h>
+ #include <jerror.h>
}
-#include <SFML/Graphics/libpng/png.h>
-#include <SFML/Graphics/SOIL/SOIL.h>
+#include <libpng/png.h>
+#include <SOIL/SOIL.h>
#include <iostream>
diff --combined src/SFML/Window/Linux/WindowImplX11.cpp
index 0650e06,fa0bd8e..0346b35
--- a/src/SFML/Window/Linux/WindowImplX11.cpp
+++ b/src/SFML/Window/Linux/WindowImplX11.cpp
@@@ -1,7 -1,7 +1,7 @@@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
- // Copyright (C) 2007 Laurent Gomila (laurent.gom at gmail.com)
+ // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom at gmail.com)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@@ -27,8 -27,8 +27,8 @@@
////////////////////////////////////////////////////////////
#include <SFML/Window/WindowStyle.hpp> // important to be included first (conflict with None)
#include <SFML/Window/Linux/WindowImplX11.hpp>
-#include <SFML/Window/glext/glxext.h>
-#include <SFML/Window/glext/glext.h>
+#include <GL/glxext.h>
+#include <GL/glext.h>
#include <SFML/System/Unicode.hpp>
#include <X11/keysym.h>
#include <X11/extensions/Xrandr.h>
@@@ -37,6 -37,19 +37,19 @@@
#include <vector>
+ namespace
+ {
+ ////////////////////////////////////////////////////////////
+ /// Filter the events received by windows
+ /// (only allow those matching a specific window)
+ ////////////////////////////////////////////////////////////
+ Bool CheckEvent(::Display*, XEvent* Event, XPointer UserData)
+ {
+ // Just check if the event matches the window
+ return Event->xany.window == reinterpret_cast< ::Window >(UserData);
+ }
+ }
+
namespace sf
{
namespace priv
@@@ -340,7 -353,16 +353,16 @@@ WindowImplX11::~WindowImplX11(
////////////////////////////////////////////////////////////
/// Check if there's an active context on the current thread
+ ////////////////////
+ ////////////////////////////////////////////////////////////
+ /// Filter the received events
+ /// (only allow those matching a specific window)
////////////////////////////////////////////////////////////
+ Bool CheckEvent(::Display*, XEvent* Event, XPointer UserData)
+ {
+ // Just check if the event matches our window
+ return Event->xany.window == reinterpret_cast< ::Window >(UserData);
+ }////////////////////////////////////////
bool WindowImplX11::IsContextActive()
{
return glXGetCurrentContext() != NULL;
@@@ -362,30 -384,53 +384,53 @@@ void WindowImplX11::Display(
////////////////////////////////////////////////////////////
void WindowImplX11::ProcessEvents()
{
+ // This function implements a workaround to properly discard
+ // repeated key events when necessary. The problem is that the
+ // system's key events policy doesn't match SFML's one: X server will generate
+ // both repeated KeyPress and KeyRelease events when maintaining a key down, while
+ // SFML only wants repeated KeyPress events. Thus, we have to:
+ // - Discard duplicated KeyRelease events when EnableKeyRepeat is true
+ // - Discard both duplicated KeyPress and KeyRelease events when EnableKeyRepeat is false
+
+
// Process any event in the queue matching our window
XEvent Event;
- while (XCheckIfEvent(ourDisplay, &Event, &WindowImplX11::CheckEvent, reinterpret_cast<XPointer>(myWindow)))
+ while (XCheckIfEvent(ourDisplay, &Event, &CheckEvent, reinterpret_cast<XPointer>(myWindow)))
{
- // Filter repeated key events
- if (Event.type == KeyRelease)
+ // Detect repeated key events
+ if ((Event.type == KeyPress) || (Event.type == KeyRelease))
{
- if (XPending(ourDisplay))
+ if (Event.xkey.keycode < 256)
{
- XEvent NextEvent;
- XPeekEvent(ourDisplay, &NextEvent);
- if ((NextEvent.type == KeyPress) &&
- (NextEvent.xkey.keycode == Event.xkey.keycode) &&
- (NextEvent.xkey.time == Event.xkey.time))
+ // To detect if it is a repeated key event, we check the current state of the key.
+ // - If the state is "down", KeyReleased events must obviously be discarded.
+ // - KeyPress events are a little bit harder to handle: they depend on the EnableKeyRepeat state,
+ // and we need to properly forward the first one.
+ char Keys[32];
+ XQueryKeymap(ourDisplay, Keys);
+ if (Keys[Event.xkey.keycode >> 3] & (1 << (Event.xkey.keycode % 8)))
{
- if (!myKeyRepeat)
- XNextEvent(ourDisplay, &NextEvent);
- continue;
+ // KeyRelease event + key down = repeated event --> discard
+ if (Event.type == KeyRelease)
+ {
+ myLastKeyReleaseEvent = Event;
+ continue;
+ }
+
+ // KeyPress event + key repeat disabled + matching KeyRelease event = repeated event --> discard
+ if ((Event.type == KeyPress) && !myKeyRepeat &&
+ (myLastKeyReleaseEvent.xkey.keycode == Event.xkey.keycode) &&
+ (myLastKeyReleaseEvent.xkey.time == Event.xkey.time))
+ {
+ continue;
+ }
}
}
}
+ // Process the event
ProcessEvent(Event);
- }
+ }
}
@@@ -649,7 -694,6 +694,6 @@@ bool WindowImplX11::CreateContext(cons
{
BestScore = Score;
BestVisual = &Visuals[i];
- break;
}
}
@@@ -710,6 -754,9 +754,9 @@@
////////////////////////////////////////////////////////////
void WindowImplX11::Initialize()
{
+ // Make sure the "last key release" is initialized with invalid values
+ myLastKeyReleaseEvent.type = -1;
+
// Get the atom defining the close event
myAtomClose = XInternAtom(ourDisplay, "WM_DELETE_WINDOW", false);
XSetWMProtocols(ourDisplay, myWindow, &myAtomClose, 1);
@@@ -804,17 -851,6 +851,6 @@@ void WindowImplX11::CleanUp(
////////////////////////////////////////////////////////////
- /// Filter the received events
- /// (only allow those matching a specific window)
- ////////////////////////////////////////////////////////////
- Bool WindowImplX11::CheckEvent(::Display*, XEvent* Event, XPointer UserData)
- {
- // Just check if the event matches our window
- return Event->xany.window == reinterpret_cast< ::Window >(UserData);
- }
-
-
- ////////////////////////////////////////////////////////////
/// Process an incoming event from the window
////////////////////////////////////////////////////////////
void WindowImplX11::ProcessEvent(XEvent WinEvent)
--
Simple and fast multimedia library for C++
More information about the Pkg-games-commits
mailing list