Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux: Revert mouse behaviour for testing #317

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 7 additions & 33 deletions Engine/platform/linux/acpllnx.cpp
Expand Up @@ -23,7 +23,6 @@
#include <xalleg.h>
#include "gfx/ali3d.h"
#include "ac/runtime_defines.h"
#include "debug/out.h"
#include "platform/base/agsplatformdriver.h"
#include "plugin/agsplugin.h"
#include "util/string.h"
Expand All @@ -32,7 +31,7 @@
#include <pwd.h>
#include <sys/stat.h>

using namespace AGS::Common;
using AGS::Common::String;


// Replace the default Allegro icon. The original defintion is in the
Expand All @@ -50,11 +49,11 @@ struct AGSLinux : AGSPlatformDriver {
virtual const char *GetAppOutputDirectory();
virtual unsigned long GetDiskFreeSpaceMB();
virtual const char* GetNoMouseErrorString();
virtual bool IsMouseControlSupported(bool windowed);
virtual const char* GetAllegroFailUserHint();
virtual eScriptSystemOSID GetSystemOSID();
virtual int InitializeCDPlayer();
virtual void PlayVideo(const char* name, int skip, int flags);
virtual void PostAllegroInit(bool windowed);
virtual void PostAllegroExit();
virtual void SetGameWindowIcon();
virtual void ShutdownCDPlayer();
Expand Down Expand Up @@ -141,6 +140,11 @@ const char* AGSLinux::GetNoMouseErrorString() {
return "This game requires a mouse. You need to configure and setup your mouse to play this game.\n";
}

bool AGSLinux::IsMouseControlSupported(bool windowed)
{
return true; // supported for both fullscreen and windowed modes
}

const char* AGSLinux::GetAllegroFailUserHint()
{
return "Make sure you have latest version of Allegro 4 libraries installed, and X server is running.";
Expand All @@ -158,36 +162,6 @@ void AGSLinux::PlayVideo(const char *name, int skip, int flags) {
// do nothing
}

//
// Quoting Benoit Pierre:
// When using a high polling rate mouse on Linux with X11, the mouse cursor
// lags. This is due to the fact that Allegro will only process up-to 5
// X11 events at a time, and so mouse motion events will pile up and the
// mouse cursor will lag. It's possible to fix it without patching Allegro
// by setting a custom Allegro X11 input handler that will make sure all
// currently queued X11 events are processed.
//
// NOTE: this refers specifically to Allegro 4.
// TODO: if AGS ever uses patched Allegro version, this custom handler may
// be removed.
//
static void XWinInputHandler(void)
{
if (!_xwin.display)
return;

// Repeat the call to Allegro's internal input handler until all the event
// queue was processed
while (XQLength(_xwin.display) > 0)
_xwin_private_handle_input();
}

void AGSLinux::PostAllegroInit(bool windowed)
{
_xwin_input_handler = XWinInputHandler;
Out::FPrint("Set up the custom XWin input handler");
}

void AGSLinux::PostAllegroExit() {
// do nothing
}
Expand Down