summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wayland
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-11-18 12:19:17 -0500
committerChris Michael <cp.michael@samsung.com>2015-11-18 12:19:17 -0500
commit35b4794c4afd1c2ffc865a90068b26d36e72def9 (patch)
treec0325e3b2dc227b8a5314f6195d3165386901ed7 /src/lib/ecore_wayland
parente089908545a23a9be59f4014906ad82b872aeafa (diff)
ecore-wayland: Add EINA_SAFETY checks to window functions
This adds EINA_SAFETY returns for all public facing ecore_wl_window functions. @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_wayland')
-rw-r--r--src/lib/ecore_wayland/ecore_wl_window.c93
1 files changed, 58 insertions, 35 deletions
diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c
index 40c833e255..389cebceae 100644
--- a/src/lib/ecore_wayland/ecore_wl_window.c
+++ b/src/lib/ecore_wayland/ecore_wl_window.c
@@ -237,7 +237,7 @@ ecore_wl_window_free(Ecore_Wl_Window *win)
237 237
238 LOGFN(__FILE__, __LINE__, __FUNCTION__); 238 LOGFN(__FILE__, __LINE__, __FUNCTION__);
239 239
240 if (!win) return; 240 EINA_SAFETY_ON_NULL_RETURN(win);
241 241
242 eina_hash_del(_windows, _ecore_wl_window_id_str_get(win->id), win); 242 eina_hash_del(_windows, _ecore_wl_window_id_str_get(win->id), win);
243 243
@@ -286,7 +286,7 @@ ecore_wl_window_move(Ecore_Wl_Window *win, int x, int y)
286 286
287 LOGFN(__FILE__, __LINE__, __FUNCTION__); 287 LOGFN(__FILE__, __LINE__, __FUNCTION__);
288 288
289 if (!win) return; 289 EINA_SAFETY_ON_NULL_RETURN(win);
290 290
291 input = win->keyboard_device; 291 input = win->keyboard_device;
292 ecore_wl_window_update_location(win, x, y); 292 ecore_wl_window_update_location(win, x, y);
@@ -315,7 +315,7 @@ ecore_wl_window_resize(Ecore_Wl_Window *win, int w EINA_UNUSED, int h EINA_UNUSE
315 315
316 LOGFN(__FILE__, __LINE__, __FUNCTION__); 316 LOGFN(__FILE__, __LINE__, __FUNCTION__);
317 317
318 if (!win) return; 318 EINA_SAFETY_ON_NULL_RETURN(win);
319 319
320 input = win->keyboard_device; 320 input = win->keyboard_device;
321 321
@@ -342,7 +342,8 @@ ecore_wl_window_damage(Ecore_Wl_Window *win, int x, int y, int w, int h)
342{ 342{
343 LOGFN(__FILE__, __LINE__, __FUNCTION__); 343 LOGFN(__FILE__, __LINE__, __FUNCTION__);
344 344
345 if (!win) return; 345 EINA_SAFETY_ON_NULL_RETURN(win);
346
346 if (win->surface) wl_surface_damage(win->surface, x, y, w, h); 347 if (win->surface) wl_surface_damage(win->surface, x, y, w, h);
347} 348}
348 349
@@ -351,7 +352,7 @@ ecore_wl_window_commit(Ecore_Wl_Window *win)
351{ 352{
352 LOGFN(__FILE__, __LINE__, __FUNCTION__); 353 LOGFN(__FILE__, __LINE__, __FUNCTION__);
353 354
354 if (!win) return; 355 EINA_SAFETY_ON_NULL_RETURN(win);
355 356
356 if ((win->surface))// && (win->has_buffer)) 357 if ((win->surface))// && (win->has_buffer))
357 wl_surface_commit(win->surface); 358 wl_surface_commit(win->surface);
@@ -362,7 +363,7 @@ ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, in
362{ 363{
363 LOGFN(__FILE__, __LINE__, __FUNCTION__); 364 LOGFN(__FILE__, __LINE__, __FUNCTION__);
364 365
365 if (!win) return; 366 EINA_SAFETY_ON_NULL_RETURN(win);
366 367
367 switch (win->buffer_type) 368 switch (win->buffer_type)
368 { 369 {
@@ -391,7 +392,8 @@ ecore_wl_window_surface_create(Ecore_Wl_Window *win)
391{ 392{
392 LOGFN(__FILE__, __LINE__, __FUNCTION__); 393 LOGFN(__FILE__, __LINE__, __FUNCTION__);
393 394
394 if (!win) return NULL; 395 EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
396
395 if (win->surface) return win->surface; 397 if (win->surface) return win->surface;
396 if (_ecore_wl_disp->wl.session_recovery) 398 if (_ecore_wl_disp->wl.session_recovery)
397 session_recovery_add_listener(_ecore_wl_disp->wl.session_recovery, &_ecore_session_recovery_listener, win); 399 session_recovery_add_listener(_ecore_wl_disp->wl.session_recovery, &_ecore_session_recovery_listener, win);
@@ -418,7 +420,7 @@ ecore_wl_window_hide(Ecore_Wl_Window *win)
418{ 420{
419 LOGFN(__FILE__, __LINE__, __FUNCTION__); 421 LOGFN(__FILE__, __LINE__, __FUNCTION__);
420 422
421 if (!win) return; 423 EINA_SAFETY_ON_NULL_RETURN(win);
422 424
423 if (win->xdg_surface) xdg_surface_destroy(win->xdg_surface); 425 if (win->xdg_surface) xdg_surface_destroy(win->xdg_surface);
424 win->xdg_surface = NULL; 426 win->xdg_surface = NULL;
@@ -438,7 +440,8 @@ ecore_wl_window_raise(Ecore_Wl_Window *win)
438{ 440{
439 LOGFN(__FILE__, __LINE__, __FUNCTION__); 441 LOGFN(__FILE__, __LINE__, __FUNCTION__);
440 442
441 if (!win) return; 443 EINA_SAFETY_ON_NULL_RETURN(win);
444
442 /* FIXME: This should raise the xdg surface also */ 445 /* FIXME: This should raise the xdg surface also */
443 if (win->shell_surface) 446 if (win->shell_surface)
444 wl_shell_surface_set_toplevel(win->shell_surface); 447 wl_shell_surface_set_toplevel(win->shell_surface);
@@ -482,7 +485,7 @@ ecore_wl_window_maximized_get(Ecore_Wl_Window *win)
482{ 485{
483 LOGFN(__FILE__, __LINE__, __FUNCTION__); 486 LOGFN(__FILE__, __LINE__, __FUNCTION__);
484 487
485 if (!win) return EINA_FALSE; 488 EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
486 489
487 return win->maximized; 490 return win->maximized;
488} 491}
@@ -530,7 +533,7 @@ ecore_wl_window_fullscreen_get(Ecore_Wl_Window *win)
530{ 533{
531 LOGFN(__FILE__, __LINE__, __FUNCTION__); 534 LOGFN(__FILE__, __LINE__, __FUNCTION__);
532 535
533 if (!win) return EINA_FALSE; 536 EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
534 537
535 return win->fullscreen; 538 return win->fullscreen;
536} 539}
@@ -540,7 +543,8 @@ ecore_wl_window_transparent_set(Ecore_Wl_Window *win, Eina_Bool transparent)
540{ 543{
541 LOGFN(__FILE__, __LINE__, __FUNCTION__); 544 LOGFN(__FILE__, __LINE__, __FUNCTION__);
542 545
543 if (!win) return; 546 EINA_SAFETY_ON_NULL_RETURN(win);
547
544 win->transparent = transparent; 548 win->transparent = transparent;
545 if (!win->transparent) 549 if (!win->transparent)
546 ecore_wl_window_opaque_region_set(win, win->opaque.x, win->opaque.y, 550 ecore_wl_window_opaque_region_set(win, win->opaque.x, win->opaque.y,
@@ -554,7 +558,7 @@ ecore_wl_window_alpha_get(Ecore_Wl_Window *win)
554{ 558{
555 LOGFN(__FILE__, __LINE__, __FUNCTION__); 559 LOGFN(__FILE__, __LINE__, __FUNCTION__);
556 560
557 if (!win) return EINA_FALSE; 561 EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
558 562
559 return win->alpha; 563 return win->alpha;
560} 564}
@@ -564,7 +568,8 @@ ecore_wl_window_alpha_set(Ecore_Wl_Window *win, Eina_Bool alpha)
564{ 568{
565 LOGFN(__FILE__, __LINE__, __FUNCTION__); 569 LOGFN(__FILE__, __LINE__, __FUNCTION__);
566 570
567 if (!win) return; 571 EINA_SAFETY_ON_NULL_RETURN(win);
572
568 win->alpha = alpha; 573 win->alpha = alpha;
569 if (!win->alpha) 574 if (!win->alpha)
570 ecore_wl_window_opaque_region_set(win, win->opaque.x, win->opaque.y, 575 ecore_wl_window_opaque_region_set(win, win->opaque.x, win->opaque.y,
@@ -578,7 +583,7 @@ ecore_wl_window_transparent_get(Ecore_Wl_Window *win)
578{ 583{
579 LOGFN(__FILE__, __LINE__, __FUNCTION__); 584 LOGFN(__FILE__, __LINE__, __FUNCTION__);
580 585
581 if (!win) return EINA_FALSE; 586 EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
582 587
583 return win->transparent; 588 return win->transparent;
584} 589}
@@ -588,7 +593,8 @@ ecore_wl_window_update_size(Ecore_Wl_Window *win, int w, int h)
588{ 593{
589 LOGFN(__FILE__, __LINE__, __FUNCTION__); 594 LOGFN(__FILE__, __LINE__, __FUNCTION__);
590 595
591 if (!win) return; 596 EINA_SAFETY_ON_NULL_RETURN(win);
597
592 win->allocation.w = w; 598 win->allocation.w = w;
593 win->allocation.h = h; 599 win->allocation.h = h;
594 if ((!ecore_wl_window_maximized_get(win)) && (!win->fullscreen)) 600 if ((!ecore_wl_window_maximized_get(win)) && (!win->fullscreen))
@@ -608,7 +614,8 @@ ecore_wl_window_update_location(Ecore_Wl_Window *win, int x, int y)
608{ 614{
609 LOGFN(__FILE__, __LINE__, __FUNCTION__); 615 LOGFN(__FILE__, __LINE__, __FUNCTION__);
610 616
611 if (!win) return; 617 EINA_SAFETY_ON_NULL_RETURN(win);
618
612 win->allocation.x = x; 619 win->allocation.x = x;
613 win->allocation.y = y; 620 win->allocation.y = y;
614 621
@@ -623,7 +630,8 @@ ecore_wl_window_surface_get(Ecore_Wl_Window *win)
623{ 630{
624 LOGFN(__FILE__, __LINE__, __FUNCTION__); 631 LOGFN(__FILE__, __LINE__, __FUNCTION__);
625 632
626 if (!win) return NULL; 633 EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
634
627 return win->surface; 635 return win->surface;
628} 636}
629 637
@@ -633,7 +641,8 @@ ecore_wl_window_shell_surface_get(Ecore_Wl_Window *win)
633{ 641{
634 LOGFN(__FILE__, __LINE__, __FUNCTION__); 642 LOGFN(__FILE__, __LINE__, __FUNCTION__);
635 643
636 if (!win) return NULL; 644 EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
645
637 return win->shell_surface; 646 return win->shell_surface;
638} 647}
639 648
@@ -643,7 +652,8 @@ ecore_wl_window_xdg_surface_get(Ecore_Wl_Window *win)
643{ 652{
644 LOGFN(__FILE__, __LINE__, __FUNCTION__); 653 LOGFN(__FILE__, __LINE__, __FUNCTION__);
645 654
646 if (!win) return NULL; 655 EINA_SAFETY_ON_NULL_RETURN_VAL(win, NULL);
656
647 return win->xdg_surface; 657 return win->xdg_surface;
648} 658}
649 659
@@ -662,7 +672,8 @@ ecore_wl_window_type_set(Ecore_Wl_Window *win, Ecore_Wl_Window_Type type)
662{ 672{
663 LOGFN(__FILE__, __LINE__, __FUNCTION__); 673 LOGFN(__FILE__, __LINE__, __FUNCTION__);
664 674
665 if (!win) return; 675 EINA_SAFETY_ON_NULL_RETURN(win);
676
666 win->type = type; 677 win->type = type;
667} 678}
668 679
@@ -673,7 +684,7 @@ ecore_wl_window_pointer_set(Ecore_Wl_Window *win, struct wl_surface *surface, in
673 684
674 LOGFN(__FILE__, __LINE__, __FUNCTION__); 685 LOGFN(__FILE__, __LINE__, __FUNCTION__);
675 686
676 if (!win) return; 687 EINA_SAFETY_ON_NULL_RETURN(win);
677 688
678 win->pointer.surface = surface; 689 win->pointer.surface = surface;
679 win->pointer.hot_x = hot_x; 690 win->pointer.hot_x = hot_x;
@@ -691,7 +702,7 @@ ecore_wl_window_cursor_from_name_set(Ecore_Wl_Window *win, const char *cursor_na
691 702
692 LOGFN(__FILE__, __LINE__, __FUNCTION__); 703 LOGFN(__FILE__, __LINE__, __FUNCTION__);
693 704
694 if (!win) return; 705 EINA_SAFETY_ON_NULL_RETURN(win);
695 706
696 win->pointer.set = EINA_FALSE; 707 win->pointer.set = EINA_FALSE;
697 708
@@ -711,7 +722,7 @@ ecore_wl_window_cursor_default_restore(Ecore_Wl_Window *win)
711 722
712 LOGFN(__FILE__, __LINE__, __FUNCTION__); 723 LOGFN(__FILE__, __LINE__, __FUNCTION__);
713 724
714 if (!win) return; 725 EINA_SAFETY_ON_NULL_RETURN(win);
715 726
716 win->pointer.set = EINA_FALSE; 727 win->pointer.set = EINA_FALSE;
717 728
@@ -725,6 +736,8 @@ ecore_wl_window_parent_set(Ecore_Wl_Window *win, Ecore_Wl_Window *parent)
725{ 736{
726 LOGFN(__FILE__, __LINE__, __FUNCTION__); 737 LOGFN(__FILE__, __LINE__, __FUNCTION__);
727 738
739 EINA_SAFETY_ON_NULL_RETURN(win);
740
728 win->parent = parent; 741 win->parent = parent;
729} 742}
730 743
@@ -737,7 +750,7 @@ ecore_wl_window_iconified_set(Ecore_Wl_Window *win, Eina_Bool iconified)
737 750
738 LOGFN(__FILE__, __LINE__, __FUNCTION__); 751 LOGFN(__FILE__, __LINE__, __FUNCTION__);
739 752
740 if (!win) return; 753 EINA_SAFETY_ON_NULL_RETURN(win);
741 754
742 if (iconified) 755 if (iconified)
743 { 756 {
@@ -776,7 +789,8 @@ ecore_wl_window_iconified_get(Ecore_Wl_Window *win)
776{ 789{
777 LOGFN(__FILE__, __LINE__, __FUNCTION__); 790 LOGFN(__FILE__, __LINE__, __FUNCTION__);
778 791
779 if (!win) return EINA_FALSE; 792 EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
793
780 return win->minimized; 794 return win->minimized;
781} 795}
782 796
@@ -787,6 +801,8 @@ ecore_wl_window_surface_find(struct wl_surface *surface)
787 Ecore_Wl_Window *win = NULL; 801 Ecore_Wl_Window *win = NULL;
788 void *data; 802 void *data;
789 803
804 EINA_SAFETY_ON_NULL_RETURN_VAL(surface, NULL);
805
790 itr = eina_hash_iterator_data_new(_windows); 806 itr = eina_hash_iterator_data_new(_windows);
791 while (eina_iterator_next(itr, &data)) 807 while (eina_iterator_next(itr, &data))
792 { 808 {
@@ -808,7 +824,7 @@ ecore_wl_window_input_region_set(Ecore_Wl_Window *win, int x, int y, int w, int
808{ 824{
809 LOGFN(__FILE__, __LINE__, __FUNCTION__); 825 LOGFN(__FILE__, __LINE__, __FUNCTION__);
810 826
811 if (!win) return; 827 EINA_SAFETY_ON_NULL_RETURN(win);
812 828
813 win->input.x = x; 829 win->input.x = x;
814 win->input.y = y; 830 win->input.y = y;
@@ -851,7 +867,7 @@ ecore_wl_window_opaque_region_set(Ecore_Wl_Window *win, int x, int y, int w, int
851 867
852 LOGFN(__FILE__, __LINE__, __FUNCTION__); 868 LOGFN(__FILE__, __LINE__, __FUNCTION__);
853 869
854 if (!win) return; 870 EINA_SAFETY_ON_NULL_RETURN(win);
855 871
856 win->opaque.x = x; 872 win->opaque.x = x;
857 win->opaque.y = y; 873 win->opaque.y = y;
@@ -889,7 +905,8 @@ ecore_wl_window_rotation_set(Ecore_Wl_Window *win, int rotation)
889{ 905{
890 LOGFN(__FILE__, __LINE__, __FUNCTION__); 906 LOGFN(__FILE__, __LINE__, __FUNCTION__);
891 907
892 if (!win) return; 908 EINA_SAFETY_ON_NULL_RETURN(win);
909
893 win->rotation = rotation; 910 win->rotation = rotation;
894} 911}
895 912
@@ -899,7 +916,8 @@ ecore_wl_window_rotation_get(Ecore_Wl_Window *win)
899{ 916{
900 LOGFN(__FILE__, __LINE__, __FUNCTION__); 917 LOGFN(__FILE__, __LINE__, __FUNCTION__);
901 918
902 if (!win) return 0; 919 EINA_SAFETY_ON_NULL_RETURN_VAL(win, 0);
920
903 return win->rotation; 921 return win->rotation;
904} 922}
905 923
@@ -909,7 +927,8 @@ ecore_wl_window_id_get(Ecore_Wl_Window *win)
909{ 927{
910 LOGFN(__FILE__, __LINE__, __FUNCTION__); 928 LOGFN(__FILE__, __LINE__, __FUNCTION__);
911 929
912 if (!win) return 0; 930 EINA_SAFETY_ON_NULL_RETURN_VAL(win, 0);
931
913 return win->id; 932 return win->id;
914} 933}
915 934
@@ -919,7 +938,8 @@ ecore_wl_window_surface_id_get(Ecore_Wl_Window *win)
919{ 938{
920 LOGFN(__FILE__, __LINE__, __FUNCTION__); 939 LOGFN(__FILE__, __LINE__, __FUNCTION__);
921 940
922 if (!win) return 0; 941 EINA_SAFETY_ON_NULL_RETURN_VAL(win, 0);
942
923 return win->surface_id; 943 return win->surface_id;
924} 944}
925 945
@@ -929,7 +949,8 @@ ecore_wl_window_title_set(Ecore_Wl_Window *win, const char *title)
929{ 949{
930 LOGFN(__FILE__, __LINE__, __FUNCTION__); 950 LOGFN(__FILE__, __LINE__, __FUNCTION__);
931 951
932 if (!win) return; 952 EINA_SAFETY_ON_NULL_RETURN(win);
953
933 eina_stringshare_replace(&win->title, title); 954 eina_stringshare_replace(&win->title, title);
934 955
935 if ((win->xdg_surface) && (win->title)) 956 if ((win->xdg_surface) && (win->title))
@@ -944,7 +965,8 @@ ecore_wl_window_class_name_set(Ecore_Wl_Window *win, const char *class_name)
944{ 965{
945 LOGFN(__FILE__, __LINE__, __FUNCTION__); 966 LOGFN(__FILE__, __LINE__, __FUNCTION__);
946 967
947 if (!win) return; 968 EINA_SAFETY_ON_NULL_RETURN(win);
969
948 eina_stringshare_replace(&win->class_name, class_name); 970 eina_stringshare_replace(&win->class_name, class_name);
949 971
950 if ((win->xdg_surface) && (win->class_name)) 972 if ((win->xdg_surface) && (win->class_name))
@@ -960,7 +982,8 @@ ecore_wl_window_keyboard_get(Ecore_Wl_Window *win)
960{ 982{
961 LOGFN(__FILE__, __LINE__, __FUNCTION__); 983 LOGFN(__FILE__, __LINE__, __FUNCTION__);
962 984
963 if (!win) return 0; 985 EINA_SAFETY_ON_NULL_RETURN_VAL(win, 0);
986
964 return win->keyboard_device; 987 return win->keyboard_device;
965} 988}
966 989