| 1 | package SDL2::syswm 0.01 { | ||
| 2 | use SDL2::Utils; | ||
| 3 | # | ||
| 4 | use SDL2::stdinc; | ||
| 5 | use SDL2::error; | ||
| 6 | use SDL2::video; | ||
| 7 | use SDL2::version; | ||
| 8 | # | ||
| 9 | enum SDL_SYSWM_TYPE => [ | ||
| 10 | qw[ | ||
| 11 | SDL_SYSWM_UNKNOWN | ||
| 12 | SDL_SYSWM_WINDOWS | ||
| 13 | SDL_SYSWM_X11 | ||
| 14 | SDL_SYSWM_DIRECTFB | ||
| 15 | SDL_SYSWM_COCOA | ||
| 16 | SDL_SYSWM_UIKIT | ||
| 17 | SDL_SYSWM_WAYLAND | ||
| 18 | SDL_SYSWM_MIR | ||
| 19 | SDL_SYSWM_WINRT | ||
| 20 | SDL_SYSWM_ANDROID | ||
| 21 | SDL_SYSWM_VIVANTE | ||
| 22 | SDL_SYSWM_OS2 | ||
| 23 | SDL_SYSWM_HAIKU | ||
| 24 | SDL_SYSWM_KMSDRM | ||
| 25 | ] | ||
| 26 | ]; | ||
| 27 | |||
| 28 | package SDL2::SysWMmsg { | ||
| 29 | use SDL2::Utils; # TODO: Complex! | ||
| 30 | |||
| 31 | package SDL2::Win { | ||
| 32 | use SDL2::Utils; | ||
| 33 | has | ||
| 34 | HWND => 'uint32', | ||
| 35 | msg => 'uint32', | ||
| 36 | wParam => 'uint32', | ||
| 37 | lParam => 'uint32'; | ||
| 38 | }; | ||
| 39 | |||
| 40 | package SDL2::X11 { | ||
| 41 | use SDL2::Utils; | ||
| 42 | has event => 'opaque'; # XEvent | ||
| 43 | }; | ||
| 44 | |||
| 45 | package SDL2::DFB { | ||
| 46 | use SDL2::Utils; | ||
| 47 | has event => 'opaque'; # DFBEvent | ||
| 48 | }; | ||
| 49 | |||
| 50 | package SDL2::Cocoa { | ||
| 51 | use SDL2::Utils; | ||
| 52 | has dummy => 'int'; | ||
| 53 | }; | ||
| 54 | |||
| 55 | package SDL2::UIKit { | ||
| 56 | use SDL2::Utils; | ||
| 57 | has dummy => 'int'; | ||
| 58 | }; | ||
| 59 | |||
| 60 | package SDL2::Vivante { | ||
| 61 | use SDL2::Utils; | ||
| 62 | has dummy => 'int'; | ||
| 63 | }; | ||
| 64 | |||
| 65 | package SDL2::OS2 { | ||
| 66 | use SDL2::Utils; | ||
| 67 | has | ||
| 68 | fFrame => 'bool', | ||
| 69 | hwnd => 'uint32', | ||
| 70 | msg => 'ulong', | ||
| 71 | mp1 => 'uint32', | ||
| 72 | mp2 => 'uint32'; | ||
| 73 | }; | ||
| 74 | |||
| 75 | package SDL2::msg { | ||
| 76 | use SDL2::Utils; | ||
| 77 | is 'Union'; | ||
| 78 | has | ||
| 79 | event => 'SDL_X11', | ||
| 80 | dummy => 'int'; | ||
| 81 | }; | ||
| 82 | our $TYPE = has | ||
| 83 | version => 'SDL_Version', | ||
| 84 | subsystem => 'SDL_SYSWM_TYPE', | ||
| 85 | # | ||
| 86 | msg => 'SDL_msg', | ||
| 87 | # | ||
| 88 | ; # contents depends on driver, platform, etc. | ||
| 89 | }; | ||
| 90 | |||
| 91 | =begin :todo | ||
| 92 | |||
| 93 | union | ||
| 94 | { | ||
| 95 | #if defined(SDL_VIDEO_DRIVER_WINDOWS) | ||
| 96 | struct { | ||
| 97 | HWND hwnd; /**< The window for the message */ | ||
| 98 | UINT msg; /**< The type of message */ | ||
| 99 | WPARAM wParam; /**< WORD message parameter */ | ||
| 100 | LPARAM lParam; /**< LONG message parameter */ | ||
| 101 | } win; | ||
| 102 | #endif | ||
| 103 | #if defined(SDL_VIDEO_DRIVER_X11) | ||
| 104 | struct { | ||
| 105 | XEvent event; | ||
| 106 | } x11; | ||
| 107 | #endif | ||
| 108 | #if defined(SDL_VIDEO_DRIVER_DIRECTFB) | ||
| 109 | struct { | ||
| 110 | DFBEvent event; | ||
| 111 | } dfb; | ||
| 112 | #endif | ||
| 113 | #if defined(SDL_VIDEO_DRIVER_COCOA) | ||
| 114 | struct | ||
| 115 | { | ||
| 116 | /* Latest version of Xcode clang complains about empty structs in C v. C++: | ||
| 117 | error: empty struct has size 0 in C, size 1 in C++ | ||
| 118 | */ | ||
| 119 | int dummy; | ||
| 120 | /* No Cocoa window events yet */ | ||
| 121 | } cocoa; | ||
| 122 | #endif | ||
| 123 | #if defined(SDL_VIDEO_DRIVER_UIKIT) | ||
| 124 | struct | ||
| 125 | { | ||
| 126 | int dummy; | ||
| 127 | /* No UIKit window events yet */ | ||
| 128 | } uikit; | ||
| 129 | #endif | ||
| 130 | #if defined(SDL_VIDEO_DRIVER_VIVANTE) | ||
| 131 | struct | ||
| 132 | { | ||
| 133 | int dummy; | ||
| 134 | /* No Vivante window events yet */ | ||
| 135 | } vivante; | ||
| 136 | #endif | ||
| 137 | #if defined(SDL_VIDEO_DRIVER_OS2) | ||
| 138 | struct | ||
| 139 | { | ||
| 140 | BOOL fFrame; /**< TRUE if hwnd is a frame window */ | ||
| 141 | HWND hwnd; /**< The window receiving the message */ | ||
| 142 | ULONG msg; /**< The message identifier */ | ||
| 143 | MPARAM mp1; /**< The first first message parameter */ | ||
| 144 | MPARAM mp2; /**< The second first message parameter */ | ||
| 145 | } os2; | ||
| 146 | #endif | ||
| 147 | /* Can't have an empty union */ | ||
| 148 | int dummy; | ||
| 149 | } msg; | ||
| 150 | |||
| 151 | =end :todo | ||
| 152 | |||
| 153 | =cut | ||
| 154 | |||
| 155 | package SDL2::SysWMinfo 0.01 { | ||
| 156 | use SDL2::Utils; | ||
| 157 | our $TYPE = has() # TODO: Complex! | ||
| 158 | ; | ||
| 159 | }; | ||
| 160 | # | ||
| 161 | attach syswm => { SDL_GetWindowWMInfo => [ [ 'SDL_Window', 'SDL_SysWMinfo' ], 'SDL_bool' ] }; | ||
| 162 | |||
| 163 | =encoding utf-8 | ||
| 164 | |||
| 165 | =head1 NAME | ||
| 166 | |||
| 167 | SDL2::syswm - SDL Custom System Window Manager Hooks | ||
| 168 | |||
| 169 | =head1 SYNOPSIS | ||
| 170 | |||
| 171 | use SDL2 qw[:syswm]; | ||
| 172 | |||
| 173 | =head1 DESCRIPTION | ||
| 174 | |||
| 175 | Your application has access to a special type of event ::SDL_SYSWMEVENT, which | ||
| 176 | contains window-manager specific information and arrives whenever an unhandled | ||
| 177 | window event occurs. This event is ignored by default, but you can enable it | ||
| 178 | with C<SDL_EventState( )>. | ||
| 179 | |||
| 180 | =head1 Functions | ||
| 181 | |||
| 182 | These may be imported by name or with the C<:syswm> tag. | ||
| 183 | |||
| 184 | =head2 C<SDL_GetWindowWMInfo( )> | ||
| 185 | |||
| 186 | Get driver-specific information about a window. | ||
| 187 | |||
| 188 | The caller must initialize the C<info> structure's version by using C<< | ||
| 189 | SDL_VERSION( $info->version) >>, and then this function will fill in the rest | ||
| 190 | of the structure with information about the given window. | ||
| 191 | |||
| 192 | Expected parameters include: | ||
| 193 | |||
| 194 | =over | ||
| 195 | |||
| 196 | =item C<window> - the window about which information is being requested | ||
| 197 | |||
| 198 | =item C<info> - an L<SDL2::SysWMinfo> structure filled in with window information | ||
| 199 | |||
| 200 | =back | ||
| 201 | |||
| 202 | Returns C<SDL_TRUE> if the function is implemented and the C<version> member of | ||
| 203 | the C<info> struct is valid, or C<SDL_FALSE> if the information could not be | ||
| 204 | retrieved; call C<SDL_GetError( )> for more information. | ||
| 205 | |||
| 206 | =head1 Defined Variables and Enumerations | ||
| 207 | |||
| 208 | Variables may be imported by name or with the C<:syswm> tag. | ||
| 209 | |||
| 210 | =head2 C<SDL_SYSWM_TYPE> | ||
| 211 | |||
| 212 | These are the various supported windowing subsystems. | ||
| 213 | |||
| 214 | =over | ||
| 215 | |||
| 216 | =item C<SDL_SYSWM_UNKNOWN> | ||
| 217 | |||
| 218 | =item C<SDL_SYSWM_WINDOWS> | ||
| 219 | |||
| 220 | =item C<SDL_SYSWM_X11> | ||
| 221 | |||
| 222 | =item C<SDL_SYSWM_DIRECTFB> | ||
| 223 | |||
| 224 | =item C<SDL_SYSWM_COCOA> | ||
| 225 | |||
| 226 | =item C<SDL_SYSWM_UIKIT> | ||
| 227 | |||
| 228 | =item C<SDL_SYSWM_WAYLAND> | ||
| 229 | |||
| 230 | =item C<SDL_SYSWM_MIR> - no longer available, left for API/ABI compatibility. Remove in 2.1! | ||
| 231 | |||
| 232 | =item C<SDL_SYSWM_WINRT> | ||
| 233 | |||
| 234 | =item C<SDL_SYSWM_ANDROID> | ||
| 235 | |||
| 236 | =item C<SDL_SYSWM_VIVANTE> | ||
| 237 | |||
| 238 | =item C<SDL_SYSWM_OS2> | ||
| 239 | |||
| 240 | =item C<SDL_SYSWM_HAIKU> | ||
| 241 | |||
| 242 | =item C<SDL_SYSWM_KMSDRM> | ||
| 243 | |||
| 244 | =back | ||
| 245 | |||
| 246 | =head1 LICENSE | ||
| 247 | |||
| 248 | Copyright (C) Sanko Robinson. | ||
| 249 | |||
| 250 | This library is free software; you can redistribute it and/or modify it under | ||
| 251 | the terms found in the Artistic License 2. Other copyrights, terms, and | ||
| 252 | conditions may apply to data transmitted through this module. | ||
| 253 | |||
| 254 | =head1 AUTHOR | ||
| 255 | |||
| 256 | Sanko Robinson E<lt>sanko@cpan.orgE<gt> | ||
| 257 | |||
| 258 | =begin stopwords | ||
| 259 | |||
| 260 | =end stopwords | ||
| 261 | |||
| 262 | =cut | ||
| 263 | |||
| 264 | }; | ||
| 265 | 1; |