Add attention request to joystick test

This commit is contained in:
Camilla Löwy 2017-05-11 18:29:08 +02:00
parent baa9cd8968
commit 2f5e230338

View File

@ -52,6 +52,7 @@
#define strdup(x) _strdup(x) #define strdup(x) _strdup(x)
#endif #endif
static GLFWwindow* window;
static int joysticks[GLFW_JOYSTICK_LAST + 1]; static int joysticks[GLFW_JOYSTICK_LAST + 1];
static int joystick_count = 0; static int joystick_count = 0;
@ -79,6 +80,9 @@ static void joystick_callback(int jid, int event)
joystick_count--; joystick_count--;
} }
if (!glfwGetWindowAttrib(window, GLFW_FOCUSED))
glfwRequestWindowAttention(window);
} }
static const char* joystick_label(int jid) static const char* joystick_label(int jid)
@ -91,7 +95,6 @@ static const char* joystick_label(int jid)
int main(void) int main(void)
{ {
int jid, hat_buttons = GLFW_FALSE; int jid, hat_buttons = GLFW_FALSE;
GLFWwindow* window;
struct nk_context* nk; struct nk_context* nk;
struct nk_font_atlas* atlas; struct nk_font_atlas* atlas;