diff options
author | David Walter Seikel | 2012-04-22 09:19:23 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-04-22 09:19:23 +1000 |
commit | c963d75dfdeec11f82e79e727062fbf89afa2c04 (patch) | |
tree | 895633dbf641110be46f117c29890c49b3ffc0bd /libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c | |
parent | Adding the new extantz viewer and grid manager. (diff) | |
download | SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.zip SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.gz SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.bz2 SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.xz |
Update EFL to latest beta.
Diffstat (limited to 'libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c')
-rw-r--r-- | libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c | 173 |
1 files changed, 36 insertions, 137 deletions
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c index 459f051..058aef0 100644 --- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c | |||
@@ -107,8 +107,8 @@ ecore_win32_window_internal_new(Ecore_Win32_Window *parent, | |||
107 | w->min_height = 0; | 107 | w->min_height = 0; |
108 | w->max_width = 32767; | 108 | w->max_width = 32767; |
109 | w->max_height = 32767; | 109 | w->max_height = 32767; |
110 | w->base_width = 0; | 110 | w->base_width = -1; |
111 | w->base_height = 0; | 111 | w->base_height = -1; |
112 | w->step_width = 1; | 112 | w->step_width = 1; |
113 | w->step_height = 1; | 113 | w->step_height = 1; |
114 | 114 | ||
@@ -249,6 +249,8 @@ ecore_win32_window_free(Ecore_Win32_Window *window) | |||
249 | * | 249 | * |
250 | * This function returns the window HANDLE associated to @p window. If | 250 | * This function returns the window HANDLE associated to @p window. If |
251 | * @p window is @c NULL, this function returns @c NULL. | 251 | * @p window is @c NULL, this function returns @c NULL. |
252 | * | ||
253 | * @note The returned value is of type HWND. | ||
252 | */ | 254 | */ |
253 | EAPI void * | 255 | EAPI void * |
254 | ecore_win32_window_hwnd_get(Ecore_Win32_Window *window) | 256 | ecore_win32_window_hwnd_get(Ecore_Win32_Window *window) |
@@ -755,140 +757,6 @@ ecore_win32_window_size_step_get(Ecore_Win32_Window *window, | |||
755 | if (step_height) *step_height = window->step_height; | 757 | if (step_height) *step_height = window->step_height; |
756 | } | 758 | } |
757 | 759 | ||
758 | EAPI void | ||
759 | ecore_win32_window_shape_set(Ecore_Win32_Window *window, | ||
760 | unsigned short width, | ||
761 | unsigned short height, | ||
762 | unsigned char *mask) | ||
763 | { | ||
764 | HRGN rgn; | ||
765 | int x; | ||
766 | int y; | ||
767 | OSVERSIONINFO version_info; | ||
768 | |||
769 | if (!window) | ||
770 | return; | ||
771 | |||
772 | if (!mask) | ||
773 | { | ||
774 | window->shape.enabled = 0; | ||
775 | if (window->shape.layered != 0) | ||
776 | { | ||
777 | window->shape.layered = 0; | ||
778 | #if defined(WS_EX_LAYERED) | ||
779 | SetLastError(0); | ||
780 | if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, | ||
781 | GetWindowLong(window->window, GWL_EXSTYLE) & (~WS_EX_LAYERED)) && | ||
782 | (GetLastError() != 0)) | ||
783 | { | ||
784 | ERR("SetWindowLongPtr() failed"); | ||
785 | return; | ||
786 | } | ||
787 | if (!RedrawWindow(window->window, NULL, NULL, | ||
788 | RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN)) | ||
789 | { | ||
790 | ERR("RedrawWindow() failed"); | ||
791 | return; | ||
792 | } | ||
793 | #endif | ||
794 | } | ||
795 | else | ||
796 | if (!SetWindowRgn(window->window, NULL, TRUE)) | ||
797 | { | ||
798 | ERR("SetWindowRgn() failed"); | ||
799 | } | ||
800 | return; | ||
801 | } | ||
802 | |||
803 | if (width == 0 || height == 0) | ||
804 | return; | ||
805 | |||
806 | window->shape.enabled = 1; | ||
807 | |||
808 | if (width != window->shape.width || height != window->shape.height) | ||
809 | { | ||
810 | window->shape.width = width; | ||
811 | window->shape.height = height; | ||
812 | if (window->shape.mask) | ||
813 | { | ||
814 | free(window->shape.mask); | ||
815 | window->shape.mask = NULL; | ||
816 | } | ||
817 | window->shape.mask = malloc(width * height); | ||
818 | } | ||
819 | memcpy(window->shape.mask, mask, width * height); | ||
820 | |||
821 | window->shape.layered = 0; | ||
822 | |||
823 | #if defined(WS_EX_LAYERED) | ||
824 | version_info.dwOSVersionInfoSize = sizeof(version_info); | ||
825 | if (GetVersionEx(&version_info) == TRUE && version_info.dwMajorVersion == 5) | ||
826 | { | ||
827 | SetLastError(0); | ||
828 | if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, | ||
829 | GetWindowLong(window->window, GWL_EXSTYLE) | WS_EX_LAYERED) && | ||
830 | (GetLastError() != 0)) | ||
831 | { | ||
832 | ERR("SetWindowLongPtr() failed"); | ||
833 | return; | ||
834 | } | ||
835 | window->shape.layered = 1; | ||
836 | return; | ||
837 | } | ||
838 | #endif | ||
839 | |||
840 | if (!(rgn = CreateRectRgn(0, 0, 0, 0))) | ||
841 | { | ||
842 | ERR("CreateRectRgn() failed"); | ||
843 | return; | ||
844 | } | ||
845 | for (y = 0; y < height; y++) | ||
846 | { | ||
847 | HRGN rgnLine; | ||
848 | |||
849 | if (!(rgnLine = CreateRectRgn(0, 0, 0, 0))) | ||
850 | { | ||
851 | ERR("CreateRectRgn() failed"); | ||
852 | return; | ||
853 | } | ||
854 | for (x = 0; x < width; x++) | ||
855 | { | ||
856 | if (mask[y * width + x] > 0) | ||
857 | { | ||
858 | HRGN rgnDot; | ||
859 | |||
860 | if (!(rgnDot = CreateRectRgn(x, y, x + 1, y + 1))) | ||
861 | { | ||
862 | ERR("CreateRectRgn() failed"); | ||
863 | return; | ||
864 | } | ||
865 | if (CombineRgn(rgnLine, rgnLine, rgnDot, RGN_OR) == ERROR) | ||
866 | { | ||
867 | ERR("CombineRgn() has not created a new region"); | ||
868 | } | ||
869 | if (!DeleteObject(rgnDot)) | ||
870 | { | ||
871 | ERR("DeleteObject() failed"); | ||
872 | return; | ||
873 | } | ||
874 | } | ||
875 | } | ||
876 | if (CombineRgn(rgn, rgn, rgnLine, RGN_OR) == ERROR) | ||
877 | { | ||
878 | ERR("CombineRgn() has not created a new region"); | ||
879 | } | ||
880 | if (!DeleteObject(rgnLine)) | ||
881 | { | ||
882 | ERR("DeleteObject() failed"); | ||
883 | return; | ||
884 | } | ||
885 | } | ||
886 | if (!SetWindowRgn(window->window, rgn, TRUE)) | ||
887 | { | ||
888 | ERR("SetWindowRgn() failed"); | ||
889 | } | ||
890 | } | ||
891 | |||
892 | /** | 760 | /** |
893 | * @brief Show the given window. | 761 | * @brief Show the given window. |
894 | * | 762 | * |
@@ -1011,7 +879,7 @@ ecore_win32_window_title_set(Ecore_Win32_Window *window, | |||
1011 | * @c NULL, this function does nothing. | 879 | * @c NULL, this function does nothing. |
1012 | */ | 880 | */ |
1013 | EAPI void | 881 | EAPI void |
1014 | ecore_win32_window_focus_set(Ecore_Win32_Window *window) | 882 | ecore_win32_window_focus(Ecore_Win32_Window *window) |
1015 | { | 883 | { |
1016 | if (!window) return; | 884 | if (!window) return; |
1017 | 885 | ||
@@ -1024,6 +892,37 @@ ecore_win32_window_focus_set(Ecore_Win32_Window *window) | |||
1024 | } | 892 | } |
1025 | 893 | ||
1026 | /** | 894 | /** |
895 | * @brief Get the current focused window. | ||
896 | * | ||
897 | * @return The window that has focus. | ||
898 | * | ||
899 | * This function returns the window that has focus. If the calling | ||
900 | * thread's message queue does not have an associated window with the | ||
901 | * keyboard focus, the return value is @c NULL. | ||
902 | * | ||
903 | * @note Even if the returned value is @c NULL, another thread's queue | ||
904 | * may be associated with a window that has the keyboard focus. | ||
905 | * | ||
906 | * @note The returned value is of type HWND. | ||
907 | */ | ||
908 | EAPI void * | ||
909 | ecore_win32_window_focus_get(void) | ||
910 | { | ||
911 | HWND focused; | ||
912 | |||
913 | INF("getting focused window"); | ||
914 | |||
915 | focused = GetFocus(); | ||
916 | if (!focused) | ||
917 | { | ||
918 | ERR("GetFocus() failed"); | ||
919 | return NULL; | ||
920 | } | ||
921 | |||
922 | return focused; | ||
923 | } | ||
924 | |||
925 | /** | ||
1027 | * @brief Iconify or restore the given window. | 926 | * @brief Iconify or restore the given window. |
1028 | * | 927 | * |
1029 | * @param window The window. | 928 | * @param window The window. |