Changeset 10895
- Timestamp:
- Jan 11, 2012, 11:50:39 PM (13 years ago)
- Location:
- ps/trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/build/premake/extern_libs4.lua
r10535 r10895 454 454 compile_settings = function() 455 455 if os.is("windows") then 456 add_default_include_paths("sdl") 457 else 456 includedirs { libraries_dir .. "sdl/include/SDL" } 457 else 458 459 -- Support SDL_CONFIG for overriding for the default PATH-based sdl-config 460 sdl_config_path = os.getenv("SDL_CONFIG") 461 if not sdl_config_path then 462 sdl_config_path = "sdl-config" 463 end 464 458 465 -- "pkg-config sdl --libs" appears to include both static and dynamic libs 459 466 -- when on MacPorts, which is bad, so use sdl-config instead 460 pkgconfig_cflags(nil, "sdl-config--cflags")467 pkgconfig_cflags(nil, --cflags") 461 468 end 462 469 end, … … 465 472 add_default_lib_paths("sdl") 466 473 else 467 pkgconfig_libs(nil, "sdl-config --libs") 474 sdl_config_path = os.getenv("SDL_CONFIG") 475 if not sdl_config_path then 476 sdl_config_path = "sdl-config" 477 end 478 pkgconfig_libs(nil, sdl_config_path.." --libs") 468 479 end 469 480 end, -
ps/trunk/source/lib/external_libraries/sdl.h
r7340 r10895 35 35 #else 36 36 37 # include <SDL/SDL.h>38 # include <SDL/SDL_thread.h>37 # include 38 # include 39 39 40 40 // if the compiler doesn't support inlining, this header will pull … … 42 42 // will strip them if unused, and this is more convenient than 43 43 // another header that toggles between wsdl and SDL_endian.h. 44 # include <SDL/SDL_endian.h>44 # include 45 45 46 46 # if MSC_VERSION -
ps/trunk/source/lib/external_libraries/sdl_fwd.h
r7316 r10895 30 30 // 2006-08-26 SDL is dragged into 6 of our 7 static library components. 31 31 // it must be specified in each of their "extern_libs" so that the 32 // include path is set and <SDL /sdl.h> can be found.32 // include path is set and <SDL.h> can be found. 33 33 // 34 34 // obviously this is bad, so we work around the root cause. mostly only -
ps/trunk/source/lib/sysdep/os/unix/x/x.cpp
r9546 r10895 42 42 #include <Xatom.h> 43 43 44 #include "SDL /SDL.h"45 #include "SDL /SDL_syswm.h"44 #include "SDL.h" 45 #include "SDL_syswm.h" 46 46 47 47 #include <algorithm> … … 49 49 #undef Status 50 50 51 static Display *SDL_Display; 52 static Window SDL_Window; 53 static void (*Lock_Display)(void); 54 static void (*Unlock_Display)(void); 51 static Display *g_SDL_Display; 52 static Window g_SDL_Window; 53 #if !SDL_VERSION_ATLEAST(1, 3, 0) 54 static void (*g_Lock_Display)(void); 55 static void (*g_Unlock_Display)(void); 56 #endif 55 57 static wchar_t *selection_data=NULL; 56 58 static size_t selection_size=0; … … 228 230 * @see sys_clipboard_set 229 231 */ 230 int clipboard_filter(const SDL_Event *event) 232 #if SDL_VERSION_ATLEAST(1, 3, 0) 233 int clipboard_filter(void* UNUSED(userdata), SDL_Event* event) 234 #else 235 int clipboard_filter(const SDL_Event* event) 236 #endif 231 237 { 232 238 /* Pass on all non-window manager specific events immediately */ … … 238 244 /* (Note: libsdl must be compiled with X11 support (SDL_VIDEO_DRIVER_X11 in SDL_config.h) - 239 245 else you'll get errors like "'struct SDL_SysWMmsg' has no member named 'xevent'") */ 240 switch (event->syswm.msg->event.xevent.type) { 246 #if SDL_VERSION_ATLEAST(1, 3, 0) 247 XEvent* xevent = &event->syswm.msg->msg.x11.event; 248 #else 249 XEvent* xevent = &event->syswm.msg->event.xevent; 250 #endif 251 switch (xevent->type) { 241 252 /* Copy the selection from our buffer to the requested property, and 242 253 convert to the requested target format */ … … 245 256 XEvent sevent; 246 257 247 req = & event->syswm.msg->event.xevent.xselectionrequest;258 req = &xselectionrequest; 248 259 sevent.xselection.type = SelectionNotify; 249 260 sevent.xselection.display = req->display; … … 258 269 { 259 270 size_t size = wcslen(selection_data); 260 u8 *buf = (u8*)alloca(size);271 u8*)alloca(size); 261 272 262 for (size_t i =0;i<size;i++)273 for (size_t ii++) 263 274 { 264 buf[i] = selection_data[i] <0x100?selection_data[i]:'?';275 buf[i] = selection_data[i]'?'; 265 276 } 266 277 267 XChangeProperty( SDL_Display, req->requestor, req->property,268 278 XChangeProperty(SDL_Display, req->requestor, req->property, 279 sevent.xselection.target, 8, PropModeReplace, 269 280 buf, size); 270 281 sevent.xselection.property = req->property; 271 282 } 272 283 // TODO Add more target formats 273 XSendEvent( SDL_Display,req->requestor,False,0,&sevent);274 XSync( SDL_Display, False);284 XSendEvent(&sevent); 285 XSync(SDL_Display, False); 275 286 } 276 287 break; … … 289 300 290 301 SDL_VERSION(&info.version); 291 if ( SDL_GetWMInfo(&info))302 if () 292 303 { 293 304 /* Save the information for later use */ 294 if ( info.subsystem == SDL_SYSWM_X11)305 if () 295 306 { 296 SDL_Display = info.info.x11.display; 297 SDL_Window = info.info.x11.window; 298 Lock_Display = info.info.x11.lock_func; 299 Unlock_Display = info.info.x11.unlock_func; 307 g_SDL_Display = info.info.x11.display; 308 g_SDL_Window = info.info.x11.window; 309 #if !SDL_VERSION_ATLEAST(1, 3, 0) 310 g_Lock_Display = info.info.x11.lock_func; 311 g_Unlock_Display = info.info.x11.unlock_func; 312 #endif 300 313 301 314 /* Enable the special window hook events */ 302 315 SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE); 316 317 318 303 319 SDL_SetEventFilter(clipboard_filter); 320 304 321 305 322 return INFO::OK; … … 340 357 wcscpy(selection_data, str); 341 358 342 Lock_Display(); 359 #if !SDL_VERSION_ATLEAST(1, 3, 0) 360 g_Lock_Display(); 361 #endif 362 343 363 // Like for the clipboard_get code above, we rather use CLIPBOARD than 344 364 // PRIMARY - more windows'y behaviour there. 345 Atom clipboard_atom = XInternAtom(SDL_Display, "CLIPBOARD", False); 346 XSetSelectionOwner(SDL_Display, clipboard_atom, SDL_Window, CurrentTime); 347 XSetSelectionOwner(SDL_Display, XA_PRIMARY, SDL_Window, CurrentTime); 348 Unlock_Display(); 349 365 Atom clipboard_atom = XInternAtom(g_SDL_Display, "CLIPBOARD", False); 366 XSetSelectionOwner(g_SDL_Display, clipboard_atom, g_SDL_Window, CurrentTime); 367 XSetSelectionOwner(g_SDL_Display, XA_PRIMARY, g_SDL_Window, CurrentTime); 368 369 #if !SDL_VERSION_ATLEAST(1, 3, 0) 370 g_Unlock_Display(); 371 #else 372 // SDL 1.3 doesn't have a lockable event thread, so it just uses 373 // XSync directly instead of lock_func/unlock_func 374 XSync(g_SDL_Display, False); 375 #endif 376 350 377 return INFO::OK; 351 378 } -
ps/trunk/source/lib/sysdep/os/win/wsdl.h
r10826 r10895 31 31 #include "lib/byte_order.h" 32 32 #ifndef WSDL_NO_KEYSYM 33 # include "SDL /SDL_keysym.h"33 # include "SDL_keysym.h" 34 34 #endif 35 35 -
ps/trunk/source/ps/CConsole.cpp
r10822 r10895 653 653 InReaction conInputHandler(const SDL_Event_* ev) 654 654 { 655 if ( ev->ev.type == SDL_HOTKEYDOWN)655 if (ev->ev.type == SDL_HOTKEYDOWN) 656 656 { 657 657 std::string hotkey = static_cast<const char*>(ev->ev.user.data1); -
ps/trunk/source/ps/Globals.cpp
r7283 r10895 25 25 bool g_app_has_focus = true; 26 26 27 bool g_keys[SDLK_LAST] = {0};27 ; 28 28 int g_mouse_x = 50, g_mouse_y = 50; 29 29 bool g_mouse_active = true; -
ps/trunk/source/ps/Globals.h
r7326 r10895 42 42 * Updated by GlobalsInputHandler in response to key press/release events. 43 43 */ 44 extern bool g_keys[];44 extern ; 45 45 46 46 /** -
ps/trunk/source/ps/Hotkey.cpp
r10822 r10895 185 185 #endif 186 186 { 187 keycode = SDLK_LAST+ (int)ev->ev.button.button;187 keycode = + (int)ev->ev.button.button; 188 188 break; 189 189 } … … 244 244 bool consoleCapture = false; 245 245 246 if( g_Console->IsActive() && keycode < SDLK_LAST)246 if( g_Console->IsActive() && keycode < ) 247 247 consoleCapture = true; 248 248 … … 279 279 bool rqdState = !itKey->negated; 280 280 281 if( (int)itKey->code < SDLK_LAST)281 if( (int)itKey->code < ) 282 282 { 283 283 if( g_keys[itKey->code] != rqdState ) accept = false; … … 285 285 else if( (int)itKey->code < UNIFIED_SHIFT ) 286 286 { 287 if( g_mouse_buttons[itKey->code - SDLK_LAST] != rqdState ) accept = false;287 if( g_mouse_buttons[itKey->code - ] != rqdState ) accept = false; 288 288 } 289 289 else if( (int)itKey->code < UNIFIED_LAST ) … … 344 344 bool rqdState = !itKey->negated; 345 345 346 if( (int)itKey->code < SDLK_LAST)346 if( (int)itKey->code < ) 347 347 { 348 348 if( g_keys[itKey->code] != rqdState ) accept = false; … … 350 350 else if( (int)itKey->code < UNIFIED_SHIFT ) 351 351 { 352 if( g_mouse_buttons[itKey->code - SDLK_LAST] != rqdState ) accept = false;352 if( g_mouse_buttons[itKey->code - ] != rqdState ) accept = false; 353 353 } 354 354 else if( (int)itKey->code < UNIFIED_LAST ) -
ps/trunk/source/ps/KeyName.h
r8833 r10895 28 28 extern int FindKeyCode( const CStr8& keyname ); 29 29 30 31 32 33 34 35 36 30 37 enum { 31 38 // 'Keycodes' for the mouse buttons 32 MOUSE_LEFT = SDLK_LAST+ SDL_BUTTON_LEFT,33 MOUSE_RIGHT = SDLK_LAST+ SDL_BUTTON_RIGHT,34 MOUSE_MIDDLE = SDLK_LAST+ SDL_BUTTON_MIDDLE,35 MOUSE_WHEELUP = SDLK_LAST+ SDL_BUTTON_WHEELUP,36 MOUSE_WHEELDOWN = SDLK_LAST+ SDL_BUTTON_WHEELDOWN,39 MOUSE_LEFT = + SDL_BUTTON_LEFT, 40 MOUSE_RIGHT = + SDL_BUTTON_RIGHT, 41 MOUSE_MIDDLE = + SDL_BUTTON_MIDDLE, 42 MOUSE_WHEELUP = + SDL_BUTTON_WHEELUP, 43 MOUSE_WHEELDOWN = + SDL_BUTTON_WHEELDOWN, 37 44 #if SDL_VERSION_ATLEAST(1, 2, 13) 38 MOUSE_X1 = SDLK_LAST+ SDL_BUTTON_X1,39 MOUSE_X2 = SDLK_LAST+ SDL_BUTTON_X2,45 MOUSE_X1 = + SDL_BUTTON_X1, 46 MOUSE_X2 = + SDL_BUTTON_X2, 40 47 #else 41 MOUSE_X1 = SDLK_LAST+ SDL_BUTTON_WHEELDOWN + 1,42 MOUSE_X2 = SDLK_LAST+ SDL_BUTTON_WHEELDOWN + 2,48 MOUSE_X1 = + SDL_BUTTON_WHEELDOWN + 1, 49 MOUSE_X2 = + SDL_BUTTON_WHEELDOWN + 2, 43 50 #endif 44 51 -
ps/trunk/source/ps/VideoMode.cpp
r10826 r10895 157 157 SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); 158 158 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); 159 159 160 SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, g_VSync ? 1 : 0); 160 161 #endif 162 161 163 if (!SetVideoMode(w, h, bpp, m_ConfigFullscreen)) 162 164 { … … 168 170 return false; 169 171 } 172 173 174 175 170 176 171 177 // Work around a bug in the proprietary Linux ATI driver (at least versions 8.16.20 and 8.14.13). -
ps/trunk/source/tools/atlas/AtlasUI/Misc/KeyMap.cpp
r7607 r10895 20 20 #include "KeyMap.h" 21 21 22 #include "SDL /SDL_keysym.h"22 #include "SDL_keysym.h" 23 23 24 24 int GetSDLKeyFromWxKeyCode(int wxkey)
Note:
See TracChangeset
for help on using the changeset viewer.