lilypad: add x11 display pointer

If we move all window management hack into the core it would be useless (for input)
This commit is contained in:
Gregory Hainaut 2015-01-30 20:44:52 +01:00
parent 087f252909
commit aec43f0bee
3 changed files with 22 additions and 9 deletions

View File

@ -82,6 +82,11 @@ static inline unsigned int timeGetTime() {
#include "Utilities/StringHelpers.h"
#include "Utilities/Path.h"
#include <X11/Xutil.h>
extern Display *GSdsp;
extern Window GSwin;
#endif

View File

@ -203,6 +203,10 @@ struct InitInfo {
//HWND hWndButton;
WndProcEater* hWndProc;
#else
// Linux equivalent to HWND
Display *GSdsp;
Window GSwin;
#endif
};

View File

@ -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; i<dm->numDevices; 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;