Skip to content

Commit 2f59e56

Browse files
ceyusaaperezdc
authored andcommitted
gamepad: Pass provider to wpe_gamepad_create().
Some gamepad implemenators might need the provider structure.
1 parent d77bc02 commit 2f59e56

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

include/wpe/gamepad.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ struct wpe_gamepad_provider_interface {
183183
* Since: 1.14
184184
*/
185185
struct wpe_gamepad_interface {
186-
void* (*create)(struct wpe_gamepad*, unsigned);
186+
void* (*create)(struct wpe_gamepad*, struct wpe_gamepad_provider*, unsigned);
187187
void (*destroy)(void*);
188188
const char* (*get_id)(void*);
189189

@@ -296,6 +296,7 @@ void wpe_gamepad_provider_dispatch_gamepad_disconnected(struct wpe_gamepad_provi
296296

297297
/**
298298
* wpe_gamepad_create:
299+
* @provider: provider of the gamepad to create.
299300
* @gamepad_id: opaque application's representation of gamepad provider.
300301
*
301302
* Method called by WPEWebKit to create an internal representation of a gamepad device.
@@ -305,7 +306,7 @@ void wpe_gamepad_provider_dispatch_gamepad_disconnected(struct wpe_gamepad_provi
305306
* Since: 1.14
306307
*/
307308
WPE_EXPORT
308-
struct wpe_gamepad* wpe_gamepad_create(unsigned);
309+
struct wpe_gamepad* wpe_gamepad_create(struct wpe_gamepad_provider*, unsigned);
309310

310311
/**
311312
* wpe_gamepad_destroy:

src/gamepad.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ wpe_gamepad_provider_dispatch_gamepad_disconnected(struct wpe_gamepad_provider*
111111
}
112112

113113
struct wpe_gamepad*
114-
wpe_gamepad_create(unsigned gamepad_id)
114+
wpe_gamepad_create(struct wpe_gamepad_provider* provider, unsigned gamepad_id)
115115
{
116116
if (!gamepad_interface)
117117
return NULL;
118118

119119
struct wpe_gamepad* gamepad = wpe_calloc(1, sizeof(struct wpe_gamepad));
120120
if (gamepad_interface->create)
121-
gamepad->backend = gamepad_interface->create(gamepad, gamepad_id);
121+
gamepad->backend = gamepad_interface->create(gamepad, provider, gamepad_id);
122122
return gamepad;
123123
}
124124

0 commit comments

Comments
 (0)