From aec43f0bee0a44e4d0098a184d440c0f98e8f621 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Fri, 30 Jan 2015 20:44:52 +0100 Subject: [PATCH] lilypad: add x11 display pointer If we move all window management hack into the core it would be useless (for input) --- plugins/LilyPad/Global.h | 5 +++++ plugins/LilyPad/InputManager.h | 4 ++++ plugins/LilyPad/Linux/LilyPad.cpp | 22 +++++++++++++--------- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/plugins/LilyPad/Global.h b/plugins/LilyPad/Global.h index 799eb5f55a..8201d34daf 100644 --- a/plugins/LilyPad/Global.h +++ b/plugins/LilyPad/Global.h @@ -82,6 +82,11 @@ static inline unsigned int timeGetTime() { #include "Utilities/StringHelpers.h" #include "Utilities/Path.h" +#include + +extern Display *GSdsp; +extern Window GSwin; + #endif diff --git a/plugins/LilyPad/InputManager.h b/plugins/LilyPad/InputManager.h index e68ad2b205..87600703b8 100644 --- a/plugins/LilyPad/InputManager.h +++ b/plugins/LilyPad/InputManager.h @@ -203,6 +203,10 @@ struct InitInfo { //HWND hWndButton; WndProcEater* hWndProc; +#else + // Linux equivalent to HWND + Display *GSdsp; + Window GSwin; #endif }; diff --git a/plugins/LilyPad/Linux/LilyPad.cpp b/plugins/LilyPad/Linux/LilyPad.cpp index 994c47bed5..fb7a7fca73 100644 --- a/plugins/LilyPad/Linux/LilyPad.cpp +++ b/plugins/LilyPad/Linux/LilyPad.cpp @@ -38,6 +38,9 @@ // LilyPad version. #define VERSION ((0<<8) | 11 | (0<<24)) +Display *GSdsp; +Window GSwin; + // Keeps the various sources for Update polling (PADpoll, PADupdate, etc) from wreaking // havoc on each other... static std::mutex updateLock; @@ -430,9 +433,13 @@ void Update(unsigned int port, unsigned int slot) { InitInfo info = { 0, 0, hWndTop, &hWndGSProc }; - - dm->Update(&info); +#else + InitInfo info = { + 0, 0, GSdsp, GSwin + }; #endif + dm->Update(&info); + static int turbo = 0; turbo++; for (i=0; inumDevices; i++) { @@ -789,14 +796,11 @@ s32 CALLBACK PADopen(void *pDsp) { } } - // I'd really rather use this line, but GetActiveWindow() does not have complete specs. - // It *seems* to return null when no window from this thread has focus, but the - // Microsoft specs seem to imply it returns the window from this thread that would have focus, - // if any window did (topmost in this thread?). Which isn't what I want, and doesn't seem - // to be what it actually does. - // activeWindow = GetActiveWindow() == hWnd; + updateQueued = 0; + + GSdsp = *(Display**)pDsp; + GSwin = (Window)*(((uptr*)pDsp)+1); - // activeWindow = (GetAncestor(hWnd, GA_ROOT) == GetAncestor(GetForegroundWindow(), GA_ROOT)); activeWindow = 1; UpdateEnabledDevices(); return 0;