input.c
Go to the documentation of this file.
1 //========================================================================
2 // GLFW 3.1 - www.glfw.org
3 //------------------------------------------------------------------------
4 // Copyright (c) 2002-2006 Marcus Geelnard
5 // Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
6 //
7 // This software is provided 'as-is', without any express or implied
8 // warranty. In no event will the authors be held liable for any damages
9 // arising from the use of this software.
10 //
11 // Permission is granted to anyone to use this software for any purpose,
12 // including commercial applications, and to alter it and redistribute it
13 // freely, subject to the following restrictions:
14 //
15 // 1. The origin of this software must not be misrepresented; you must not
16 // claim that you wrote the original software. If you use this software
17 // in a product, an acknowledgment in the product documentation would
18 // be appreciated but is not required.
19 //
20 // 2. Altered source versions must be plainly marked as such, and must not
21 // be misrepresented as being the original software.
22 //
23 // 3. This notice may not be removed or altered from any source
24 // distribution.
25 //
26 //========================================================================
27 
28 #include "internal.h"
29 
30 #include <stdlib.h>
31 #if defined(_MSC_VER)
32  #include <malloc.h>
33 #endif
34 
35 // Internal key state used for sticky keys
36 #define _GLFW_STICK 3
37 
38 
39 // Sets the cursor mode for the specified window
40 //
41 static void setCursorMode(_GLFWwindow* window, int newMode)
42 {
43  const int oldMode = window->cursorMode;
44 
45  if (newMode != GLFW_CURSOR_NORMAL &&
46  newMode != GLFW_CURSOR_HIDDEN &&
47  newMode != GLFW_CURSOR_DISABLED)
48  {
49  _glfwInputError(GLFW_INVALID_ENUM, "Invalid cursor mode");
50  return;
51  }
52 
53  if (oldMode == newMode)
54  return;
55 
56  window->cursorMode = newMode;
57 
58  if (_glfw.cursorWindow == window)
59  {
60  if (oldMode == GLFW_CURSOR_DISABLED)
61  {
65  }
66  else if (newMode == GLFW_CURSOR_DISABLED)
67  {
68  int width, height;
69 
72  &_glfw.cursorPosY);
73 
74  window->cursorPosX = _glfw.cursorPosX;
75  window->cursorPosY = _glfw.cursorPosY;
76 
77  _glfwPlatformGetWindowSize(window, &width, &height);
78  _glfwPlatformSetCursorPos(window, width / 2, height / 2);
79  }
80 
82  }
83 }
84 
85 // Set sticky keys mode for the specified window
86 //
87 static void setStickyKeys(_GLFWwindow* window, int enabled)
88 {
89  if (window->stickyKeys == enabled)
90  return;
91 
92  if (!enabled)
93  {
94  int i;
95 
96  // Release all sticky keys
97  for (i = 0; i <= GLFW_KEY_LAST; i++)
98  {
99  if (window->keys[i] == _GLFW_STICK)
100  window->keys[i] = GLFW_RELEASE;
101  }
102  }
103 
104  window->stickyKeys = enabled;
105 }
106 
107 // Set sticky mouse buttons mode for the specified window
108 //
109 static void setStickyMouseButtons(_GLFWwindow* window, int enabled)
110 {
111  if (window->stickyMouseButtons == enabled)
112  return;
113 
114  if (!enabled)
115  {
116  int i;
117 
118  // Release all sticky mouse buttons
119  for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++)
120  {
121  if (window->mouseButtons[i] == _GLFW_STICK)
122  window->mouseButtons[i] = GLFW_RELEASE;
123  }
124  }
125 
126  window->stickyMouseButtons = enabled;
127 }
128 
129 
133 
134 void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int mods)
135 {
136  if (key >= 0 && key <= GLFW_KEY_LAST)
137  {
138  GLboolean repeated = GL_FALSE;
139 
140  if (action == GLFW_RELEASE && window->keys[key] == GLFW_RELEASE)
141  return;
142 
143  if (action == GLFW_PRESS && window->keys[key] == GLFW_PRESS)
144  repeated = GL_TRUE;
145 
146  if (action == GLFW_RELEASE && window->stickyKeys)
147  window->keys[key] = _GLFW_STICK;
148  else
149  window->keys[key] = (char) action;
150 
151  if (repeated)
152  action = GLFW_REPEAT;
153  }
154 
155  if (window->callbacks.key)
156  window->callbacks.key((GLFWwindow*) window, key, scancode, action, mods);
157 }
158 
159 void _glfwInputChar(_GLFWwindow* window, unsigned int codepoint, int mods, int plain)
160 {
161  if (codepoint < 32 || (codepoint > 126 && codepoint < 160))
162  return;
163 
164  if (window->callbacks.charmods)
165  window->callbacks.charmods((GLFWwindow*) window, codepoint, mods);
166 
167  if (plain)
168  {
169  if (window->callbacks.character)
170  window->callbacks.character((GLFWwindow*) window, codepoint);
171  }
172 }
173 
174 void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset)
175 {
176  if (window->callbacks.scroll)
177  window->callbacks.scroll((GLFWwindow*) window, xoffset, yoffset);
178 }
179 
180 void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods)
181 {
182  if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST)
183  return;
184 
185  // Register mouse button action
186  if (action == GLFW_RELEASE && window->stickyMouseButtons)
187  window->mouseButtons[button] = _GLFW_STICK;
188  else
189  window->mouseButtons[button] = (char) action;
190 
191  if (window->callbacks.mouseButton)
192  window->callbacks.mouseButton((GLFWwindow*) window, button, action, mods);
193 }
194 
195 void _glfwInputCursorMotion(_GLFWwindow* window, double x, double y)
196 {
197  if (window->cursorMode == GLFW_CURSOR_DISABLED)
198  {
199  if (x == 0.0 && y == 0.0)
200  return;
201 
202  window->cursorPosX += x;
203  window->cursorPosY += y;
204 
205  x = window->cursorPosX;
206  y = window->cursorPosY;
207  }
208 
209  if (window->callbacks.cursorPos)
210  window->callbacks.cursorPos((GLFWwindow*) window, x, y);
211 }
212 
213 void _glfwInputCursorEnter(_GLFWwindow* window, int entered)
214 {
215  if (window->callbacks.cursorEnter)
216  window->callbacks.cursorEnter((GLFWwindow*) window, entered);
217 }
218 
219 void _glfwInputDrop(_GLFWwindow* window, int count, const char** paths)
220 {
221  if (window->callbacks.drop)
222  window->callbacks.drop((GLFWwindow*) window, count, paths);
223 }
224 
225 
229 
231 {
232  _GLFWwindow* window = (_GLFWwindow*) handle;
233 
235 
236  switch (mode)
237  {
238  case GLFW_CURSOR:
239  return window->cursorMode;
240  case GLFW_STICKY_KEYS:
241  return window->stickyKeys;
243  return window->stickyMouseButtons;
244  default:
245  _glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode");
246  return 0;
247  }
248 }
249 
251 {
252  _GLFWwindow* window = (_GLFWwindow*) handle;
253 
255 
256  switch (mode)
257  {
258  case GLFW_CURSOR:
259  setCursorMode(window, value);
260  break;
261  case GLFW_STICKY_KEYS:
262  setStickyKeys(window, value ? GL_TRUE : GL_FALSE);
263  break;
265  setStickyMouseButtons(window, value ? GL_TRUE : GL_FALSE);
266  break;
267  default:
268  _glfwInputError(GLFW_INVALID_ENUM, "Invalid input mode");
269  break;
270  }
271 }
272 
273 GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
274 {
275  _GLFWwindow* window = (_GLFWwindow*) handle;
276 
278 
279  if (key < 0 || key > GLFW_KEY_LAST)
280  {
281  _glfwInputError(GLFW_INVALID_ENUM, "Invalid key");
282  return GLFW_RELEASE;
283  }
284 
285  if (window->keys[key] == _GLFW_STICK)
286  {
287  // Sticky mode: release key now
288  window->keys[key] = GLFW_RELEASE;
289  return GLFW_PRESS;
290  }
291 
292  return (int) window->keys[key];
293 }
294 
295 GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button)
296 {
297  _GLFWwindow* window = (_GLFWwindow*) handle;
298 
300 
301  if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST)
302  {
304  "Invalid mouse button");
305  return GLFW_RELEASE;
306  }
307 
308  if (window->mouseButtons[button] == _GLFW_STICK)
309  {
310  // Sticky mode: release mouse button now
311  window->mouseButtons[button] = GLFW_RELEASE;
312  return GLFW_PRESS;
313  }
314 
315  return (int) window->mouseButtons[button];
316 }
317 
318 GLFWAPI void glfwGetCursorPos(GLFWwindow* handle, double* xpos, double* ypos)
319 {
320  _GLFWwindow* window = (_GLFWwindow*) handle;
321 
322  if (xpos)
323  *xpos = 0;
324  if (ypos)
325  *ypos = 0;
326 
328 
329  if (window->cursorMode == GLFW_CURSOR_DISABLED)
330  {
331  if (xpos)
332  *xpos = window->cursorPosX;
333  if (ypos)
334  *ypos = window->cursorPosY;
335  }
336  else
337  _glfwPlatformGetCursorPos(window, xpos, ypos);
338 }
339 
340 GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos)
341 {
342  _GLFWwindow* window = (_GLFWwindow*) handle;
343 
345 
346  if (_glfw.cursorWindow != window)
347  return;
348 
349  if (window->cursorMode == GLFW_CURSOR_DISABLED)
350  {
351  // Only update the accumulated position if the cursor is disabled
352  window->cursorPosX = xpos;
353  window->cursorPosY = ypos;
354  }
355  else
356  {
357  // Update system cursor position
358  _glfwPlatformSetCursorPos(window, xpos, ypos);
359  }
360 }
361 
362 GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot)
363 {
364  _GLFWcursor* cursor;
365 
367 
368  cursor = calloc(1, sizeof(_GLFWcursor));
369  cursor->next = _glfw.cursorListHead;
370  _glfw.cursorListHead = cursor;
371 
372  if (!_glfwPlatformCreateCursor(cursor, image, xhot, yhot))
373  {
374  glfwDestroyCursor((GLFWcursor*) cursor);
375  return NULL;
376  }
377 
378  return (GLFWcursor*) cursor;
379 }
380 
382 {
383  _GLFWcursor* cursor;
384 
386 
387  if (shape != GLFW_ARROW_CURSOR &&
388  shape != GLFW_IBEAM_CURSOR &&
389  shape != GLFW_CROSSHAIR_CURSOR &&
390  shape != GLFW_HAND_CURSOR &&
391  shape != GLFW_HRESIZE_CURSOR &&
392  shape != GLFW_VRESIZE_CURSOR)
393  {
394  _glfwInputError(GLFW_INVALID_ENUM, "Invalid standard cursor");
395  return NULL;
396  }
397 
398  cursor = calloc(1, sizeof(_GLFWcursor));
399  cursor->next = _glfw.cursorListHead;
400  _glfw.cursorListHead = cursor;
401 
402  if (!_glfwPlatformCreateStandardCursor(cursor, shape))
403  {
404  glfwDestroyCursor((GLFWcursor*) cursor);
405  return NULL;
406  }
407 
408  return (GLFWcursor*) cursor;
409 }
410 
412 {
413  _GLFWcursor* cursor = (_GLFWcursor*) handle;
414 
416 
417  if (cursor == NULL)
418  return;
419 
420  // Make sure the cursor is not being used by any window
421  {
422  _GLFWwindow* window;
423 
424  for (window = _glfw.windowListHead; window; window = window->next)
425  {
426  if (window->cursor == cursor)
427  glfwSetCursor((GLFWwindow*) window, NULL);
428  }
429  }
430 
432 
433  // Unlink cursor from global linked list
434  {
435  _GLFWcursor** prev = &_glfw.cursorListHead;
436 
437  while (*prev != cursor)
438  prev = &((*prev)->next);
439 
440  *prev = cursor->next;
441  }
442 
443  free(cursor);
444 }
445 
446 GLFWAPI void glfwSetCursor(GLFWwindow* windowHandle, GLFWcursor* cursorHandle)
447 {
448  _GLFWwindow* window = (_GLFWwindow*) windowHandle;
449  _GLFWcursor* cursor = (_GLFWcursor*) cursorHandle;
450 
452 
453  _glfwPlatformSetCursor(window, cursor);
454 
455  window->cursor = cursor;
456 }
457 
459 {
460  _GLFWwindow* window = (_GLFWwindow*) handle;
462  _GLFW_SWAP_POINTERS(window->callbacks.key, cbfun);
463  return cbfun;
464 }
465 
467 {
468  _GLFWwindow* window = (_GLFWwindow*) handle;
470  _GLFW_SWAP_POINTERS(window->callbacks.character, cbfun);
471  return cbfun;
472 }
473 
475 {
476  _GLFWwindow* window = (_GLFWwindow*) handle;
478  _GLFW_SWAP_POINTERS(window->callbacks.charmods, cbfun);
479  return cbfun;
480 }
481 
483  GLFWmousebuttonfun cbfun)
484 {
485  _GLFWwindow* window = (_GLFWwindow*) handle;
487  _GLFW_SWAP_POINTERS(window->callbacks.mouseButton, cbfun);
488  return cbfun;
489 }
490 
492  GLFWcursorposfun cbfun)
493 {
494  _GLFWwindow* window = (_GLFWwindow*) handle;
496  _GLFW_SWAP_POINTERS(window->callbacks.cursorPos, cbfun);
497  return cbfun;
498 }
499 
501  GLFWcursorenterfun cbfun)
502 {
503  _GLFWwindow* window = (_GLFWwindow*) handle;
505  _GLFW_SWAP_POINTERS(window->callbacks.cursorEnter, cbfun);
506  return cbfun;
507 }
508 
510  GLFWscrollfun cbfun)
511 {
512  _GLFWwindow* window = (_GLFWwindow*) handle;
514  _GLFW_SWAP_POINTERS(window->callbacks.scroll, cbfun);
515  return cbfun;
516 }
517 
519 {
520  _GLFWwindow* window = (_GLFWwindow*) handle;
522  _GLFW_SWAP_POINTERS(window->callbacks.drop, cbfun);
523  return cbfun;
524 }
525 
527 {
529 
530  if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
531  {
532  _glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick");
533  return 0;
534  }
535 
536  return _glfwPlatformJoystickPresent(joy);
537 }
538 
539 GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count)
540 {
541  *count = 0;
542 
544 
545  if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
546  {
547  _glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick");
548  return NULL;
549  }
550 
551  return _glfwPlatformGetJoystickAxes(joy, count);
552 }
553 
554 GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count)
555 {
556  *count = 0;
557 
559 
560  if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
561  {
562  _glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick");
563  return NULL;
564  }
565 
566  return _glfwPlatformGetJoystickButtons(joy, count);
567 }
568 
569 GLFWAPI const char* glfwGetJoystickName(int joy)
570 {
572 
573  if (joy < 0 || joy > GLFW_JOYSTICK_LAST)
574  {
575  _glfwInputError(GLFW_INVALID_ENUM, "Invalid joystick");
576  return NULL;
577  }
578 
579  return _glfwPlatformGetJoystickName(joy);
580 }
581 
582 GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string)
583 {
584  _GLFWwindow* window = (_GLFWwindow*) handle;
586  _glfwPlatformSetClipboardString(window, string);
587 }
588 
590 {
591  _GLFWwindow* window = (_GLFWwindow*) handle;
593  return _glfwPlatformGetClipboardString(window);
594 }
595 
596 GLFWAPI double glfwGetTime(void)
597 {
599  return _glfwPlatformGetTime();
600 }
601 
602 GLFWAPI void glfwSetTime(double time)
603 {
605 
606  if (time != time || time < 0.0 || time > 18446744073.0)
607  {
608  _glfwInputError(GLFW_INVALID_VALUE, "Invalid time");
609  return;
610  }
611 
612  _glfwPlatformSetTime(time);
613 }
614 
void _glfwInputChar(_GLFWwindow *window, unsigned int codepoint, int mods, int plain)
Notifies shared code of a Unicode character input event.
Definition: input.c:159
GLFWcharmodsfun charmods
Definition: internal.h:286
GLFWAPI void glfwSetInputMode(GLFWwindow *handle, int mode, int value)
Sets an input option for the specified window.
Definition: input.c:250
GLFWcursorposfun cursorPos
Definition: internal.h:281
GLFWAPI GLFWcursor * glfwCreateCursor(const GLFWimage *image, int xhot, int yhot)
Creates a custom cursor.
Definition: input.c:362
Cursor structure.
Definition: internal.h:320
void(* GLFWcharmodsfun)(GLFWwindow *, unsigned int, int)
The function signature for Unicode character with modifiers callbacks.
Definition: glfw3.h:948
GLFWAPI void glfwSetCursorPos(GLFWwindow *handle, double xpos, double ypos)
Sets the position of the cursor, relative to the client area of the window.
Definition: input.c:340
GLFWAPI int glfwGetInputMode(GLFWwindow *handle, int mode)
Returns the value of an input option for the specified window.
Definition: input.c:230
int _glfwPlatformCreateStandardCursor(_GLFWcursor *cursor, int shape)
Creates a cursor with a standard shape.
void _glfwPlatformGetWindowSize(_GLFWwindow *window, int *width, int *height)
Retrieves the size of the client area of the specified window.
Definition: win32_window.c:895
#define GLFWAPI
Definition: glfw3.h:185
GLsizei const GLuint * paths
Definition: glext.h:9577
struct GLFWcursor GLFWcursor
Opaque cursor object.
Definition: glfw3.h:730
GLint GLint GLsizei GLsizei height
Definition: glext.h:112
struct _GLFWwindow::@1 callbacks
#define _GLFW_REQUIRE_INIT()
Definition: internal.h:131
GLint GLint GLint GLint GLint GLint y
Definition: glext.h:114
double _glfwPlatformGetTime(void)
Returns the value of the GLFW timer.
Definition: win32_time.c:75
GLFWmousebuttonfun mouseButton
Definition: internal.h:280
void _glfwPlatformApplyCursorMode(_GLFWwindow *window)
Applies the cursor mode of the specified window to the system.
_GLFWcursor * next
Definition: internal.h:322
GLenum GLenum GLsizei void * image
Definition: glext.h:2716
#define GLFW_CURSOR
Definition: glfw3.h:638
void(* GLFWdropfun)(GLFWwindow *, int, const char **)
The function signature for file drop callbacks.
Definition: glfw3.h:962
const float * _glfwPlatformGetJoystickAxes(int joy, int *count)
Returns the values of all axes of the specified joystick.
GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow *handle, GLFWmousebuttonfun cbfun)
Sets the mouse button callback.
Definition: input.c:482
GLFWAPI const unsigned char * glfwGetJoystickButtons(int joy, int *count)
Returns the state of all buttons of the specified joystick.
Definition: input.c:554
static void setStickyKeys(_GLFWwindow *window, int enabled)
Definition: input.c:87
GLFWAPI const char * glfwGetJoystickName(int joy)
Returns the name of the specified joystick.
Definition: input.c:569
GLFWcursorenterfun cursorEnter
Definition: internal.h:282
void(* GLFWkeyfun)(GLFWwindow *, int, int, int, int)
The function signature for keyboard key callbacks.
Definition: glfw3.h:917
static void setCursorMode(_GLFWwindow *window, int newMode)
Definition: input.c:41
void(* GLFWmousebuttonfun)(GLFWwindow *, int, int, int)
The function signature for mouse button callbacks.
Definition: glfw3.h:858
#define GLFW_CROSSHAIR_CURSOR
The crosshair shape.
Definition: glfw3.h:671
GLFWkeyfun key
Definition: internal.h:284
void(* GLFWcharfun)(GLFWwindow *, unsigned int)
The function signature for Unicode character callbacks.
Definition: glfw3.h:930
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:2478
int _glfwPlatformCreateCursor(_GLFWcursor *cursor, const GLFWimage *image, int xhot, int yhot)
Creates a custom cursor.
#define GLFW_ARROW_CURSOR
The regular arrow cursor shape.
Definition: glfw3.h:661
GLFWAPI int glfwGetMouseButton(GLFWwindow *handle, int button)
Returns the last reported state of a mouse button for the specified window.
Definition: input.c:295
_GLFWwindow * windowListHead
Definition: internal.h:343
_GLFWlibrary _glfw
All global data protected by _glfwInitialized. This should only be touched after a call to glfwInit t...
struct GLFWwindow GLFWwindow
Opaque window object.
Definition: glfw3.h:722
void _glfwInputDrop(_GLFWwindow *window, int count, const char **paths)
Notifies dropped object over window.
Definition: input.c:219
#define GLFW_RELEASE
The key or mouse button was released.
Definition: glfw3.h:225
#define GLFW_CURSOR_DISABLED
Definition: glfw3.h:644
const unsigned char * _glfwPlatformGetJoystickButtons(int joy, int *count)
Returns the state of all buttons of the specified joystick.
#define _GLFW_SWAP_POINTERS(x, y)
Definition: internal.h:145
void _glfwPlatformSetTime(double time)
Sets the GLFW timer.
Definition: win32_time.c:81
_GLFWcursor * cursorListHead
Definition: internal.h:341
GLFWAPI const char * glfwGetClipboardString(GLFWwindow *handle)
Returns the contents of the clipboard as a string.
Definition: input.c:589
#define GLFW_VRESIZE_CURSOR
The vertical resize arrow shape.
Definition: glfw3.h:686
#define _GLFW_REQUIRE_INIT_OR_RETURN(x)
Definition: internal.h:137
char keys[GLFW_KEY_LAST+1]
Definition: internal.h:253
_GLFWwindow * cursorWindow
Definition: internal.h:344
void(* GLFWcursorposfun)(GLFWwindow *, double, double)
The function signature for cursor position callbacks.
Definition: glfw3.h:872
typedef GLboolean(APIENTRYP PFNGLISQUERYPROC)(GLuint id)
#define GLFW_CURSOR_NORMAL
Definition: glfw3.h:642
GLint GLint GLint yoffset
Definition: glext.h:113
double cursorPosY
Definition: internal.h:250
GLuint GLuint GLsizei count
Definition: glext.h:111
#define _GLFW_STICK
Definition: input.c:36
#define GLFW_HAND_CURSOR
The hand shape.
Definition: glfw3.h:676
GLFWcharfun character
Definition: internal.h:285
void _glfwPlatformSetCursorPos(_GLFWwindow *window, double xpos, double ypos)
Sets the position of the cursor, relative to the client area of the window.
int cursorMode
Definition: internal.h:251
double cursorPosY
Definition: internal.h:339
#define GLFW_JOYSTICK_LAST
Definition: glfw3.h:459
struct _GLFWwindow * next
Definition: internal.h:234
GLboolean stickyKeys
Definition: internal.h:248
GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow *handle, GLFWcharfun cbfun)
Sets the Unicode character callback.
Definition: input.c:466
GLFWAPI int glfwJoystickPresent(int joy)
Returns whether the specified joystick is present.
Definition: input.c:526
void _glfwPlatformDestroyCursor(_GLFWcursor *cursor)
Destroys a cursor.
int _glfwPlatformJoystickPresent(int joy)
Returns whether the specified joystick is present.
GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow *handle, GLFWcursorposfun cbfun)
Sets the cursor position callback.
Definition: input.c:491
void _glfwInputMouseClick(_GLFWwindow *window, int button, int action, int mods)
Notifies shared code of a mouse button click event.
Definition: input.c:180
void _glfwPlatformSetClipboardString(_GLFWwindow *window, const char *string)
Sets the clipboard to the specified string.
GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow *handle, GLFWcursorenterfun cbfun)
Sets the cursor enter/exit callback.
Definition: input.c:500
GLsizei const GLfloat * value
Definition: glext.h:693
GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow *handle, GLFWcharmodsfun cbfun)
Sets the Unicode character with modifiers callback.
Definition: input.c:474
GLenum mode
Definition: glext.h:1117
GLint GLint xoffset
Definition: glext.h:113
GLFWAPI void glfwSetClipboardString(GLFWwindow *handle, const char *string)
Sets the clipboard to the specified string.
Definition: input.c:582
void _glfwInputScroll(_GLFWwindow *window, double xoffset, double yoffset)
Notifies shared code of a scroll event.
Definition: input.c:174
double cursorPosX
Definition: internal.h:250
GLFWAPI void glfwSetTime(double time)
Sets the GLFW timer.
Definition: input.c:602
#define GLFW_INVALID_ENUM
One of the arguments to the function was an invalid enum value.
Definition: glfw3.h:498
GLFWAPI void glfwSetCursor(GLFWwindow *windowHandle, GLFWcursor *cursorHandle)
Sets the cursor for the window.
Definition: input.c:446
#define GLFW_INVALID_VALUE
One of the arguments to the function was an invalid value.
Definition: glfw3.h:510
const char * _glfwPlatformGetJoystickName(int joy)
Returns the name of the specified joystick.
#define GLFW_KEY_LAST
Definition: glfw3.h:391
GLFWAPI void glfwGetCursorPos(GLFWwindow *handle, double *xpos, double *ypos)
Retrieves the position of the cursor relative to the client area of the window.
Definition: input.c:318
void _glfwInputCursorEnter(_GLFWwindow *window, int entered)
Notifies shared code of a cursor enter/leave event.
Definition: input.c:213
GLboolean stickyMouseButtons
Definition: internal.h:249
GLFWAPI double glfwGetTime(void)
Returns the value of the GLFW timer.
Definition: input.c:596
#define GLFW_CURSOR_HIDDEN
Definition: glfw3.h:643
void _glfwInputCursorMotion(_GLFWwindow *window, double x, double y)
Notifies shared code of a cursor motion event.
Definition: input.c:195
void _glfwPlatformGetCursorPos(_GLFWwindow *window, double *xpos, double *ypos)
Retrieves the position of the cursor relative to the client area of the window.
GLFWAPI void glfwDestroyCursor(GLFWcursor *handle)
Destroys a cursor.
Definition: input.c:411
double cursorPosX
Definition: internal.h:339
#define GLFW_STICKY_KEYS
Definition: glfw3.h:639
GLint GLint GLsizei width
Definition: glext.h:112
#define GLFW_HRESIZE_CURSOR
The horizontal resize arrow shape.
Definition: glfw3.h:681
GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow *handle, GLFWscrollfun cbfun)
Sets the scroll callback.
Definition: input.c:509
GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow *handle, GLFWdropfun cbfun)
Sets the file drop callback.
Definition: input.c:518
void _glfwInputKey(_GLFWwindow *window, int key, int scancode, int action, int mods)
Notifies shared code of a physical key event.
Definition: input.c:134
void _glfwPlatformSetCursor(_GLFWwindow *window, _GLFWcursor *cursor)
Sets the cursor for the window.
#define GLFW_IBEAM_CURSOR
The text input I-beam cursor shape.
Definition: glfw3.h:666
GLFWdropfun drop
Definition: internal.h:287
_GLFWcursor * cursor
Definition: internal.h:245
void _glfwInputError(int error, const char *format,...)
Notifies shared code of an error.
#define GLFW_MOUSE_BUTTON_LAST
Definition: glfw3.h:431
GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow *handle, GLFWkeyfun cbfun)
Sets the key callback.
Definition: input.c:458
GLFWAPI const float * glfwGetJoystickAxes(int joy, int *count)
Returns the values of all axes of the specified joystick.
Definition: input.c:539
static void setStickyMouseButtons(_GLFWwindow *window, int enabled)
Definition: input.c:109
char mouseButtons[GLFW_MOUSE_BUTTON_LAST+1]
Definition: internal.h:252
void(* GLFWcursorenterfun)(GLFWwindow *, int)
The function signature for cursor enter/leave callbacks.
Definition: glfw3.h:886
const char * _glfwPlatformGetClipboardString(_GLFWwindow *window)
Returns the contents of the clipboard as a string.
Image data.
Definition: glfw3.h:1031
void(* GLFWscrollfun)(GLFWwindow *, double, double)
The function signature for scroll callbacks.
Definition: glfw3.h:900
Window and context structure.
Definition: internal.h:232
GLFWAPI GLFWcursor * glfwCreateStandardCursor(int shape)
Creates a cursor with a standard shape.
Definition: input.c:381
#define GLFW_REPEAT
The key was held down until it repeated.
Definition: glfw3.h:239
GLFWscrollfun scroll
Definition: internal.h:283
#define GLFW_STICKY_MOUSE_BUTTONS
Definition: glfw3.h:640
#define GLFW_PRESS
The key or mouse button was pressed.
Definition: glfw3.h:232
GLFWAPI int glfwGetKey(GLFWwindow *handle, int key)
Returns the last reported state of a keyboard key for the specified window.
Definition: input.c:273
GLint GLint GLint GLint GLint x
Definition: glext.h:114


librealsense
Author(s): Sergey Dorodnicov , Mark Horn , Reagan Lopez
autogenerated on Fri Mar 13 2020 03:16:17