Merged default into iOS-improvements
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d24a95b..edd649c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -243,7 +243,7 @@ set_option(DUMMYAUDIO "Support the dummy audio driver" ON)
set_option(VIDEO_DIRECTFB "Use DirectFB video driver" OFF)
dep_option(DIRECTFB_SHARED "Dynamically load directfb support" ON "VIDEO_DIRECTFB" OFF)
set_option(FUSIONSOUND "Use FusionSound audio driver" OFF)
-dep_option(FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "FUSIONSOUND_SHARED" OFF)
+dep_option(FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "FUSIONSOUND" OFF)
set_option(VIDEO_DUMMY "Use dummy video driver" ON)
set_option(VIDEO_OPENGL "Include OpenGL support" ON)
set_option(VIDEO_OPENGLES "Include OpenGL ES support" ON)
diff --git a/android-project/src/org/libsdl/app/SDLActivity.java b/android-project/src/org/libsdl/app/SDLActivity.java
index bd047d6..6c82b76 100644
--- a/android-project/src/org/libsdl/app/SDLActivity.java
+++ b/android-project/src/org/libsdl/app/SDLActivity.java
@@ -114,6 +114,8 @@ public class SDLActivity extends Activity {
// Setup
@Override
protected void onCreate(Bundle savedInstanceState) {
+ Log.v("SDL", "Device: " + android.os.Build.DEVICE);
+ Log.v("SDL", "Model: " + android.os.Build.MODEL);
Log.v("SDL", "onCreate():" + mSingleton);
super.onCreate(savedInstanceState);
diff --git a/cmake/macros.cmake b/cmake/macros.cmake
index c234a56..96a7ce8 100644
--- a/cmake/macros.cmake
+++ b/cmake/macros.cmake
@@ -66,7 +66,7 @@ endmacro()
macro(CHECK_OBJC_SOURCE_COMPILES SOURCE VAR)
set(PREV_REQUIRED_DEFS "${CMAKE_REQUIRED_DEFINITIONS}")
- set(CMAKE_REQUIRED_DEFINITIONS "-ObjC ${PREV_REQUIRED_DEFS}")
+ set(CMAKE_REQUIRED_DEFINITIONS "-x objective-c ${PREV_REQUIRED_DEFS}")
CHECK_C_SOURCE_COMPILES(${SOURCE} ${VAR})
set(CMAKE_REQUIRED_DEFINITIONS "${PREV_REQUIRED_DEFS}")
endmacro()
diff --git a/docs/README-gesture.md b/docs/README-gesture.md
index 7b90b54..7e9f95b 100644
--- a/docs/README-gesture.md
+++ b/docs/README-gesture.md
@@ -1,6 +1,6 @@
Dollar Gestures
===========================================================================
-SDL Provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures.
+SDL provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures.
Gestures can be performed with any number of fingers (the centroid of the fingers must follow the path of the gesture), but the number of fingers must be constant (a finger cannot go down in the middle of a gesture). The path of a gesture is considered the path from the time when the final finger went down, to the first time any finger comes up.
diff --git a/include/SDL_assert.h b/include/SDL_assert.h
index 0be9047..0d7229d 100644
--- a/include/SDL_assert.h
+++ b/include/SDL_assert.h
@@ -86,8 +86,10 @@ This also solves the problem of...
disable assertions.
*/
+/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
+ this condition isn't constant. And looks like an owl's face! */
#ifdef _MSC_VER /* stupid /W4 warnings. */
-#define SDL_NULL_WHILE_LOOP_CONDITION (-1 == __LINE__)
+#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
#else
#define SDL_NULL_WHILE_LOOP_CONDITION (0)
#endif
diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h
index 7cf0208..2a0aba4 100644
--- a/include/SDL_stdinc.h
+++ b/include/SDL_stdinc.h
@@ -226,7 +226,7 @@ typedef uint64_t Uint64;
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
#else
-#if _MSC_VER >= 1600 /* VS 2010 and above */
+#if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */
#include <sal.h>
#define SDL_IN_BYTECAP(x) _In_bytecount_(x)
diff --git a/src/core/linux/SDL_ibus.c b/src/core/linux/SDL_ibus.c
index 6b84be2..e901bec 100644
--- a/src/core/linux/SDL_ibus.c
+++ b/src/core/linux/SDL_ibus.c
@@ -479,8 +479,10 @@ SDL_IBus_Init(void)
inotify_wd = inotify_add_watch(inotify_fd, addr_file, IN_CREATE | IN_MODIFY);
SDL_free(addr_file);
- result = IBus_SetupConnection(dbus, addr);
- SDL_free(addr);
+ if (addr) {
+ result = IBus_SetupConnection(dbus, addr);
+ SDL_free(addr);
+ }
}
return result;
diff --git a/src/joystick/windows/SDL_dinputjoystick.c b/src/joystick/windows/SDL_dinputjoystick.c
index 179f992..3fafdea 100644
--- a/src/joystick/windows/SDL_dinputjoystick.c
+++ b/src/joystick/windows/SDL_dinputjoystick.c
@@ -340,6 +340,11 @@ EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext)
{
JoyStick_DeviceData *pNewJoystick;
JoyStick_DeviceData *pPrevJoystick = NULL;
+ const DWORD devtype = (pdidInstance->dwDevType & 0xFF);
+
+ if ((devtype != DI8DEVTYPE_JOYSTICK) && (devtype != DI8DEVTYPE_GAMEPAD)) {
+ return DIENUM_CONTINUE; /* Ignore touchpads, etc. */
+ }
if (SDL_IsXInputDevice(&pdidInstance->guidProduct)) {
return DIENUM_CONTINUE; /* ignore XInput devices here, keep going. */
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 81d6254..6e9ac2e 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -1265,6 +1265,12 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
h = 1;
}
+ /* Some platforms blow up if the windows are too large. Raise it later? */
+ if ((w > 16384) || (h > 16384)) {
+ SDL_SetError("Window is too large.");
+ return NULL;
+ }
+
/* Some platforms have OpenGL enabled by default */
#if (SDL_VIDEO_OPENGL && __MACOSX__) || __IPHONEOS__ || __ANDROID__ || __NACL__
flags |= SDL_WINDOW_OPENGL;
@@ -1501,11 +1507,8 @@ SDL_SetWindowTitle(SDL_Window * window, const char *title)
return;
}
SDL_free(window->title);
- if (title && *title) {
- window->title = SDL_strdup(title);
- } else {
- window->title = NULL;
- }
+
+ window->title = SDL_strdup(title ? title : "");
if (_this->SetWindowTitle) {
_this->SetWindowTitle(_this, window);
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index 068c59e..2d301e4 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -1189,16 +1189,9 @@ Cocoa_SetWindowTitle(_THIS, SDL_Window * window)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
- NSString *string;
-
- if(window->title) {
- string = [[NSString alloc] initWithUTF8String:window->title];
- } else {
- string = [[NSString alloc] init];
- }
+ NSString *string = [[NSString alloc] initWithUTF8String:window->title];
[nswindow setTitle:string];
[string release];
-
[pool release];
}
diff --git a/src/video/directfb/SDL_DirectFB_WM.c b/src/video/directfb/SDL_DirectFB_WM.c
index b48a106..e85c8d1 100644
--- a/src/video/directfb/SDL_DirectFB_WM.c
+++ b/src/video/directfb/SDL_DirectFB_WM.c
@@ -161,7 +161,7 @@ DirectFB_WM_RedrawLayout(_THIS, SDL_Window * window)
y, w - 2 * d);
/* Caption */
- if (window->title) {
+ if (*window->title) {
s->SetColor(s, COLOR_EXPAND(t->font_color));
DrawCraption(_this, s, (x - w) / 2, t->top_size + d, window->title);
}
diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m
index 550b6f9..df4c700 100644
--- a/src/video/uikit/SDL_uikitwindow.m
+++ b/src/video/uikit/SDL_uikitwindow.m
@@ -222,11 +222,7 @@ UIKit_SetWindowTitle(_THIS, SDL_Window * window)
{
@autoreleasepool {
SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
- if (window->title) {
- data.viewcontroller.title = @(window->title);
- } else {
- data.viewcontroller.title = nil;
- }
+ data.viewcontroller.title = @(window->title);
}
}
diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c
index 338f42f..85f0375 100644
--- a/src/video/wayland/SDL_waylandmouse.c
+++ b/src/video/wayland/SDL_waylandmouse.c
@@ -356,8 +356,7 @@ Wayland_WarpMouseGlobal(int x, int y)
static int
Wayland_SetRelativeMouseMode(SDL_bool enabled)
{
- SDL_Unsupported();
- return -1;
+ return SDL_Unsupported();
}
void
diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index 43826b8..e91374b 100644
--- a/src/video/wayland/SDL_waylandvideo.c
+++ b/src/video/wayland/SDL_waylandvideo.c
@@ -43,11 +43,6 @@
#define WAYLANDVID_DRIVER_NAME "wayland"
-struct wayland_mode {
- SDL_DisplayMode mode;
- struct wl_list link;
-};
-
/* Initialization/Query functions */
static int
Wayland_VideoInit(_THIS);
@@ -87,7 +82,7 @@ static SDL_VideoDevice *
Wayland_CreateDevice(int devindex)
{
SDL_VideoDevice *device;
-
+
if (!SDL_WAYLAND_LoadSymbols()) {
return NULL;
}
@@ -136,27 +131,6 @@ VideoBootStrap Wayland_bootstrap = {
};
static void
-wayland_add_mode(SDL_VideoData *d, SDL_DisplayMode m)
-{
- struct wayland_mode *mode;
-
- /* Check for duplicate mode */
- wl_list_for_each(mode, &d->modes_list, link)
- if (mode->mode.w == m.w && mode->mode.h == m.h &&
- mode->mode.refresh_rate == m.refresh_rate)
- return;
-
- /* Add new mode to the list */
- mode = (struct wayland_mode *) SDL_calloc(1, sizeof *mode);
-
- if (!mode)
- return;
-
- mode->mode = m;
- WAYLAND_wl_list_insert(&d->modes_list, &mode->link);
-}
-
-static void
display_handle_geometry(void *data,
struct wl_output *output,
int x, int y,
@@ -168,54 +142,79 @@ display_handle_geometry(void *data,
int transform)
{
- SDL_VideoData *d = data;
+ SDL_VideoDisplay *display = data;
- d->screen_allocation.x = x;
- d->screen_allocation.y = y;
+ display->name = strdup(model);
+ display->driverdata = output;
}
static void
display_handle_mode(void *data,
- struct wl_output *wl_output,
+ struct wl_output *output,
uint32_t flags,
int width,
int height,
int refresh)
{
- SDL_VideoData *d = data;
+ SDL_VideoDisplay *display = data;
SDL_DisplayMode mode;
SDL_zero(mode);
mode.w = width;
mode.h = height;
- mode.refresh_rate = refresh / 1000;
-
- wayland_add_mode(d, mode);
+ mode.refresh_rate = refresh / 1000; // mHz to Hz
+ SDL_AddDisplayMode(display, &mode);
if (flags & WL_OUTPUT_MODE_CURRENT) {
- d->screen_allocation.width = width;
- d->screen_allocation.height = height;
+ display->current_mode = mode;
+ display->desktop_mode = mode;
}
}
+static void
+display_handle_done(void *data,
+ struct wl_output *output)
+{
+ SDL_VideoDisplay *display = data;
+ SDL_AddVideoDisplay(display);
+ SDL_free(display->name);
+ SDL_free(display);
+}
+
+static void
+display_handle_scale(void *data,
+ struct wl_output *output,
+ int32_t factor)
+{
+ // TODO: do HiDPI stuff.
+}
+
static const struct wl_output_listener output_listener = {
display_handle_geometry,
- display_handle_mode
+ display_handle_mode,
+ display_handle_done,
+ display_handle_scale
};
static void
-shm_handle_format(void *data,
- struct wl_shm *shm,
- uint32_t format)
+Wayland_add_display(SDL_VideoData *d, uint32_t id)
{
- SDL_VideoData *d = data;
+ struct wl_output *output;
+ SDL_VideoDisplay *display = SDL_malloc(sizeof *display);
+ if (!display) {
+ SDL_OutOfMemory();
+ return;
+ }
+ SDL_zero(*display);
- d->shm_formats |= (1 << format);
-}
+ output = wl_registry_bind(d->registry, id, &wl_output_interface, 2);
+ if (!output) {
+ SDL_SetError("Failed to retrieve output.");
+ return;
+ }
-static const struct wl_shm_listener shm_listener = {
- shm_handle_format
-};
+ wl_output_add_listener(output, &output_listener, display);
+}
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
static void
@@ -238,15 +237,14 @@ static const struct qt_windowmanager_listener windowmanager_listener = {
static void
display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
- const char *interface, uint32_t version)
+ const char *interface, uint32_t version)
{
SDL_VideoData *d = data;
-
+
if (strcmp(interface, "wl_compositor") == 0) {
d->compositor = wl_registry_bind(d->registry, id, &wl_compositor_interface, 1);
} else if (strcmp(interface, "wl_output") == 0) {
- d->output = wl_registry_bind(d->registry, id, &wl_output_interface, 1);
- wl_output_add_listener(d->output, &output_listener, d);
+ Wayland_add_display(d, id);
} else if (strcmp(interface, "wl_seat") == 0) {
Wayland_display_add_input(d, id);
} else if (strcmp(interface, "wl_shell") == 0) {
@@ -255,8 +253,7 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
d->cursor_theme = WAYLAND_wl_cursor_theme_load(NULL, 32, d->shm);
d->default_cursor = WAYLAND_wl_cursor_theme_get_cursor(d->cursor_theme, "left_ptr");
- wl_shm_add_listener(d->shm, &shm_listener, d);
-
+
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
} else if (strcmp(interface, "qt_touch_extension") == 0) {
Wayland_touch_create(d, id);
@@ -272,26 +269,19 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
}
static const struct wl_registry_listener registry_listener = {
- display_handle_global
+ display_handle_global
};
int
Wayland_VideoInit(_THIS)
{
- SDL_VideoData *data;
- SDL_VideoDisplay display;
- SDL_DisplayMode mode;
- int i;
-
- data = malloc(sizeof *data);
+ SDL_VideoData *data = SDL_malloc(sizeof *data);
if (data == NULL)
return 0;
memset(data, 0, sizeof *data);
_this->driverdata = data;
- WAYLAND_wl_list_init(&data->modes_list);
-
data->display = WAYLAND_wl_display_connect(NULL);
if (data->display == NULL) {
SDL_SetError("Failed to connect to a Wayland display");
@@ -299,25 +289,18 @@ Wayland_VideoInit(_THIS)
}
data->registry = wl_display_get_registry(data->display);
-
- if ( data->registry == NULL) {
+ if (data->registry == NULL) {
SDL_SetError("Failed to get the Wayland registry");
return 0;
}
-
+
wl_registry_add_listener(data->registry, ®istry_listener, data);
- for (i=0; i < 100; i++) {
- if (data->screen_allocation.width != 0 || WAYLAND_wl_display_get_error(data->display) != 0) {
- break;
- }
- WAYLAND_wl_display_dispatch(data->display);
- }
-
- if (data->screen_allocation.width == 0) {
- SDL_SetError("Failed while waiting for screen allocation: %d ", WAYLAND_wl_display_get_error(data->display));
- return 0;
- }
+ // First roundtrip to receive all registry objects.
+ WAYLAND_wl_display_roundtrip(data->display);
+
+ // Second roundtrip to receive all output events.
+ WAYLAND_wl_display_roundtrip(data->display);
data->xkb_context = WAYLAND_xkb_context_new(0);
if (!data->xkb_context) {
@@ -325,20 +308,7 @@ Wayland_VideoInit(_THIS)
return 0;
}
- /* Use a fake 32-bpp desktop mode */
- mode.format = SDL_PIXELFORMAT_RGB888;
- mode.w = data->screen_allocation.width;
- mode.h = data->screen_allocation.height;
- mode.refresh_rate = 0;
- mode.driverdata = NULL;
- wayland_add_mode(data, mode);
- SDL_zero(display);
- display.desktop_mode = mode;
- display.current_mode = mode;
- display.driverdata = NULL;
- SDL_AddVideoDisplay(&display);
-
- Wayland_InitMouse ();
+ Wayland_InitMouse();
WAYLAND_wl_display_flush(data->display);
@@ -348,46 +318,29 @@ Wayland_VideoInit(_THIS)
static void
Wayland_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display)
{
- SDL_VideoData *data = _this->driverdata;
- SDL_DisplayMode mode;
- struct wayland_mode *m;
-
- Wayland_PumpEvents(_this);
-
- wl_list_for_each(m, &data->modes_list, link) {
- m->mode.format = SDL_PIXELFORMAT_RGB888;
- SDL_AddDisplayMode(sdl_display, &m->mode);
- m->mode.format = SDL_PIXELFORMAT_RGBA8888;
- SDL_AddDisplayMode(sdl_display, &m->mode);
- }
-
- mode.w = data->screen_allocation.width;
- mode.h = data->screen_allocation.height;
- mode.refresh_rate = 0;
- mode.driverdata = NULL;
-
- mode.format = SDL_PIXELFORMAT_RGB888;
- SDL_AddDisplayMode(sdl_display, &mode);
- mode.format = SDL_PIXELFORMAT_RGBA8888;
- SDL_AddDisplayMode(sdl_display, &mode);
+ // Nothing to do here, everything was already done in the wl_output
+ // callbacks.
}
static int
Wayland_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
{
- return 0;
+ return SDL_Unsupported();
}
void
Wayland_VideoQuit(_THIS)
{
SDL_VideoData *data = _this->driverdata;
- struct wayland_mode *t, *m;
+ int i;
Wayland_FiniMouse ();
- if (data->output)
- wl_output_destroy(data->output);
+ for (i = 0; i < _this->num_displays; ++i) {
+ SDL_VideoDisplay *display = &_this->displays[i];
+ wl_output_destroy(display->driverdata);
+ display->driverdata = NULL;
+ }
Wayland_display_destroy_input(data);
@@ -417,16 +370,13 @@ Wayland_VideoQuit(_THIS)
if (data->compositor)
wl_compositor_destroy(data->compositor);
+ if (data->registry)
+ wl_registry_destroy(data->registry);
+
if (data->display) {
WAYLAND_wl_display_flush(data->display);
WAYLAND_wl_display_disconnect(data->display);
}
-
- wl_list_for_each_safe(m, t, &data->modes_list, link) {
- WAYLAND_wl_list_remove(&m->link);
- free(m);
- }
-
free(data);
_this->driverdata = NULL;
diff --git a/src/video/wayland/SDL_waylandvideo.h b/src/video/wayland/SDL_waylandvideo.h
index 77d431e..d56e0c9 100644
--- a/src/video/wayland/SDL_waylandvideo.h
+++ b/src/video/wayland/SDL_waylandvideo.h
@@ -40,33 +40,24 @@ typedef struct {
struct wl_display *display;
struct wl_registry *registry;
struct wl_compositor *compositor;
- struct wl_output *output;
struct wl_shm *shm;
struct wl_cursor_theme *cursor_theme;
struct wl_cursor *default_cursor;
struct wl_pointer *pointer;
struct wl_shell *shell;
- struct {
- int32_t x, y, width, height;
- } screen_allocation;
-
- struct wl_list modes_list;
-
EGLDisplay edpy;
EGLContext context;
EGLConfig econf;
struct xkb_context *xkb_context;
struct SDL_WaylandInput *input;
-
-#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
struct SDL_WaylandTouch *touch;
struct qt_surface_extension *surface_extension;
struct qt_windowmanager *windowmanager;
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
-
- uint32_t shm_formats;
} SDL_VideoData;
#endif /* _SDL_waylandvideo_h */
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index 81bdc81..b66508f 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -116,7 +116,7 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
if (window->flags & SDL_WINDOW_FULLSCREEN)
wl_shell_surface_set_fullscreen(wind->shell_surface,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
- 0, NULL);
+ 0, (struct wl_output *)window->fullscreen_mode.driverdata);
else
wl_shell_surface_set_toplevel(wind->shell_surface);
@@ -132,7 +132,7 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window,
if (fullscreen)
wl_shell_surface_set_fullscreen(wind->shell_surface,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE,
- 0, NULL);
+ 0, (struct wl_output *)_display->driverdata);
else
wl_shell_surface_set_toplevel(wind->shell_surface);
@@ -179,17 +179,6 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
}
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
- /**
- * If the user specified 0x0 as the size (turned to 1x1 by SDL_CreateWindow
- * in SDL_video.c), we want to make the window fill the whole screen
- **/
- if (window->w == 1) {
- window->w = c->screen_allocation.width;
- }
- if (window->h == 1) {
- window->h = c->screen_allocation.height;
- }
-
data->egl_window = WAYLAND_wl_egl_window_create(data->surface,
window->w, window->h);
@@ -197,8 +186,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->egl_window);
if (data->egl_surface == EGL_NO_SURFACE) {
- SDL_SetError("failed to create a window surface");
- return -1;
+ return SDL_SetError("failed to create a window surface");;
}
if (data->shell_surface) {
diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c
index 463db1e..d3aaebd 100644
--- a/src/video/windows/SDL_windowswindow.c
+++ b/src/video/windows/SDL_windowswindow.c
@@ -371,14 +371,8 @@ void
WIN_SetWindowTitle(_THIS, SDL_Window * window)
{
HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
- LPTSTR title;
-
- if (window->title) {
- title = WIN_UTF8ToString(window->title);
- } else {
- title = NULL;
- }
- SetWindowText(hwnd, title ? title : TEXT(""));
+ LPTSTR title = WIN_UTF8ToString(window->title);
+ SetWindowText(hwnd, title);
SDL_free(title);
}
diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index 05621e0..27e1c99 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -333,7 +333,7 @@ SetWindowBordered(Display *display, int screen, Window window, SDL_bool border)
X11_XChangeProperty(display, window, WM_HINTS, WM_HINTS, 32,
PropModeReplace, (unsigned char *) &MWMHints,
- sizeof(MWMHints) / 4);
+ sizeof(MWMHints) / sizeof(long));
} else { /* set the transient hints instead, if necessary */
X11_XSetTransientForHint(display, window, RootWindow(display, screen));
}
@@ -656,67 +656,39 @@ X11_SetWindowTitle(_THIS, SDL_Window * window)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
Display *display = data->videodata->display;
- XTextProperty titleprop, iconprop;
+ XTextProperty titleprop;
Status status;
- const char *title = window->title;
- const char *icon = NULL;
+ const char *title = window->title ? window->title : "";
+ char *title_locale = NULL;
#ifdef X_HAVE_UTF8_STRING
Atom _NET_WM_NAME = data->videodata->_NET_WM_NAME;
- Atom _NET_WM_ICON_NAME = data->videodata->_NET_WM_ICON_NAME;
#endif
- if (title != NULL) {
- char *title_locale = SDL_iconv_utf8_locale(title);
- if (!title_locale) {
- SDL_OutOfMemory();
- return;
- }
- status = X11_XStringListToTextProperty(&title_locale, 1, &titleprop);
- SDL_free(title_locale);
- if (status) {
- X11_XSetTextProperty(display, data->xwindow, &titleprop, XA_WM_NAME);
- X11_XFree(titleprop.value);
- }
+ title_locale = SDL_iconv_utf8_locale(title);
+ if (!title_locale) {
+ SDL_OutOfMemory();
+ return;
+ }
+
+ status = X11_XStringListToTextProperty(&title_locale, 1, &titleprop);
+ SDL_free(title_locale);
+ if (status) {
+ X11_XSetTextProperty(display, data->xwindow, &titleprop, XA_WM_NAME);
+ X11_XFree(titleprop.value);
+ }
#ifdef X_HAVE_UTF8_STRING
- if (SDL_X11_HAVE_UTF8) {
- status =
- X11_Xutf8TextListToTextProperty(display, (char **) &title, 1,
+ if (SDL_X11_HAVE_UTF8) {
+ status = X11_Xutf8TextListToTextProperty(display, (char **) &title, 1,
XUTF8StringStyle, &titleprop);
- if (status == Success) {
- X11_XSetTextProperty(display, data->xwindow, &titleprop,
+ if (status == Success) {
+ X11_XSetTextProperty(display, data->xwindow, &titleprop,
_NET_WM_NAME);
- X11_XFree(titleprop.value);
- }
+ X11_XFree(titleprop.value);
}
-#endif
}
- if (icon != NULL) {
- char *icon_locale = SDL_iconv_utf8_locale(icon);
- if (!icon_locale) {
- SDL_OutOfMemory();
- return;
- }
- status = X11_XStringListToTextProperty(&icon_locale, 1, &iconprop);
- SDL_free(icon_locale);
- if (status) {
- X11_XSetTextProperty(display, data->xwindow, &iconprop,
- XA_WM_ICON_NAME);
- X11_XFree(iconprop.value);
- }
-#ifdef X_HAVE_UTF8_STRING
- if (SDL_X11_HAVE_UTF8) {
- status =
- X11_Xutf8TextListToTextProperty(display, (char **) &icon, 1,
- XUTF8StringStyle, &iconprop);
- if (status == Success) {
- X11_XSetTextProperty(display, data->xwindow, &iconprop,
- _NET_WM_ICON_NAME);
- X11_XFree(iconprop.value);
- }
- }
#endif
- }
+
X11_XFlush(display);
}