cocoa event wip, i'm tired i'll continue tomorrow
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1860 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
4fd0f3035a
commit
2d586139bc
|
@ -56,7 +56,7 @@ void cocoaKeyCode(NSEvent *event)
|
||||||
[connec setRootObject: event];
|
[connec setRootObject: event];
|
||||||
if ([connec registerName: @"DolphinCocoaEvent"] == NO)
|
if ([connec registerName: @"DolphinCocoaEvent"] == NO)
|
||||||
{
|
{
|
||||||
printf("error creating nsconnection\n");
|
//printf("error creating nsconnection\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
|
@ -84,7 +84,7 @@ inline void AddControl(wxPanel *pan, wxButton **button, wxStaticBoxSizer *sizer,
|
||||||
wxALIGN_CENTER_VERTICAL|wxALL);
|
wxALIGN_CENTER_VERTICAL|wxALL);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DInput::DIKToString(pad[controller].keyForControl[ctl], keyStr);
|
DInput::DIKToString(pad[controller].keyForControl[ctl], keyStr);
|
||||||
#else
|
#elif defined(HAVE_X11) && HAVE_X11
|
||||||
XKeyToString(pad[controller].keyForControl[ctl], keyStr);
|
XKeyToString(pad[controller].keyForControl[ctl], keyStr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ void ConfigDialog::OnKeyDown(wxKeyEvent& event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#elif defined(HAVE_X11) && HAVE_X11
|
||||||
pad[page].keyForControl[clickedButton->GetId()] = wxCharCodeWXToX(event.GetKeyCode());
|
pad[page].keyForControl[clickedButton->GetId()] = wxCharCodeWXToX(event.GetKeyCode());
|
||||||
clickedButton->SetLabel(wxString::Format(_T("%c"), event.GetKeyCode()));
|
clickedButton->SetLabel(wxString::Format(_T("%c"), event.GetKeyCode()));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <wx/panel.h>
|
#include <wx/panel.h>
|
||||||
#include <wx/gbsizer.h>
|
#include <wx/gbsizer.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
#include "../XInputBase.h"
|
#include "../XInputBase.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include "PadSimple.h"
|
#include "PadSimple.h"
|
||||||
#include "IniFile.h"
|
#include "IniFile.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
#include "GUI/ConfigDlg.h"
|
#include "GUI/ConfigDlg.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,6 +46,8 @@ DInput dinput;
|
||||||
|
|
||||||
Display* GXdsp;
|
Display* GXdsp;
|
||||||
bool KeyStatus[NUMCONTROLS];
|
bool KeyStatus[NUMCONTROLS];
|
||||||
|
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||||
|
#include <Cocoa/Cocoa.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SPads pad[4];
|
SPads pad[4];
|
||||||
|
@ -174,6 +178,9 @@ void DllConfig(HWND _hParent)
|
||||||
#elif defined(HAVE_WX) && HAVE_WX
|
#elif defined(HAVE_WX) && HAVE_WX
|
||||||
ConfigDialog frame(NULL);
|
ConfigDialog frame(NULL);
|
||||||
frame.ShowModal();
|
frame.ShowModal();
|
||||||
|
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||||
|
ConfigDialog frame(NULL);
|
||||||
|
frame.ShowModal();
|
||||||
#endif
|
#endif
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
@ -192,6 +199,7 @@ void PAD_Initialize(SPADInitialize _PADInitialize)
|
||||||
dinput.Init((HWND)g_PADInitialize.hWnd);
|
dinput.Init((HWND)g_PADInitialize.hWnd);
|
||||||
#elif defined(HAVE_X11) && HAVE_X11
|
#elif defined(HAVE_X11) && HAVE_X11
|
||||||
GXdsp = (Display*)g_PADInitialize.hWnd;
|
GXdsp = (Display*)g_PADInitialize.hWnd;
|
||||||
|
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
|
@ -476,7 +484,38 @@ void X11_Read(int _numPAD, SPADStatus* _pPADStatus)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_COCOA) && HAVE_COCOA
|
||||||
|
void cocoa_Read(int _numPAD, SPADStatus* _pPADStatus)
|
||||||
|
{
|
||||||
|
// Do all the stuff we need to do once per frame here
|
||||||
|
if (_numPAD != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//get event from main thread
|
||||||
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
NSConnection *conn;
|
||||||
|
NSDistantObject *proxy;
|
||||||
|
|
||||||
|
conn = [NSConnection connectionWithRegisteredName:@"DolphinCocoaEvent" host:nil];
|
||||||
|
if (!conn) {
|
||||||
|
//printf("error creating cnx event client\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
proxy = [conn rootProxy];
|
||||||
|
|
||||||
|
if (!proxy) {
|
||||||
|
//printf("error prox client\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([proxy keyCode] != 0)
|
||||||
|
printf("evt recevied : %d\n",[proxy keyCode]);
|
||||||
|
|
||||||
|
[pool release];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
// Set buttons status from wxWidgets in the main application
|
// Set buttons status from wxWidgets in the main application
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||||
void PAD_Input(u8 _Key, u8 _UpDown) {}
|
void PAD_Input(u8 _Key, u8 _UpDown) {}
|
||||||
|
@ -519,6 +558,9 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
||||||
#elif defined(HAVE_X11) && HAVE_X11
|
#elif defined(HAVE_X11) && HAVE_X11
|
||||||
_pPADStatus->err = PAD_ERR_NONE;
|
_pPADStatus->err = PAD_ERR_NONE;
|
||||||
X11_Read(_numPAD, _pPADStatus);
|
X11_Read(_numPAD, _pPADStatus);
|
||||||
|
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||||
|
_pPADStatus->err = PAD_ERR_NONE;
|
||||||
|
cocoa_Read(_numPAD, _pPADStatus);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RECORD_STORE
|
#ifdef RECORD_STORE
|
||||||
|
@ -606,7 +648,7 @@ void LoadConfig()
|
||||||
DIK_H,
|
DIK_H,
|
||||||
DIK_LSHIFT
|
DIK_LSHIFT
|
||||||
};
|
};
|
||||||
#else
|
#elif defined(HAVE_X11) && HAVE_X11
|
||||||
const int defaultKeyForControl[NUMCONTROLS] =
|
const int defaultKeyForControl[NUMCONTROLS] =
|
||||||
{
|
{
|
||||||
XK_x, //A
|
XK_x, //A
|
||||||
|
@ -632,6 +674,32 @@ void LoadConfig()
|
||||||
XK_Shift_L, //halfpress
|
XK_Shift_L, //halfpress
|
||||||
XK_p
|
XK_p
|
||||||
};
|
};
|
||||||
|
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||||
|
const int defaultKeyForControl[NUMCONTROLS] =
|
||||||
|
{
|
||||||
|
7, //A
|
||||||
|
6,
|
||||||
|
1,
|
||||||
|
8,
|
||||||
|
2,
|
||||||
|
36,
|
||||||
|
12,
|
||||||
|
13,
|
||||||
|
126, //mainstick
|
||||||
|
125,
|
||||||
|
123,
|
||||||
|
124,
|
||||||
|
34, //substick
|
||||||
|
40,
|
||||||
|
38,
|
||||||
|
37,
|
||||||
|
17, //dpad
|
||||||
|
5,
|
||||||
|
3,
|
||||||
|
4,
|
||||||
|
56, //halfpress
|
||||||
|
35
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
IniFile file;
|
IniFile file;
|
||||||
file.Load(FULL_CONFIG_DIR "pad.ini");
|
file.Load(FULL_CONFIG_DIR "pad.ini");
|
||||||
|
|
|
@ -30,9 +30,17 @@ if padenv['HAVE_COCOA']:
|
||||||
if padenv['HAVE_WX']:
|
if padenv['HAVE_WX']:
|
||||||
files += [
|
files += [
|
||||||
"GUI/ConfigDlg.cpp",
|
"GUI/ConfigDlg.cpp",
|
||||||
|
]
|
||||||
|
|
||||||
|
if env['HAVE_X11']:
|
||||||
|
files += [
|
||||||
"XInputBase.cpp",
|
"XInputBase.cpp",
|
||||||
]
|
]
|
||||||
|
|
||||||
padenv.Append(LIBS = [ 'common' ])
|
if padenv['HAVE_COCOA']:
|
||||||
|
padenv.Append( CXXFLAGS = compileFlags,
|
||||||
|
LIBS = [ 'common' ])
|
||||||
|
else:
|
||||||
|
padenv.Append(LIBS = [ 'common' ])
|
||||||
|
|
||||||
padenv.SharedLibrary(env['plugin_dir']+name, files)
|
padenv.SharedLibrary(env['plugin_dir']+name, files)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
#include "XInputBase.h"
|
#include "XInputBase.h"
|
||||||
|
|
||||||
// Taken from wxw source code
|
// Taken from wxw source code
|
||||||
|
|
Loading…
Reference in New Issue