SDL_windowswindow.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. #include "SDL_internal.h"
  19. #ifndef SDL_windowswindow_h_
  20. #define SDL_windowswindow_h_
  21. #ifdef SDL_VIDEO_OPENGL_EGL
  22. #include "../SDL_egl_c.h"
  23. #else
  24. #include "../SDL_sysvideo.h"
  25. #endif
  26. // Set up for C function definitions, even when using C++
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. typedef enum SDL_WindowRect
  31. {
  32. SDL_WINDOWRECT_CURRENT,
  33. SDL_WINDOWRECT_WINDOWED,
  34. SDL_WINDOWRECT_FLOATING,
  35. SDL_WINDOWRECT_PENDING
  36. } SDL_WindowRect;
  37. typedef enum SDL_WindowEraseBackgroundMode
  38. {
  39. SDL_ERASEBACKGROUNDMODE_NEVER,
  40. SDL_ERASEBACKGROUNDMODE_INITIAL,
  41. SDL_ERASEBACKGROUNDMODE_ALWAYS,
  42. } SDL_WindowEraseBackgroundMode;
  43. typedef struct
  44. {
  45. void **lpVtbl;
  46. int refcount;
  47. SDL_Window *window;
  48. HWND hwnd;
  49. UINT format_text;
  50. UINT format_file;
  51. } SDLDropTarget;
  52. struct SDL_WindowData
  53. {
  54. SDL_Window *window;
  55. HWND hwnd;
  56. HWND parent;
  57. HDC hdc;
  58. HDC mdc;
  59. HINSTANCE hinstance;
  60. HBITMAP hbm;
  61. HICON hicon;
  62. WNDPROC wndproc;
  63. HHOOK keyboard_hook;
  64. WPARAM mouse_button_flags;
  65. LPARAM last_pointer_update;
  66. WCHAR high_surrogate;
  67. bool initializing;
  68. bool expected_resize;
  69. bool in_border_change;
  70. bool in_title_click;
  71. Uint8 focus_click_pending;
  72. bool postpone_clipcursor;
  73. bool clipcursor_queued;
  74. bool windowed_mode_was_maximized;
  75. bool in_window_deactivation;
  76. bool force_ws_maximizebox;
  77. bool disable_move_size_events;
  78. bool showing_window;
  79. int in_modal_loop;
  80. int last_modal_width;
  81. int last_modal_height;
  82. RECT initial_size_rect;
  83. RECT cursor_clipped_rect; // last successfully committed clipping rect for this window
  84. RECT cursor_ctrlock_rect; // this is Windows-specific, but probably does not need to be per-window
  85. bool mouse_tracked;
  86. bool destroy_parent_with_window;
  87. WCHAR *ICMFileName;
  88. SDL_WindowEraseBackgroundMode hint_erase_background_mode;
  89. bool taskbar_button_created;
  90. struct SDL_VideoData *videodata;
  91. #ifdef SDL_VIDEO_OPENGL_EGL
  92. EGLSurface egl_surface;
  93. #endif
  94. // Whether we retain the content of the window when changing state
  95. UINT copybits_flag;
  96. SDLDropTarget *drop_target;
  97. };
  98. extern bool WIN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID create_props);
  99. extern void WIN_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window);
  100. extern bool WIN_SetWindowIcon(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surface *icon);
  101. extern bool WIN_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window);
  102. extern void WIN_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window);
  103. extern bool WIN_GetWindowBordersSize(SDL_VideoDevice *_this, SDL_Window *window, int *top, int *left, int *bottom, int *right);
  104. extern void WIN_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *width, int *height);
  105. extern bool WIN_SetWindowOpacity(SDL_VideoDevice *_this, SDL_Window *window, float opacity);
  106. extern void WIN_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window);
  107. extern void WIN_HideWindow(SDL_VideoDevice *_this, SDL_Window *window);
  108. extern void WIN_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window);
  109. extern void WIN_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window);
  110. extern void WIN_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window);
  111. extern void WIN_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window);
  112. extern void WIN_SetWindowBordered(SDL_VideoDevice *_this, SDL_Window *window, bool bordered);
  113. extern void WIN_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, bool resizable);
  114. extern void WIN_SetWindowAlwaysOnTop(SDL_VideoDevice *_this, SDL_Window *window, bool on_top);
  115. extern SDL_FullscreenResult WIN_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_FullscreenOp fullscreen);
  116. extern void WIN_UpdateWindowICCProfile(SDL_Window *window, bool send_event);
  117. extern void *WIN_GetWindowICCProfile(SDL_VideoDevice *_this, SDL_Window *window, size_t *size);
  118. extern bool WIN_SetWindowMouseRect(SDL_VideoDevice *_this, SDL_Window *window);
  119. extern bool WIN_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, bool grabbed);
  120. extern bool WIN_SetWindowKeyboardGrab(SDL_VideoDevice *_this, SDL_Window *window, bool grabbed);
  121. extern void WIN_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
  122. extern void WIN_OnWindowEnter(SDL_VideoDevice *_this, SDL_Window *window);
  123. extern void WIN_UpdateClipCursor(SDL_Window *window);
  124. extern void WIN_UnclipCursorForWindow(SDL_Window *window);
  125. extern bool WIN_SetWindowHitTest(SDL_Window *window, bool enabled);
  126. extern void WIN_AcceptDragAndDrop(SDL_Window *window, bool accept);
  127. extern bool WIN_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation);
  128. extern bool WIN_ApplyWindowProgress(SDL_VideoDevice *_this, SDL_Window *window);
  129. extern bool WIN_SetWindowPositionInternal(SDL_Window *window, UINT flags, SDL_WindowRect rect_type);
  130. extern void WIN_ShowWindowSystemMenu(SDL_Window *window, int x, int y);
  131. extern bool WIN_SetWindowFocusable(SDL_VideoDevice *_this, SDL_Window *window, bool focusable);
  132. extern bool WIN_AdjustWindowRect(SDL_Window *window, int *x, int *y, int *width, int *height, SDL_WindowRect rect_type);
  133. extern bool WIN_AdjustWindowRectForHWND(HWND hwnd, LPRECT lpRect, UINT frame_dpi);
  134. extern bool WIN_SetWindowParent(SDL_VideoDevice *_this, SDL_Window *window, SDL_Window *parent);
  135. extern bool WIN_SetWindowModal(SDL_VideoDevice *_this, SDL_Window *window, bool modal);
  136. // Ends C function definitions when using C++
  137. #ifdef __cplusplus
  138. }
  139. #endif
  140. #endif // SDL_windowswindow_h_